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,
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,
13,
13,
13,
17,
40,
13,
4,
18,
13,
13,
4,
18,
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,
29,
13,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
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
],
[
7,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
14,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
23,
29
],
[
22,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
21,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
34,
44
],
[
44,
45
],
[
44,
46
],
[
34,
48
],
[
48,
49
],
[
48,
50
],
[
34,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
71,
72
],
[
34,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
79,
80
],
[
34,
81
],
[
81,
82
],
[
81,
83
],
[
34,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
103,
104
],
[
96,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
107,
110
],
[
106,
111
],
[
105,
112
],
[
112,
113
],
[
34,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
34,
118
],
[
118,
119
],
[
119,
120
],
[
12,
121
],
[
121,
122
],
[
7,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
125,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
146,
152
],
[
152,
153
],
[
146,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
154,
160
],
[
160,
161
],
[
160,
162
],
[
154,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
125,
168
],
[
168,
169
],
[
169,
170
],
[
123,
171
],
[
171,
172
],
[
123,
173
],
[
173,
174
]
] | [
"import java.io.*;\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());\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(BinarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\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}",
"import java.io.*;",
"io.*",
"java",
"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());\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(BinarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\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}",
"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());\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(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());\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(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());\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(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());\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(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(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(BinarySearch(a,b)>=0) ans++;\n}",
"{\nint b=Integer.parseInt(st2.nextToken());\nif(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(BinarySearch(a,b)>=0) ans++;",
"BinarySearch(a,b)>=0",
"BinarySearch(a,b)",
"BinarySearch",
"a",
"b",
"0",
"ans++",
"ans",
"out.println(ans)",
"out.println",
"out",
"ans",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"private 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}",
"BinarySearch",
"{\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}",
"int lb=0;",
"lb",
"0",
"int ub=a.length;",
"ub",
"a.length",
"a",
"a.length",
"while(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}",
"ub>lb",
"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}",
"int mid=(lb+ub)/2;",
"mid",
"(lb+ub)/2",
"(lb+ub)",
"lb",
"ub",
"2",
"if(a[mid]==b) return mid;\nelse if(a[mid]>b) ub=mid;\nelse lb=mid+1;",
"a[mid]==b",
"a[mid]",
"a",
"mid",
"b",
"return mid;",
"mid",
"if(a[mid]>b) ub=mid;\nelse lb=mid+1;",
"a[mid]>b",
"a[mid]",
"a",
"mid",
"b",
"ub=mid",
"ub",
"mid",
"lb=mid+1",
"lb",
"mid+1",
"mid",
"1",
"return -1;",
"-1",
"1",
"int[] a",
"a",
"int b",
"b"
] | import java.io.*;
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++;
}
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,
41,
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,
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,
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,
42,
2,
13,
13,
30,
41,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
173,
5
],
[
173,
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
],
[
18,
19
],
[
19,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
8,
78
],
[
78,
79
],
[
78,
80
],
[
8,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
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
],
[
173,
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
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
129,
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
],
[
150,
152
],
[
149,
153
],
[
148,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
148,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
114,
166
],
[
166,
167
],
[
112,
168
],
[
168,
169
],
[
112,
170
],
[
170,
171
],
[
0,
172
],
[
172,
173
],
[
172,
174
]
] | [
"import java.util.*;\npublic class Main {\n\tpublic static void main(String args[]){\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n,q;\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint[] data = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tdata[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nums);\n\t\tint ans =0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\t\n\t\t\n\t}\n\tpublic static boolean search(int[] nums,int x){\n\t\tint l =0; \n\t\tint r = nums.length-1;\n\t\twhile(l<=r){\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}\n\t\t}\n\t\treturn false;\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;\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint[] data = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tdata[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nums);\n\t\tint ans =0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\t\n\t\t\n\t}\n\tpublic static boolean search(int[] nums,int x){\n\t\tint l =0; \n\t\tint r = nums.length-1;\n\t\twhile(l<=r){\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =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 sc =new Scanner(System.in);\n\t\tint n,q;\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint[] data = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tdata[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nums);\n\t\tint ans =0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\t\n\t\t\n\t}",
"main",
"{\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n,q;\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint[] data = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tdata[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nums);\n\t\tint ans =0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\t\n\t\t\n\t}",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n",
"n",
"q;",
"q",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] nums = new int[n];",
"nums",
"new int[n]",
"n",
"for(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"nums[i] = sc.nextInt()",
"nums[i]",
"nums",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] data = new int[q];",
"data",
"new int[q]",
"q",
"for(int i=0;i<q;i++){\n\t\t\tdata[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tdata[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tdata[i] = sc.nextInt();\n\t\t}",
"data[i] = sc.nextInt()",
"data[i]",
"data",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(nums)",
"Arrays.sort",
"Arrays",
"nums",
"int ans =0;",
"ans",
"0",
"for(int i=0;i<q;i++){\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"if(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}",
"search(nums,data[i])",
"search",
"nums",
"data[i]",
"data",
"i",
"{\n\t\t\t\tans++;\n\t\t\t}",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args",
"public static boolean search(int[] nums,int x){\n\t\tint l =0; \n\t\tint r = nums.length-1;\n\t\twhile(l<=r){\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"search",
"{\n\t\tint l =0; \n\t\tint r = nums.length-1;\n\t\twhile(l<=r){\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"int l =0;",
"l",
"0",
"int r = nums.length-1;",
"r",
"nums.length-1",
"nums.length",
"nums",
"nums.length",
"1",
"while(l<=r){\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}\n\t\t}",
"l<=r",
"l",
"r",
"{\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}\n\t\t}",
"int mid = l+(r-l)/2;",
"mid",
"l+(r-l)/2",
"l",
"(r-l)/2",
"(r-l)",
"r",
"l",
"2",
"if(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}",
"nums[mid]==x",
"nums[mid]",
"nums",
"mid",
"x",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}",
"nums[mid]>x",
"nums[mid]",
"nums",
"mid",
"x",
"{\n\t\t\t\tr =mid-1;\n\t\t\t}",
"r =mid-1",
"r",
"mid-1",
"mid",
"1",
"{\n\t\t\t\tl =mid+1;\n\t\t\t}",
"l =mid+1",
"l",
"mid+1",
"mid",
"1",
"return false;",
"false",
"int[] nums",
"nums",
"int x",
"x",
"public class Main {\n\tpublic static void main(String args[]){\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n,q;\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint[] data = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tdata[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nums);\n\t\tint ans =0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\t\n\t\t\n\t}\n\tpublic static boolean search(int[] nums,int x){\n\t\tint l =0; \n\t\tint r = nums.length-1;\n\t\twhile(l<=r){\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}\n\t\t}\n\t\treturn false;\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;\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint[] data = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tdata[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nums);\n\t\tint ans =0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif(search(nums,data[i])){\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\t\n\t\t\n\t}\n\tpublic static boolean search(int[] nums,int x){\n\t\tint l =0; \n\t\tint r = nums.length-1;\n\t\twhile(l<=r){\n\t\t\tint mid = l+(r-l)/2;\n\t\t\tif(nums[mid]==x){\n\t\t\t\treturn true;\n\t\t\t}else if(nums[mid]>x){\n\t\t\t\tr =mid-1;\n\t\t\t}else{\n\t\t\t\tl =mid+1;\n\t\t\t}\n\t\t}\n\t\treturn false;\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;
n = sc.nextInt();
int[] nums = new int[n];
for(int i=0;i<n;i++){
nums[i] = sc.nextInt();
}
q = sc.nextInt();
int[] data = new int[q];
for(int i=0;i<q;i++){
data[i] = sc.nextInt();
}
Arrays.sort(nums);
int ans =0;
for(int i=0;i<q;i++){
if(search(nums,data[i])){
ans++;
}
}
System.out.println(ans);
}
public static boolean search(int[] nums,int x){
int l =0;
int r = nums.length-1;
while(l<=r){
int mid = l+(r-l)/2;
if(nums[mid]==x){
return true;
}else if(nums[mid]>x){
r =mid-1;
}else{
l =mid+1;
}
}
return false;
}
} |
[
7,
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,
0,
13,
4,
18,
13,
14,
2,
4,
18,
13,
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
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
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
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
40,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
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
],
[
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
],
[
8,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
6,
88
],
[
88,
89
]
] | [
"import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, tmp, count = 0;\n\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\n\t\tn = sc.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttmp = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}\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 sc = new Scanner(System.in);\n\t\tint n, tmp, count = 0;\n\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\n\t\tn = sc.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttmp = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, tmp, count = 0;\n\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\n\t\tn = sc.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttmp = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, tmp, count = 0;\n\n\t\tn = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\n\t\tn = sc.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttmp = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}\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",
"n",
"tmp",
"tmp",
"count = 0;",
"count",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] nums = new int[n];",
"nums",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"nums[i] = sc.nextInt()",
"nums[i]",
"nums",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < n; i++) {\n\t\t\ttmp = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ttmp = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\ttmp = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"tmp = sc.nextInt()",
"tmp",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (Arrays.binarySearch(nums, tmp) >= 0) {\n\t\t\t\tcount++;\n\t\t\t}",
"Arrays.binarySearch(nums, tmp) >= 0",
"Arrays.binarySearch(nums, tmp)",
"Arrays.binarySearch",
"Arrays",
"nums",
"tmp",
"0",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n, tmp, count = 0;
n = sc.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] = sc.nextInt();
}
n = sc.nextInt();
for (int i = 0; i < n; i++) {
tmp = sc.nextInt();
if (Arrays.binarySearch(nums, tmp) >= 0) {
count++;
}
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
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,
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,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
154,
11
],
[
154,
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
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
92,
101
],
[
101,
102
],
[
101,
103
],
[
92,
104
],
[
104,
105
],
[
104,
106
],
[
92,
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
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
119,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
14,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
12,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] | [
"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 NumberFormatException, IOException {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tstr = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tstr = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tstr = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tstr = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"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\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",
"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 count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++){\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int T = Integer.parseInt(str[i]);",
"T",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int left = 0",
"left",
"0",
"right = n;",
"right",
"n",
"while(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"right != left",
"right",
"left",
"{\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int half = (right + left)/2;",
"half",
"(right + left)/2",
"(right + left)",
"right",
"left",
"2",
"if(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"S[half] < T",
"S[half]",
"S",
"half",
"T",
"{\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t}",
"left = half + 1",
"left",
"half + 1",
"half",
"1",
"if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"S[half] > T",
"S[half]",
"S",
"half",
"T",
"{\n\t\t\t\t\tright = half;\n\t\t\t\t}",
"right = half",
"right",
"half",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tstr = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tstr = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\t\n\t\t\tint T = Integer.parseInt(str[i]);\n\t\t\tint left = 0, right = n;\n\t\t\t\n\t\t\twhile(right != left){\n\t\t\t\tint half = (right + left)/2;\n\t\t\t\tif(S[half] < T){\n\t\t\t\t\tleft = half + 1;\n\t\t\t\t} else if(S[half] > T){\n\t\t\t\t\tright = half;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO 自動生成されたメソッド・スタブ
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] str = br.readLine().split(" ");
int[] S = new int[n];
for(int i = 0; i < n; i++){
S[i] = Integer.parseInt(str[i]);
}
int q = Integer.parseInt(br.readLine());
str = br.readLine().split(" ");
int count = 0;
for(int i = 0; i < q; i++){
int T = Integer.parseInt(str[i]);
int left = 0, right = n;
while(right != left){
int half = (right + left)/2;
if(S[half] < T){
left = half + 1;
} else if(S[half] > T){
right = half;
} else {
count++;
break;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
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,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
29,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
180,
5
],
[
180,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
12,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
19,
21
],
[
12,
22
],
[
22,
23
],
[
23,
24
],
[
12,
25
],
[
26,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
28,
31
],
[
31,
32
],
[
31,
33
],
[
27,
34
],
[
34,
35
],
[
35,
36
],
[
8,
37
],
[
37,
38
],
[
6,
39
],
[
39,
40
],
[
6,
41
],
[
41,
42
],
[
180,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
45,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
68,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
80,
92
],
[
92,
93
],
[
93,
94
],
[
45,
95
],
[
95,
96
],
[
43,
97
],
[
97,
98
],
[
43,
99
],
[
99,
100
],
[
180,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
103,
112
],
[
112,
113
],
[
112,
114
],
[
103,
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
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
103,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
103,
141
],
[
141,
142
],
[
141,
143
],
[
103,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
150,
151
],
[
150,
152
],
[
145,
153
],
[
153,
154
],
[
154,
155
],
[
145,
156
],
[
157,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
163,
164
],
[
103,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
170,
171
],
[
170,
172
],
[
170,
173
],
[
103,
174
],
[
174,
175
],
[
175,
176
],
[
101,
177
],
[
177,
178
],
[
0,
179
],
[
179,
180
],
[
179,
181
]
] | [
"import java.util.*;\n\npublic class Main {\n\t\n\tpublic static int totalMatches(int[] array, int[] array2) {\n\t\tint total=0;\n\t\tfor (int i = 0; i < array2.length; i++) {\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}\n\t\n\tpublic static boolean Binarysearch( int[] array, int search) {\n\t\tint left = 0;\n\t\tint right = array.length - 1;\n\t\t\n\t\twhile ( left <= right) {\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tint sizearray = input.nextInt();\n\n\t\tint array[] = new int[sizearray];\n\n\t\tfor (int i = 0; i < sizearray; i++) {\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}\n\t\t\n\t\tint sizearray2 = input.nextInt();\n\t\tint array2[] = new int[sizearray2];\n\t\tfor (int i = 0; i < sizearray2; i++) {\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}\n\t\tSystem.out.println(totalMatches(array, array2));\n\t\t\n\t\tinput.close();\n\t}\n\t\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\t\n\tpublic static int totalMatches(int[] array, int[] array2) {\n\t\tint total=0;\n\t\tfor (int i = 0; i < array2.length; i++) {\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}\n\t\n\tpublic static boolean Binarysearch( int[] array, int search) {\n\t\tint left = 0;\n\t\tint right = array.length - 1;\n\t\t\n\t\twhile ( left <= right) {\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tint sizearray = input.nextInt();\n\n\t\tint array[] = new int[sizearray];\n\n\t\tfor (int i = 0; i < sizearray; i++) {\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}\n\t\t\n\t\tint sizearray2 = input.nextInt();\n\t\tint array2[] = new int[sizearray2];\n\t\tfor (int i = 0; i < sizearray2; i++) {\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}\n\t\tSystem.out.println(totalMatches(array, array2));\n\t\t\n\t\tinput.close();\n\t}\n\t\n}",
"Main",
"public static int totalMatches(int[] array, int[] array2) {\n\t\tint total=0;\n\t\tfor (int i = 0; i < array2.length; i++) {\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}",
"totalMatches",
"{\n\t\tint total=0;\n\t\tfor (int i = 0; i < array2.length; i++) {\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}",
"int total=0;",
"total",
"0",
"for (int i = 0; i < array2.length; i++) {\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array2.length",
"i",
"array2.length",
"array2",
"array2.length",
"i++",
"i++",
"i",
"{\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}",
"if (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}",
"Binarysearch(array, array2[i])",
"Binarysearch",
"array",
"array2[i]",
"array2",
"i",
"{\n\t\t\t\ttotal++;\n\t\t\t}",
"total++",
"total",
"return total;",
"total",
"int[] array",
"array",
"int[] array2",
"array2",
"public static boolean Binarysearch( int[] array, int search) {\n\t\tint left = 0;\n\t\tint right = array.length - 1;\n\t\t\n\t\twhile ( left <= right) {\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t\t\n\t}",
"Binarysearch",
"{\n\t\tint left = 0;\n\t\tint right = array.length - 1;\n\t\t\n\t\twhile ( left <= right) {\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t\t\n\t}",
"int left = 0;",
"left",
"0",
"int right = array.length - 1;",
"right",
"array.length - 1",
"array.length",
"array",
"array.length",
"1",
"while ( left <= right) {\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}",
"int mid = (right+left)/2;",
"mid",
"(right+left)/2",
"(right+left)",
"right",
"left",
"2",
"if(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}",
"array[mid] < search",
"array[mid]",
"array",
"mid",
"search",
"{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}",
"array[mid] > search",
"array[mid]",
"array",
"mid",
"search",
"{\n\t\t\t\tright = mid - 1;\n\t\t\t}",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"return false;",
"false",
"int[] array",
"array",
"int search",
"search",
"public static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tint sizearray = input.nextInt();\n\n\t\tint array[] = new int[sizearray];\n\n\t\tfor (int i = 0; i < sizearray; i++) {\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}\n\t\t\n\t\tint sizearray2 = input.nextInt();\n\t\tint array2[] = new int[sizearray2];\n\t\tfor (int i = 0; i < sizearray2; i++) {\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}\n\t\tSystem.out.println(totalMatches(array, array2));\n\t\t\n\t\tinput.close();\n\t}",
"main",
"{\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tint sizearray = input.nextInt();\n\n\t\tint array[] = new int[sizearray];\n\n\t\tfor (int i = 0; i < sizearray; i++) {\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}\n\t\t\n\t\tint sizearray2 = input.nextInt();\n\t\tint array2[] = new int[sizearray2];\n\t\tfor (int i = 0; i < sizearray2; i++) {\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}\n\t\tSystem.out.println(totalMatches(array, array2));\n\t\t\n\t\tinput.close();\n\t}",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int sizearray = input.nextInt();",
"sizearray",
"input.nextInt()",
"input.nextInt",
"input",
"int array[] = new int[sizearray];",
"array",
"new int[sizearray]",
"sizearray",
"for (int i = 0; i < sizearray; i++) {\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sizearray",
"i",
"sizearray",
"i++",
"i++",
"i",
"{\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}",
"{\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}",
"array[i] = input.nextInt()",
"array[i]",
"array",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"int sizearray2 = input.nextInt();",
"sizearray2",
"input.nextInt()",
"input.nextInt",
"input",
"int array2[] = new int[sizearray2];",
"array2",
"new int[sizearray2]",
"sizearray2",
"for (int i = 0; i < sizearray2; i++) {\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sizearray2",
"i",
"sizearray2",
"i++",
"i++",
"i",
"{\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}",
"{\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}",
"array2[i] = input.nextInt()",
"array2[i]",
"array2",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"System.out.println(totalMatches(array, array2))",
"System.out.println",
"System.out",
"System",
"System.out",
"totalMatches(array, array2)",
"totalMatches",
"array",
"array2",
"input.close()",
"input.close",
"input",
"String[] args",
"args",
"public class Main {\n\t\n\tpublic static int totalMatches(int[] array, int[] array2) {\n\t\tint total=0;\n\t\tfor (int i = 0; i < array2.length; i++) {\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}\n\t\n\tpublic static boolean Binarysearch( int[] array, int search) {\n\t\tint left = 0;\n\t\tint right = array.length - 1;\n\t\t\n\t\twhile ( left <= right) {\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tint sizearray = input.nextInt();\n\n\t\tint array[] = new int[sizearray];\n\n\t\tfor (int i = 0; i < sizearray; i++) {\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}\n\t\t\n\t\tint sizearray2 = input.nextInt();\n\t\tint array2[] = new int[sizearray2];\n\t\tfor (int i = 0; i < sizearray2; i++) {\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}\n\t\tSystem.out.println(totalMatches(array, array2));\n\t\t\n\t\tinput.close();\n\t}\n\t\n}",
"public class Main {\n\t\n\tpublic static int totalMatches(int[] array, int[] array2) {\n\t\tint total=0;\n\t\tfor (int i = 0; i < array2.length; i++) {\n\t\t\tif (Binarysearch(array, array2[i])) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}\n\t\n\tpublic static boolean Binarysearch( int[] array, int search) {\n\t\tint left = 0;\n\t\tint right = array.length - 1;\n\t\t\n\t\twhile ( left <= right) {\n\t\t\tint mid = (right+left)/2;\n\t\t\tif(array[mid] < search) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\telse if(array[mid] > search) {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tint sizearray = input.nextInt();\n\n\t\tint array[] = new int[sizearray];\n\n\t\tfor (int i = 0; i < sizearray; i++) {\n\t\t\tarray[i] = input.nextInt();\n\n\t\t}\n\t\t\n\t\tint sizearray2 = input.nextInt();\n\t\tint array2[] = new int[sizearray2];\n\t\tfor (int i = 0; i < sizearray2; i++) {\n\t\t\tarray2[i] = input.nextInt();\n\n\t\t}\n\t\tSystem.out.println(totalMatches(array, array2));\n\t\t\n\t\tinput.close();\n\t}\n\t\n}",
"Main"
] | import java.util.*;
public class Main {
public static int totalMatches(int[] array, int[] array2) {
int total=0;
for (int i = 0; i < array2.length; i++) {
if (Binarysearch(array, array2[i])) {
total++;
}
}
return total;
}
public static boolean Binarysearch( int[] array, int search) {
int left = 0;
int right = array.length - 1;
while ( left <= right) {
int mid = (right+left)/2;
if(array[mid] < search) {
left = mid + 1;
}
else if(array[mid] > search) {
right = mid - 1;
}
else {
return true;
}
}
return false;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int sizearray = input.nextInt();
int array[] = new int[sizearray];
for (int i = 0; i < sizearray; i++) {
array[i] = input.nextInt();
}
int sizearray2 = input.nextInt();
int array2[] = new int[sizearray2];
for (int i = 0; i < sizearray2; i++) {
array2[i] = input.nextInt();
}
System.out.println(totalMatches(array, array2));
input.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,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
40,
17,
41,
13,
2,
13,
17,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
0,
13,
13,
14,
2,
18,
13,
13,
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
],
[
145,
5
],
[
145,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
85,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
95,
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
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
117,
119
],
[
109,
120
],
[
120,
121
],
[
120,
122
],
[
85,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
8,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
8,
139
],
[
139,
140
],
[
140,
141
],
[
6,
142
],
[
142,
143
],
[
0,
144
],
[
144,
145
],
[
144,
146
]
] | [
"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++){\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\n int ans = 0;\n\n for(int i = 0; i < q; i++){\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }\n\n System.out.println(ans);\n\n sc.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int S[] = new int[n];\n for(int i = 0; i < n; i++){\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int T[] = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n\n int ans = 0;\n\n for(int i = 0; i < q; i++){\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }\n\n System.out.println(ans);\n\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\n int ans = 0;\n\n for(int i = 0; i < q; i++){\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }\n\n System.out.println(ans);\n\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\n int ans = 0;\n\n for(int i = 0; i < q; i++){\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }\n\n System.out.println(ans);\n\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",
"int ans = 0;",
"ans",
"0",
"for(int i = 0; i < q; i++){\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }",
"{\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }",
"int left = -1;",
"left",
"-1",
"1",
"int right = n -1;",
"right",
"n -1",
"n",
"1",
"while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }",
"right - left > 1",
"right - left",
"right",
"left",
"1",
"{\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }",
"int mid = (left + right)/2;",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(S[mid] >= T[i]) right = mid;\n else left = mid;",
"S[mid] >= T[i]",
"S[mid]",
"S",
"mid",
"T[i]",
"T",
"i",
"right = mid",
"right",
"mid",
"left = mid",
"left",
"mid",
"if(S[right] == T[i]) ans++;",
"S[right] == T[i]",
"S[right]",
"S",
"right",
"T[i]",
"T",
"i",
"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 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\n int ans = 0;\n\n for(int i = 0; i < q; i++){\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }\n\n System.out.println(ans);\n\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\n int ans = 0;\n\n for(int i = 0; i < q; i++){\n int left = -1;\n int right = n -1;\n\n while(right - left > 1){\n int mid = (left + right)/2;\n \n if(S[mid] >= T[i]) right = mid;\n else left = mid;\n }\n \n if(S[right] == T[i]) ans++;\n }\n\n System.out.println(ans);\n\n sc.close();\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 T[] = new int[q];
for(int i = 0; i < q; i++){
T[i] = sc.nextInt();
}
int ans = 0;
for(int i = 0; i < q; i++){
int left = -1;
int right = n -1;
while(right - left > 1){
int mid = (left + right)/2;
if(S[mid] >= T[i]) right = mid;
else left = mid;
}
if(S[right] == T[i]) ans++;
}
System.out.println(ans);
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
18,
13,
13,
17,
41,
13,
17,
41,
13,
2,
2,
13,
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,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
14,
2,
13,
18,
13,
13,
30,
29,
17,
30,
29,
17,
30,
14,
2,
13,
18,
13,
2,
2,
13,
13,
17,
30,
29,
4,
13,
2,
2,
13,
13,
17,
13,
13,
30,
29,
4,
13,
13,
2,
2,
13,
13,
17,
13,
23,
13,
23,
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
],
[
4,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
16,
25
],
[
25,
26
],
[
25,
27
],
[
16,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
16,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
16,
54
],
[
54,
55
],
[
54,
56
],
[
16,
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
],
[
16,
78
],
[
78,
79
],
[
78,
80
],
[
16,
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
],
[
97,
99
],
[
96,
100
],
[
93,
101
],
[
101,
102
],
[
101,
103
],
[
93,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
93,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
115,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
128,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
115,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
16,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
14,
161
],
[
161,
162
],
[
4,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
171,
177
],
[
177,
178
],
[
178,
179
],
[
171,
180
],
[
180,
181
],
[
181,
182
],
[
166,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
189,
193
],
[
184,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
196,
203
],
[
196,
204
],
[
184,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
207,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
207,
215
],
[
163,
216
],
[
216,
217
],
[
163,
218
],
[
218,
219
],
[
163,
220
],
[
220,
221
]
] | [
"import java.util.Scanner;\n\nclass Main{\n private static int nS;\n private static int nT;\n private static int[] S;\n private static int[] T;\n\n public static void main(String[] args){\n\n\tScanner sc = new Scanner(System.in);\n\n\tnS = sc.nextInt();\t\n\tS = new int[nS];\n\tfor(int i=0;i<nS;i++){\n\t S[i] = sc.nextInt();\n\t}\n \n\tnT = sc.nextInt();\n\tT = new int[nT];\n\tfor(int i=0;i<nT;i++){\n\t T[i] = sc.nextInt();\n\t}\n\t/*\n\tfor(int i=0;i<nS;i++){\n\t if(binary(0,nS,T[i])){\n\t\tcnt++;\n\t }\n\t}\n\t*/\n\t\n\tint cnt = 0;\n\tfor(int i=0;i<nT;i++){\n\t int right=S.length-1;\n\t int left = 0;\n\t int center = (right+left)/2;\n\t while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }\n\t}\n\tSystem.out.println(cnt);\n \n }\n\n public static boolean binary(int s,int t, int x){\n\tif(s==t){\n\t if(x==S[s]){\n\t\treturn true;\n\t }else{\n\t\treturn false;\n\t }\n\t}else{\n\t if(x>=S[(s+t)/2]){\n\t\treturn binary((s+t)/2,t,x);\n\t }else{\n\t\treturn binary(s,(s+t)/2,x);\n\t }\n\t}\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n private static int nS;\n private static int nT;\n private static int[] S;\n private static int[] T;\n\n public static void main(String[] args){\n\n\tScanner sc = new Scanner(System.in);\n\n\tnS = sc.nextInt();\t\n\tS = new int[nS];\n\tfor(int i=0;i<nS;i++){\n\t S[i] = sc.nextInt();\n\t}\n \n\tnT = sc.nextInt();\n\tT = new int[nT];\n\tfor(int i=0;i<nT;i++){\n\t T[i] = sc.nextInt();\n\t}\n\t/*\n\tfor(int i=0;i<nS;i++){\n\t if(binary(0,nS,T[i])){\n\t\tcnt++;\n\t }\n\t}\n\t*/\n\t\n\tint cnt = 0;\n\tfor(int i=0;i<nT;i++){\n\t int right=S.length-1;\n\t int left = 0;\n\t int center = (right+left)/2;\n\t while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }\n\t}\n\tSystem.out.println(cnt);\n \n }\n\n public static boolean binary(int s,int t, int x){\n\tif(s==t){\n\t if(x==S[s]){\n\t\treturn true;\n\t }else{\n\t\treturn false;\n\t }\n\t}else{\n\t if(x>=S[(s+t)/2]){\n\t\treturn binary((s+t)/2,t,x);\n\t }else{\n\t\treturn binary(s,(s+t)/2,x);\n\t }\n\t}\n }\n}",
"Main",
"private static int nS;",
"nS",
"private static int nT;",
"nT",
"private static int[] S;",
"S",
"private static int[] T;",
"T",
"public static void main(String[] args){\n\n\tScanner sc = new Scanner(System.in);\n\n\tnS = sc.nextInt();\t\n\tS = new int[nS];\n\tfor(int i=0;i<nS;i++){\n\t S[i] = sc.nextInt();\n\t}\n \n\tnT = sc.nextInt();\n\tT = new int[nT];\n\tfor(int i=0;i<nT;i++){\n\t T[i] = sc.nextInt();\n\t}\n\t/*\n\tfor(int i=0;i<nS;i++){\n\t if(binary(0,nS,T[i])){\n\t\tcnt++;\n\t }\n\t}\n\t*/\n\t\n\tint cnt = 0;\n\tfor(int i=0;i<nT;i++){\n\t int right=S.length-1;\n\t int left = 0;\n\t int center = (right+left)/2;\n\t while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }\n\t}\n\tSystem.out.println(cnt);\n \n }",
"main",
"{\n\n\tScanner sc = new Scanner(System.in);\n\n\tnS = sc.nextInt();\t\n\tS = new int[nS];\n\tfor(int i=0;i<nS;i++){\n\t S[i] = sc.nextInt();\n\t}\n \n\tnT = sc.nextInt();\n\tT = new int[nT];\n\tfor(int i=0;i<nT;i++){\n\t T[i] = sc.nextInt();\n\t}\n\t/*\n\tfor(int i=0;i<nS;i++){\n\t if(binary(0,nS,T[i])){\n\t\tcnt++;\n\t }\n\t}\n\t*/\n\t\n\tint cnt = 0;\n\tfor(int i=0;i<nT;i++){\n\t int right=S.length-1;\n\t int left = 0;\n\t int center = (right+left)/2;\n\t while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }\n\t}\n\tSystem.out.println(cnt);\n \n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"nS = sc.nextInt()",
"nS",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S = new int[nS]",
"S",
"new int[nS]",
"nS",
"for(int i=0;i<nS;i++){\n\t S[i] = sc.nextInt();\n\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<nS",
"i",
"nS",
"i++",
"i++",
"i",
"{\n\t S[i] = sc.nextInt();\n\t}",
"{\n\t S[i] = sc.nextInt();\n\t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"nT = sc.nextInt()",
"nT",
"sc.nextInt()",
"sc.nextInt",
"sc",
"T = new int[nT]",
"T",
"new int[nT]",
"nT",
"for(int i=0;i<nT;i++){\n\t T[i] = sc.nextInt();\n\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<nT",
"i",
"nT",
"i++",
"i++",
"i",
"{\n\t T[i] = sc.nextInt();\n\t}",
"{\n\t T[i] = sc.nextInt();\n\t}",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int cnt = 0;",
"cnt",
"0",
"for(int i=0;i<nT;i++){\n\t int right=S.length-1;\n\t int left = 0;\n\t int center = (right+left)/2;\n\t while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }\n\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<nT",
"i",
"nT",
"i++",
"i++",
"i",
"{\n\t int right=S.length-1;\n\t int left = 0;\n\t int center = (right+left)/2;\n\t while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }\n\t}",
"{\n\t int right=S.length-1;\n\t int left = 0;\n\t int center = (right+left)/2;\n\t while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }\n\t}",
"int right=S.length-1;",
"right",
"S.length-1",
"S.length",
"S",
"S.length",
"1",
"int left = 0;",
"left",
"0",
"int center = (right+left)/2;",
"center",
"(right+left)/2",
"(right+left)",
"right",
"left",
"2",
"while(left<=right){\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }",
"left<=right",
"left",
"right",
"{\n\t\tif(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}\n\t\tif(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}\n\t\tcenter = (right+left)/2;\n\t }",
"if(S[center]==T[i]){\n\t\t cnt++;\n\t\t break;\n\t\t}",
"S[center]==T[i]",
"S[center]",
"S",
"center",
"T[i]",
"T",
"i",
"{\n\t\t cnt++;\n\t\t break;\n\t\t}",
"cnt++",
"cnt",
"break;",
"if(S[center]>T[i]){\n\t\t right=center-1;\n\t\t}else{\n\t\t left=center+1;\n\t\t}",
"S[center]>T[i]",
"S[center]",
"S",
"center",
"T[i]",
"T",
"i",
"{\n\t\t right=center-1;\n\t\t}",
"right=center-1",
"right",
"center-1",
"center",
"1",
"{\n\t\t left=center+1;\n\t\t}",
"left=center+1",
"left",
"center+1",
"center",
"1",
"center = (right+left)/2",
"center",
"(right+left)/2",
"(right+left)",
"right",
"left",
"2",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public static boolean binary(int s,int t, int x){\n\tif(s==t){\n\t if(x==S[s]){\n\t\treturn true;\n\t }else{\n\t\treturn false;\n\t }\n\t}else{\n\t if(x>=S[(s+t)/2]){\n\t\treturn binary((s+t)/2,t,x);\n\t }else{\n\t\treturn binary(s,(s+t)/2,x);\n\t }\n\t}\n }",
"binary",
"{\n\tif(s==t){\n\t if(x==S[s]){\n\t\treturn true;\n\t }else{\n\t\treturn false;\n\t }\n\t}else{\n\t if(x>=S[(s+t)/2]){\n\t\treturn binary((s+t)/2,t,x);\n\t }else{\n\t\treturn binary(s,(s+t)/2,x);\n\t }\n\t}\n }",
"if(s==t){\n\t if(x==S[s]){\n\t\treturn true;\n\t }else{\n\t\treturn false;\n\t }\n\t}else{\n\t if(x>=S[(s+t)/2]){\n\t\treturn binary((s+t)/2,t,x);\n\t }else{\n\t\treturn binary(s,(s+t)/2,x);\n\t }\n\t}",
"s==t",
"s",
"t",
"{\n\t if(x==S[s]){\n\t\treturn true;\n\t }else{\n\t\treturn false;\n\t }\n\t}",
"if(x==S[s]){\n\t\treturn true;\n\t }else{\n\t\treturn false;\n\t }",
"x==S[s]",
"x",
"S[s]",
"S",
"s",
"{\n\t\treturn true;\n\t }",
"return true;",
"true",
"{\n\t\treturn false;\n\t }",
"return false;",
"false",
"{\n\t if(x>=S[(s+t)/2]){\n\t\treturn binary((s+t)/2,t,x);\n\t }else{\n\t\treturn binary(s,(s+t)/2,x);\n\t }\n\t}",
"if(x>=S[(s+t)/2]){\n\t\treturn binary((s+t)/2,t,x);\n\t }else{\n\t\treturn binary(s,(s+t)/2,x);\n\t }",
"x>=S[(s+t)/2]",
"x",
"S[(s+t)/2]",
"S",
"(s+t)/2",
"(s+t)",
"s",
"t",
"2",
"{\n\t\treturn binary((s+t)/2,t,x);\n\t }",
"return binary((s+t)/2,t,x);",
"binary((s+t)/2,t,x)",
"binary",
"(s+t)/2",
"(s+t)",
"s",
"t",
"2",
"t",
"x",
"{\n\t\treturn binary(s,(s+t)/2,x);\n\t }",
"return binary(s,(s+t)/2,x);",
"binary(s,(s+t)/2,x)",
"binary",
"s",
"(s+t)/2",
"(s+t)",
"s",
"t",
"2",
"x",
"int s",
"s",
"int t",
"t",
"int x",
"x"
] | import java.util.Scanner;
class Main{
private static int nS;
private static int nT;
private static int[] S;
private static int[] T;
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
nS = sc.nextInt();
S = new int[nS];
for(int i=0;i<nS;i++){
S[i] = sc.nextInt();
}
nT = sc.nextInt();
T = new int[nT];
for(int i=0;i<nT;i++){
T[i] = sc.nextInt();
}
/*
for(int i=0;i<nS;i++){
if(binary(0,nS,T[i])){
cnt++;
}
}
*/
int cnt = 0;
for(int i=0;i<nT;i++){
int right=S.length-1;
int left = 0;
int center = (right+left)/2;
while(left<=right){
if(S[center]==T[i]){
cnt++;
break;
}
if(S[center]>T[i]){
right=center-1;
}else{
left=center+1;
}
center = (right+left)/2;
}
}
System.out.println(cnt);
}
public static boolean binary(int s,int t, int x){
if(s==t){
if(x==S[s]){
return true;
}else{
return false;
}
}else{
if(x>=S[(s+t)/2]){
return binary((s+t)/2,t,x);
}else{
return binary(s,(s+t)/2,x);
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
41,
13,
17,
41,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
38,
5,
13,
30,
30,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
17,
0,
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,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
17,
0,
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,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
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,
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
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
14,
23
],
[
23,
24
],
[
14,
25
],
[
25,
26
],
[
25,
27
],
[
14,
28
],
[
28,
29
],
[
14,
30
],
[
30,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
14,
35
],
[
35,
36
],
[
35,
37
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
42,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
42,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
42,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
42,
65
],
[
65,
66
],
[
65,
67
],
[
42,
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
],
[
89,
91
],
[
42,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
42,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
42,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
42,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
42,
114
],
[
114,
115
],
[
114,
116
],
[
42,
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
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
42,
141
],
[
141,
142
],
[
141,
143
],
[
42,
144
],
[
144,
145
],
[
144,
146
],
[
42,
147
],
[
147,
148
],
[
147,
149
],
[
42,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
155,
156
],
[
155,
157
],
[
150,
158
],
[
158,
159
],
[
159,
160
],
[
150,
161
],
[
162,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
166,
168
],
[
162,
169
],
[
169,
170
],
[
169,
171
],
[
162,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
176,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
185,
189
],
[
189,
190
],
[
189,
191
],
[
184,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
184,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
201,
202
],
[
201,
203
],
[
196,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
196,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
211,
213
],
[
42,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
214,
219
],
[
12,
220
],
[
220,
221
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\nclass Main{\n\tpublic static void main(String[] args) {\n\n\t\tint suretu_kazu=0;\n\t\tint[] suretu;\n\t\tint bubun_nokazu=0;\n\t\tint[] bubun;\n\t\tString moji=\"\";\n\t\tString[] srt;\n\t\tString[] bbn;\n\t\tint gacchi=0;\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tmoji=bfr.readLine();\n\t\t\tsuretu_kazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tsrt=moji.split(\" \");\n\t\t\tsuretu=new int[suretu_kazu];\n\t\t\tfor(int i=0; i<suretu_kazu; i++) {\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}\n\t\t\tmoji=bfr.readLine();\n\t\t\tbubun_nokazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tbbn=moji.split(\" \");\n\t\t\tbubun=new int[bubun_nokazu];\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}\n\n\t\t\tint hidari=0;\n\t\t\tint migi=suretu_kazu;\n\t\t\tint mid=0;\n\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(gacchi);\n\t\t}catch(IOException e) {\n\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",
"class Main{\n\tpublic static void main(String[] args) {\n\n\t\tint suretu_kazu=0;\n\t\tint[] suretu;\n\t\tint bubun_nokazu=0;\n\t\tint[] bubun;\n\t\tString moji=\"\";\n\t\tString[] srt;\n\t\tString[] bbn;\n\t\tint gacchi=0;\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tmoji=bfr.readLine();\n\t\t\tsuretu_kazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tsrt=moji.split(\" \");\n\t\t\tsuretu=new int[suretu_kazu];\n\t\t\tfor(int i=0; i<suretu_kazu; i++) {\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}\n\t\t\tmoji=bfr.readLine();\n\t\t\tbubun_nokazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tbbn=moji.split(\" \");\n\t\t\tbubun=new int[bubun_nokazu];\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}\n\n\t\t\tint hidari=0;\n\t\t\tint migi=suretu_kazu;\n\t\t\tint mid=0;\n\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(gacchi);\n\t\t}catch(IOException e) {\n\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tint suretu_kazu=0;\n\t\tint[] suretu;\n\t\tint bubun_nokazu=0;\n\t\tint[] bubun;\n\t\tString moji=\"\";\n\t\tString[] srt;\n\t\tString[] bbn;\n\t\tint gacchi=0;\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tmoji=bfr.readLine();\n\t\t\tsuretu_kazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tsrt=moji.split(\" \");\n\t\t\tsuretu=new int[suretu_kazu];\n\t\t\tfor(int i=0; i<suretu_kazu; i++) {\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}\n\t\t\tmoji=bfr.readLine();\n\t\t\tbubun_nokazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tbbn=moji.split(\" \");\n\t\t\tbubun=new int[bubun_nokazu];\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}\n\n\t\t\tint hidari=0;\n\t\t\tint migi=suretu_kazu;\n\t\t\tint mid=0;\n\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(gacchi);\n\t\t}catch(IOException e) {\n\n\t\t}\n\t}",
"main",
"{\n\n\t\tint suretu_kazu=0;\n\t\tint[] suretu;\n\t\tint bubun_nokazu=0;\n\t\tint[] bubun;\n\t\tString moji=\"\";\n\t\tString[] srt;\n\t\tString[] bbn;\n\t\tint gacchi=0;\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tmoji=bfr.readLine();\n\t\t\tsuretu_kazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tsrt=moji.split(\" \");\n\t\t\tsuretu=new int[suretu_kazu];\n\t\t\tfor(int i=0; i<suretu_kazu; i++) {\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}\n\t\t\tmoji=bfr.readLine();\n\t\t\tbubun_nokazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tbbn=moji.split(\" \");\n\t\t\tbubun=new int[bubun_nokazu];\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}\n\n\t\t\tint hidari=0;\n\t\t\tint migi=suretu_kazu;\n\t\t\tint mid=0;\n\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(gacchi);\n\t\t}catch(IOException e) {\n\n\t\t}\n\t}",
"int suretu_kazu=0;",
"suretu_kazu",
"0",
"int[] suretu;",
"suretu",
"int bubun_nokazu=0;",
"bubun_nokazu",
"0",
"int[] bubun;",
"bubun",
"String moji=\"\";",
"moji",
"\"\"",
"String[] srt;",
"srt",
"String[] bbn;",
"bbn",
"int gacchi=0;",
"gacchi",
"0",
"BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));",
"bfr",
"new BufferedReader(new InputStreamReader(System.in))",
"try {\n\t\t\tmoji=bfr.readLine();\n\t\t\tsuretu_kazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tsrt=moji.split(\" \");\n\t\t\tsuretu=new int[suretu_kazu];\n\t\t\tfor(int i=0; i<suretu_kazu; i++) {\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}\n\t\t\tmoji=bfr.readLine();\n\t\t\tbubun_nokazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tbbn=moji.split(\" \");\n\t\t\tbubun=new int[bubun_nokazu];\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}\n\n\t\t\tint hidari=0;\n\t\t\tint migi=suretu_kazu;\n\t\t\tint mid=0;\n\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(gacchi);\n\t\t}catch(IOException e) {\n\n\t\t}",
"catch(IOException e) {\n\n\t\t}",
"IOException e",
"{\n\n\t\t}",
"{\n\t\t\tmoji=bfr.readLine();\n\t\t\tsuretu_kazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tsrt=moji.split(\" \");\n\t\t\tsuretu=new int[suretu_kazu];\n\t\t\tfor(int i=0; i<suretu_kazu; i++) {\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}\n\t\t\tmoji=bfr.readLine();\n\t\t\tbubun_nokazu=Integer.parseInt(moji);\n\t\t\tmoji=bfr.readLine();\n\t\t\tbbn=moji.split(\" \");\n\t\t\tbubun=new int[bubun_nokazu];\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}\n\n\t\t\tint hidari=0;\n\t\t\tint migi=suretu_kazu;\n\t\t\tint mid=0;\n\n\t\t\tfor(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(gacchi);\n\t\t}",
"moji=bfr.readLine()",
"moji",
"bfr.readLine()",
"bfr.readLine",
"bfr",
"suretu_kazu=Integer.parseInt(moji)",
"suretu_kazu",
"Integer.parseInt(moji)",
"Integer.parseInt",
"Integer",
"moji",
"moji=bfr.readLine()",
"moji",
"bfr.readLine()",
"bfr.readLine",
"bfr",
"srt=moji.split(\" \")",
"srt",
"moji.split(\" \")",
"moji.split",
"moji",
"\" \"",
"suretu=new int[suretu_kazu]",
"suretu",
"new int[suretu_kazu]",
"suretu_kazu",
"for(int i=0; i<suretu_kazu; i++) {\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<suretu_kazu",
"i",
"suretu_kazu",
"i++",
"i++",
"i",
"{\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}",
"{\n\t\t\t\tsuretu[i]=Integer.parseInt(srt[i]);\n\t\t\t}",
"suretu[i]=Integer.parseInt(srt[i])",
"suretu[i]",
"suretu",
"i",
"Integer.parseInt(srt[i])",
"Integer.parseInt",
"Integer",
"srt[i]",
"srt",
"i",
"moji=bfr.readLine()",
"moji",
"bfr.readLine()",
"bfr.readLine",
"bfr",
"bubun_nokazu=Integer.parseInt(moji)",
"bubun_nokazu",
"Integer.parseInt(moji)",
"Integer.parseInt",
"Integer",
"moji",
"moji=bfr.readLine()",
"moji",
"bfr.readLine()",
"bfr.readLine",
"bfr",
"bbn=moji.split(\" \")",
"bbn",
"moji.split(\" \")",
"moji.split",
"moji",
"\" \"",
"bubun=new int[bubun_nokazu]",
"bubun",
"new int[bubun_nokazu]",
"bubun_nokazu",
"for(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<bubun_nokazu",
"i",
"bubun_nokazu",
"i++",
"i++",
"i",
"{\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}",
"{\n\t\t\t\tbubun[i]=Integer.parseInt(bbn[i]);\n\t\t\t}",
"bubun[i]=Integer.parseInt(bbn[i])",
"bubun[i]",
"bubun",
"i",
"Integer.parseInt(bbn[i])",
"Integer.parseInt",
"Integer",
"bbn[i]",
"bbn",
"i",
"int hidari=0;",
"hidari",
"0",
"int migi=suretu_kazu;",
"migi",
"suretu_kazu",
"int mid=0;",
"mid",
"0",
"for(int i=0; i<bubun_nokazu; i++) {\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<bubun_nokazu",
"i",
"bubun_nokazu",
"i++",
"i++",
"i",
"{\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\thidari=0;\n\t\t\t\tmigi=suretu_kazu;\n\t\t\t\tmid=0;\n\t\t\t\twhile(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"hidari=0",
"hidari",
"0",
"migi=suretu_kazu",
"migi",
"suretu_kazu",
"mid=0",
"mid",
"0",
"while(hidari<migi) {\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}",
"hidari<migi",
"hidari",
"migi",
"{\n\t\t\t\t\tmid=(hidari+migi)/2;\n\t\t\t\t\tif(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}\n\t\t\t\t}",
"mid=(hidari+migi)/2",
"mid",
"(hidari+migi)/2",
"(hidari+migi)",
"hidari",
"migi",
"2",
"if(suretu[mid]==bubun[i]) {\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}",
"suretu[mid]==bubun[i]",
"suretu[mid]",
"suretu",
"mid",
"bubun[i]",
"bubun",
"i",
"{\t\t//探したい値と探す配列のまん中の数字と一致した時合致\n\t\t\t\t\t\tgacchi++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"gacchi++",
"gacchi",
"break;",
"if(bubun[i]<suretu[mid]) {\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}\n\t\t\t\t\telse {\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}",
"bubun[i]<suretu[mid]",
"bubun[i]",
"bubun",
"i",
"suretu[mid]",
"suretu",
"mid",
"{\t\t//真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中\n\t\t\t\t\t\tmigi=mid;\n\t\t\t\t\t}",
"migi=mid",
"migi",
"mid",
"{\t\t\t\t//中央が探すものより小さい時、一番左を大きくする。\n\t\t\t\t\t\thidari=mid+1;\n\t\t\t\t\t}",
"hidari=mid+1",
"hidari",
"mid+1",
"mid",
"1",
"System.out.println(gacchi)",
"System.out.println",
"System.out",
"System",
"System.out",
"gacchi",
"String[] args",
"args"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
public static void main(String[] args) {
int suretu_kazu=0;
int[] suretu;
int bubun_nokazu=0;
int[] bubun;
String moji="";
String[] srt;
String[] bbn;
int gacchi=0;
BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
try {
moji=bfr.readLine();
suretu_kazu=Integer.parseInt(moji);
moji=bfr.readLine();
srt=moji.split(" ");
suretu=new int[suretu_kazu];
for(int i=0; i<suretu_kazu; i++) {
suretu[i]=Integer.parseInt(srt[i]);
}
moji=bfr.readLine();
bubun_nokazu=Integer.parseInt(moji);
moji=bfr.readLine();
bbn=moji.split(" ");
bubun=new int[bubun_nokazu];
for(int i=0; i<bubun_nokazu; i++) {
bubun[i]=Integer.parseInt(bbn[i]);
}
int hidari=0;
int migi=suretu_kazu;
int mid=0;
for(int i=0; i<bubun_nokazu; i++) {
hidari=0;
migi=suretu_kazu;
mid=0;
while(hidari<migi) {
mid=(hidari+migi)/2;
if(suretu[mid]==bubun[i]) { //探したい値と探す配列のまん中の数字と一致した時合致
gacchi++;
break;
}
else if(bubun[i]<suretu[mid]) { //真ん中の数字と探したい数字の大小 真ん中のほうが大きいときは 右(MAX)が真ん中
migi=mid;
}
else { //中央が探すものより小さい時、一番左を大きくする。
hidari=mid+1;
}
}
}
System.out.println(gacchi);
}catch(IOException e) {
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
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,
41,
13,
4,
18,
13,
0,
18,
13,
13,
13,
14,
2,
4,
13,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
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,
29,
13,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
154,
5
],
[
154,
6
],
[
6,
7
],
[
6,
8
],
[
154,
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
],
[
53,
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
],
[
75,
77
],
[
74,
78
],
[
68,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
81,
84
],
[
80,
85
],
[
79,
86
],
[
86,
87
],
[
11,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
9,
94
],
[
94,
95
],
[
154,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
104,
106
],
[
98,
107
],
[
107,
108
],
[
107,
109
],
[
98,
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
],
[
129,
130
],
[
122,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
98,
147
],
[
147,
148
],
[
96,
149
],
[
149,
150
],
[
96,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int binarySearch(int[] arr, int key) {\n int n = arr.length;\n int left = 0;\n int right = n;\n\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return NOT_FOUND;\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int binarySearch(int[] arr, int key) {\n int n = arr.length;\n int left = 0;\n int right = n;\n\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return NOT_FOUND;\n }\n}",
"Main",
"static int NOT_FOUND = 99999999;",
"NOT_FOUND",
"99999999",
"public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) 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[] sArr = new int[n];",
"sArr",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n sArr[i] = sc.nextInt();\n }",
"{\n sArr[i] = sc.nextInt();\n }",
"sArr[i] = sc.nextInt()",
"sArr[i]",
"sArr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] tArr = new int[q];",
"tArr",
"new int[q]",
"q",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }",
"{\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"tArr[i] = x",
"tArr[i]",
"tArr",
"i",
"x",
"if (binarySearch(sArr, x) != NOT_FOUND) count++;",
"binarySearch(sArr, x) != NOT_FOUND",
"binarySearch(sArr, x)",
"binarySearch",
"sArr",
"x",
"NOT_FOUND",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int binarySearch(int[] arr, int key) {\n int n = arr.length;\n int left = 0;\n int right = n;\n\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return NOT_FOUND;\n }",
"binarySearch",
"{\n int n = arr.length;\n int left = 0;\n int right = n;\n\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return NOT_FOUND;\n }",
"int n = arr.length;",
"n",
"arr.length",
"arr",
"arr.length",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[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 (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"arr[mid] == key",
"arr[mid]",
"arr",
"mid",
"key",
"{\n return mid;\n }",
"return mid;",
"mid",
"if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"key < arr[mid]",
"key",
"arr[mid]",
"arr",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return NOT_FOUND;",
"NOT_FOUND",
"int[] arr",
"arr",
"int key",
"key",
"public class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int binarySearch(int[] arr, int key) {\n int n = arr.length;\n int left = 0;\n int right = n;\n\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return NOT_FOUND;\n }\n}",
"public class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (binarySearch(sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int binarySearch(int[] arr, int key) {\n int n = arr.length;\n int left = 0;\n int right = n;\n\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == key) {\n return mid;\n } else if (key < arr[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return NOT_FOUND;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int NOT_FOUND = 99999999;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] sArr = new int[n];
for (int i = 0; i < n; i++) {
sArr[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] tArr = new int[q];
int count = 0;
for (int i = 0; i < q; i++) {
int x = sc.nextInt();
tArr[i] = x;
if (binarySearch(sArr, x) != NOT_FOUND) count++;
}
System.out.println(count);
}
public static int binarySearch(int[] arr, int key) {
int n = arr.length;
int left = 0;
int right = n;
while (left < right) {
int mid = (left + right) / 2;
if (arr[mid] == key) {
return mid;
} else if (key < arr[mid]) {
right = mid;
} else {
left = mid + 1;
}
}
return NOT_FOUND;
}
}
|
[
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,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
17,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
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
],
[
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
],
[
145,
20
],
[
145,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
23,
28
],
[
28,
29
],
[
23,
30
],
[
30,
31
],
[
23,
32
],
[
32,
33
],
[
23,
34
],
[
34,
35
],
[
34,
36
],
[
23,
37
],
[
37,
38
],
[
37,
39
],
[
23,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
23,
45
],
[
45,
46
],
[
45,
47
],
[
23,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
23,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
23,
74
],
[
74,
75
],
[
74,
76
],
[
23,
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
],
[
23,
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
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
111,
122
],
[
123,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
129,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
132,
135
],
[
23,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
21,
142
],
[
142,
143
],
[
0,
144
],
[
144,
145
],
[
144,
146
]
] | [
"import java.util.*;\nimport java.io.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport static java.lang.Math.*;\n \n \nimport java.util.Scanner;\n \npublic class Main {\n \n public static void main(String[] args) {\n // TODO ?????????????????????????????????????????????\n int i,j,n,q,a;\n a=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n s[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n t[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }\n System.out.println(a);\n }\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.*;",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n \n public static void main(String[] args) {\n // TODO ?????????????????????????????????????????????\n int i,j,n,q,a;\n a=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n s[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n t[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }\n System.out.println(a);\n }\n \n}",
"Main",
"public static void main(String[] args) {\n // TODO ?????????????????????????????????????????????\n int i,j,n,q,a;\n a=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n s[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n t[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }\n System.out.println(a);\n }",
"main",
"{\n // TODO ?????????????????????????????????????????????\n int i,j,n,q,a;\n a=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n s[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n t[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }\n System.out.println(a);\n }",
"int i",
"i",
"j",
"j",
"n",
"n",
"q",
"q",
"a;",
"a",
"a=0",
"a",
"0",
"Scanner scan=new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"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++)\n {\n s[i]=scan.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i]=scan.nextInt();\n }",
"{\n s[i]=scan.nextInt();\n }",
"s[i]=scan.nextInt()",
"s[i]",
"s",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"q=scan.nextInt()",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int t[]=new int [q];",
"t",
"new int [q]",
"q",
"for(j=0;j<q;j++)\n {\n t[j]=scan.nextInt();\n }",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n t[j]=scan.nextInt();\n }",
"{\n t[j]=scan.nextInt();\n }",
"t[j]=scan.nextInt()",
"t[j]",
"t",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(j=0;j<q;j++)\n {\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }",
"{\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }",
"for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }",
"{\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }",
"if(t[j]==s[i])\n {\n a++;\n break;\n }",
"t[j]==s[i]",
"t[j]",
"t",
"j",
"s[i]",
"s",
"i",
"{\n a++;\n break;\n }",
"a++",
"a",
"break;",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"String[] args",
"args",
"public class Main {\n \n public static void main(String[] args) {\n // TODO ?????????????????????????????????????????????\n int i,j,n,q,a;\n a=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n s[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n t[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }\n System.out.println(a);\n }\n \n}",
"public class Main {\n \n public static void main(String[] args) {\n // TODO ?????????????????????????????????????????????\n int i,j,n,q,a;\n a=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n s[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n t[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n for(i=0;i<n;i++)\n {\n if(t[j]==s[i])\n {\n a++;\n break;\n }\n }\n }\n System.out.println(a);\n }\n \n}",
"Main"
] | import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
int i,j,n,q,a;
a=0;
Scanner scan=new Scanner(System.in);
n=scan.nextInt();
int s[]=new int [n];
for(i=0;i<n;i++)
{
s[i]=scan.nextInt();
}
q=scan.nextInt();
int t[]=new int [q];
for(j=0;j<q;j++)
{
t[j]=scan.nextInt();
}
for(j=0;j<q;j++)
{
for(i=0;i<n;i++)
{
if(t[j]==s[i])
{
a++;
break;
}
}
}
System.out.println(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,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
18,
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,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
13,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
40,
17,
23,
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
],
[
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,
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
],
[
8,
68
],
[
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
],
[
86,
87
],
[
86,
88
],
[
86,
89
],
[
89,
90
],
[
89,
91
],
[
85,
92
],
[
92,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
6,
103
],
[
103,
104
],
[
158,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
107,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
128,
134
],
[
134,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
142,
144
],
[
136,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
107,
150
],
[
150,
151
],
[
151,
152
],
[
105,
153
],
[
153,
154
],
[
105,
155
],
[
155,
156
],
[
0,
157
],
[
157,
158
],
[
157,
159
]
] | [
"import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic int binarySearch(int[] A, int x) {\n\t\tint l = 0;\n\t\tint r = A.length;\n\t\twhile(l<r) {\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\n\t\t}\n\t\treturn -1;\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic int binarySearch(int[] A, int x) {\n\t\tint l = 0;\n\t\tint r = A.length;\n\t\twhile(l<r) {\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\n\t\t}\n\t\treturn -1;\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int 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 i=0; i<q; i++) {\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"if(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}",
"binarySearch(S, T[i])!=-1",
"binarySearch(S, T[i])",
"binarySearch",
"S",
"T[i]",
"T",
"i",
"-1",
"1",
"{\n\t\t\t\tans++;\n\t\t\t}",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static int binarySearch(int[] A, int x) {\n\t\tint l = 0;\n\t\tint r = A.length;\n\t\twhile(l<r) {\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\n\t\t}\n\t\treturn -1;\n\t}",
"binarySearch",
"{\n\t\tint l = 0;\n\t\tint r = A.length;\n\t\twhile(l<r) {\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\n\t\t}\n\t\treturn -1;\n\t}",
"int l = 0;",
"l",
"0",
"int r = A.length;",
"r",
"A.length",
"A",
"A.length",
"while(l<r) {\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\n\t\t}",
"l<r",
"l",
"r",
"{\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\n\t\t}",
"int mid = (l+r)/2;",
"mid",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;",
"A[mid] == x",
"A[mid]",
"A",
"mid",
"x",
"return mid;",
"mid",
"if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;",
"x<A[mid]",
"x",
"A[mid]",
"A",
"mid",
"r = mid",
"r",
"mid",
"l = mid+1",
"l",
"mid+1",
"mid",
"1",
"return -1;",
"-1",
"1",
"int[] A",
"A",
"int x",
"x",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic int binarySearch(int[] A, int x) {\n\t\tint l = 0;\n\t\tint r = A.length;\n\t\twhile(l<r) {\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\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 Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tif(binarySearch(S, T[i])!=-1) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic int binarySearch(int[] A, int x) {\n\t\tint l = 0;\n\t\tint r = A.length;\n\t\twhile(l<r) {\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(A[mid] == x) return mid;\n\t\t\telse if(x<A[mid]) r = mid;\n\t\t\telse l = mid+1;\n\t\t}\n\t\treturn -1;\n\t}\n\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
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 ans = 0;
for(int i=0; i<q; i++) {
if(binarySearch(S, T[i])!=-1) {
ans++;
}
}
System.out.println(ans);
}
static int binarySearch(int[] A, int x) {
int l = 0;
int r = A.length;
while(l<r) {
int mid = (l+r)/2;
if(A[mid] == x) return mid;
else if(x<A[mid]) r = mid;
else l = mid+1;
}
return -1;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
14,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
30,
29,
17,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
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,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
4,
18,
13,
13,
17,
2,
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
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
19,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
20,
26
],
[
26,
27
],
[
27,
28
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
14,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
36,
42
],
[
42,
43
],
[
43,
44
],
[
36,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
45,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
53,
56
],
[
53,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
45,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
69,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
69,
76
],
[
14,
77
],
[
77,
78
],
[
12,
79
],
[
79,
80
],
[
12,
81
],
[
81,
82
],
[
12,
83
],
[
83,
84
],
[
12,
85
],
[
85,
86
],
[
10,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
102,
103
],
[
89,
104
],
[
104,
105
],
[
104,
106
],
[
89,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
110,
115
],
[
89,
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
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
136,
138
],
[
89,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
144,
145
],
[
145,
146
],
[
89,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
149,
154
],
[
89,
155
],
[
155,
156
],
[
155,
157
],
[
155,
158
],
[
159,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
161,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
161,
168
],
[
161,
169
],
[
169,
170
],
[
169,
171
],
[
160,
172
],
[
172,
173
],
[
173,
174
],
[
89,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
87,
181
],
[
181,
182
]
] | [
"import java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.BufferedReader;\n\nclass Main {\n\n static boolean binarySearch(int[] a, int key, int begin, int end){ \n if(begin >= end){\n if(a[begin] != key){\n return false;\n }\n }\n\n int med = (begin + end) / 2;\n if (a[med] == key) {\n return true;\n } else if (a[med] > key) {\n return binarySearch(a, key, begin, med - 1);\n } else if (a[med] < key) {\n return binarySearch(a, key, med + 1, end);\n }\n\n return false; // unreachable\n }\n\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int result = 0;\n\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[n];\n String[] inputs = br.readLine().split(\" \");\n for (int i = 0; i < n; i++) {\n S[i] = Integer.parseInt(inputs[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] inputt = br.readLine().split(\" \");\n for (String str : inputt) {\n if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }\n }\n\n System.out.println(result);\n }\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"class Main {\n\n static boolean binarySearch(int[] a, int key, int begin, int end){ \n if(begin >= end){\n if(a[begin] != key){\n return false;\n }\n }\n\n int med = (begin + end) / 2;\n if (a[med] == key) {\n return true;\n } else if (a[med] > key) {\n return binarySearch(a, key, begin, med - 1);\n } else if (a[med] < key) {\n return binarySearch(a, key, med + 1, end);\n }\n\n return false; // unreachable\n }\n\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int result = 0;\n\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[n];\n String[] inputs = br.readLine().split(\" \");\n for (int i = 0; i < n; i++) {\n S[i] = Integer.parseInt(inputs[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] inputt = br.readLine().split(\" \");\n for (String str : inputt) {\n if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }\n }\n\n System.out.println(result);\n }\n}",
"Main",
"static boolean binarySearch(int[] a, int key, int begin, int end){ \n if(begin >= end){\n if(a[begin] != key){\n return false;\n }\n }\n\n int med = (begin + end) / 2;\n if (a[med] == key) {\n return true;\n } else if (a[med] > key) {\n return binarySearch(a, key, begin, med - 1);\n } else if (a[med] < key) {\n return binarySearch(a, key, med + 1, end);\n }\n\n return false; // unreachable\n }",
"binarySearch",
"{ \n if(begin >= end){\n if(a[begin] != key){\n return false;\n }\n }\n\n int med = (begin + end) / 2;\n if (a[med] == key) {\n return true;\n } else if (a[med] > key) {\n return binarySearch(a, key, begin, med - 1);\n } else if (a[med] < key) {\n return binarySearch(a, key, med + 1, end);\n }\n\n return false; // unreachable\n }",
"if(begin >= end){\n if(a[begin] != key){\n return false;\n }\n }",
"begin >= end",
"begin",
"end",
"{\n if(a[begin] != key){\n return false;\n }\n }",
"if(a[begin] != key){\n return false;\n }",
"a[begin] != key",
"a[begin]",
"a",
"begin",
"key",
"{\n return false;\n }",
"return false;",
"false",
"int med = (begin + end) / 2;",
"med",
"(begin + end) / 2",
"(begin + end)",
"begin",
"end",
"2",
"if (a[med] == key) {\n return true;\n } else if (a[med] > key) {\n return binarySearch(a, key, begin, med - 1);\n } else if (a[med] < key) {\n return binarySearch(a, key, med + 1, end);\n }",
"a[med] == key",
"a[med]",
"a",
"med",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if (a[med] > key) {\n return binarySearch(a, key, begin, med - 1);\n } else if (a[med] < key) {\n return binarySearch(a, key, med + 1, end);\n }",
"a[med] > key",
"a[med]",
"a",
"med",
"key",
"{\n return binarySearch(a, key, begin, med - 1);\n }",
"return binarySearch(a, key, begin, med - 1);",
"binarySearch(a, key, begin, med - 1)",
"binarySearch",
"a",
"key",
"begin",
"med - 1",
"med",
"1",
"if (a[med] < key) {\n return binarySearch(a, key, med + 1, end);\n }",
"a[med] < key",
"a[med]",
"a",
"med",
"key",
"{\n return binarySearch(a, key, med + 1, end);\n }",
"return binarySearch(a, key, med + 1, end);",
"binarySearch(a, key, med + 1, end)",
"binarySearch",
"a",
"key",
"med + 1",
"med",
"1",
"end",
"return false; // unreachable",
"false",
"int[] a",
"a",
"int key",
"key",
"int begin",
"begin",
"int end",
"end",
"public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int result = 0;\n\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[n];\n String[] inputs = br.readLine().split(\" \");\n for (int i = 0; i < n; i++) {\n S[i] = Integer.parseInt(inputs[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] inputt = br.readLine().split(\" \");\n for (String str : inputt) {\n if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }\n }\n\n System.out.println(result);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int result = 0;\n\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[n];\n String[] inputs = br.readLine().split(\" \");\n for (int i = 0; i < n; i++) {\n S[i] = Integer.parseInt(inputs[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] inputt = br.readLine().split(\" \");\n for (String str : inputt) {\n if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }\n }\n\n System.out.println(result);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int result = 0;",
"result",
"0",
"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[] inputs = br.readLine().split(\" \");",
"inputs",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < n; i++) {\n S[i] = Integer.parseInt(inputs[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = Integer.parseInt(inputs[i]);\n }",
"{\n S[i] = Integer.parseInt(inputs[i]);\n }",
"S[i] = Integer.parseInt(inputs[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(inputs[i])",
"Integer.parseInt",
"Integer",
"inputs[i]",
"inputs",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] inputt = br.readLine().split(\" \");",
"inputt",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (String str : inputt) {\n if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }\n }",
"String str",
"inputt",
"{\n if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }\n }",
"{\n if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }\n }",
"if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {\n result++;\n }",
"binarySearch(S, Integer.parseInt(str), 0, n - 1)",
"binarySearch",
"S",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"0",
"n - 1",
"n",
"1",
"{\n result++;\n }",
"result++",
"result",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args"
] | import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
class Main {
static boolean binarySearch(int[] a, int key, int begin, int end){
if(begin >= end){
if(a[begin] != key){
return false;
}
}
int med = (begin + end) / 2;
if (a[med] == key) {
return true;
} else if (a[med] > key) {
return binarySearch(a, key, begin, med - 1);
} else if (a[med] < key) {
return binarySearch(a, key, med + 1, end);
}
return false; // unreachable
}
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int result = 0;
int n = Integer.parseInt(br.readLine());
int[] S = new int[n];
String[] inputs = br.readLine().split(" ");
for (int i = 0; i < n; i++) {
S[i] = Integer.parseInt(inputs[i]);
}
int q = Integer.parseInt(br.readLine());
String[] inputt = br.readLine().split(" ");
for (String str : inputt) {
if (binarySearch(S, Integer.parseInt(str), 0, n - 1)) {
result++;
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
0,
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
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
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
],
[
36,
39
],
[
39,
40
],
[
40,
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 in = new Scanner(System.in);\n int n = in.nextInt();\n Set<Integer> s = new HashSet<>(), t = new HashSet<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n n = in.nextInt();\n for (int i = 0; i < n; i++) {\n t.add(in.nextInt());\n }\n s.retainAll(t);\n System.out.println(s.size());\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n Set<Integer> s = new HashSet<>(), t = new HashSet<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n n = in.nextInt();\n for (int i = 0; i < n; i++) {\n t.add(in.nextInt());\n }\n s.retainAll(t);\n System.out.println(s.size());\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n Set<Integer> s = new HashSet<>(), t = new HashSet<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n n = in.nextInt();\n for (int i = 0; i < n; i++) {\n t.add(in.nextInt());\n }\n s.retainAll(t);\n System.out.println(s.size());\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n Set<Integer> s = new HashSet<>(), t = new HashSet<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n n = in.nextInt();\n for (int i = 0; i < n; i++) {\n t.add(in.nextInt());\n }\n s.retainAll(t);\n System.out.println(s.size());\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"Set<Integer> s = new HashSet<>()",
"s",
"new HashSet<>()",
"t = new HashSet<>();",
"t",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s.add(in.nextInt());\n }",
"{\n s.add(in.nextInt());\n }",
"s.add(in.nextInt())",
"s.add",
"s",
"in.nextInt()",
"in.nextInt",
"in",
"n = in.nextInt()",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"for (int i = 0; i < n; i++) {\n t.add(in.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n t.add(in.nextInt());\n }",
"{\n t.add(in.nextInt());\n }",
"t.add(in.nextInt())",
"t.add",
"t",
"in.nextInt()",
"in.nextInt",
"in",
"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 in = new Scanner(System.in);
int n = in.nextInt();
Set<Integer> s = new HashSet<>(), t = new HashSet<>();
for (int i = 0; i < n; i++) {
s.add(in.nextInt());
}
n = in.nextInt();
for (int i = 0; i < n; i++) {
t.add(in.nextInt());
}
s.retainAll(t);
System.out.println(s.size());
}
} |
[
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,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
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
],
[
191,
11
],
[
191,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
14,
77
],
[
77,
78
],
[
77,
79
],
[
14,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
104,
106
],
[
14,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
132,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
147,
149
],
[
142,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
142,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
159,
160
],
[
159,
161
],
[
154,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
154,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
173,
174
],
[
173,
175
],
[
168,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
179,
181
],
[
14,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
182,
187
],
[
12,
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\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br =new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint numberS = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionS = br.readLine().split(\" \");\n\n\t\tint[] S = new int[numberS];\n\n\t\tfor (int i = 0; i < numberS; i++) {\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}\n\n\t\tint numberT = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionT = br.readLine().split(\" \");\n\n\t\tint[] T = new int[numberT];\n\n\t\tfor (int i = 0; i < numberT; i++) {\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}\n\n\t\tint equalCount = 0;\n\t\tfor(int i = 0; i < numberT; i++) {\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(equalCount);\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\tBufferedReader br =new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint numberS = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionS = br.readLine().split(\" \");\n\n\t\tint[] S = new int[numberS];\n\n\t\tfor (int i = 0; i < numberS; i++) {\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}\n\n\t\tint numberT = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionT = br.readLine().split(\" \");\n\n\t\tint[] T = new int[numberT];\n\n\t\tfor (int i = 0; i < numberT; i++) {\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}\n\n\t\tint equalCount = 0;\n\t\tfor(int i = 0; i < numberT; i++) {\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(equalCount);\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 numberS = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionS = br.readLine().split(\" \");\n\n\t\tint[] S = new int[numberS];\n\n\t\tfor (int i = 0; i < numberS; i++) {\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}\n\n\t\tint numberT = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionT = br.readLine().split(\" \");\n\n\t\tint[] T = new int[numberT];\n\n\t\tfor (int i = 0; i < numberT; i++) {\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}\n\n\t\tint equalCount = 0;\n\t\tfor(int i = 0; i < numberT; i++) {\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(equalCount);\n\t}",
"main",
"{\n\t\tBufferedReader br =new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint numberS = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionS = br.readLine().split(\" \");\n\n\t\tint[] S = new int[numberS];\n\n\t\tfor (int i = 0; i < numberS; i++) {\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}\n\n\t\tint numberT = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionT = br.readLine().split(\" \");\n\n\t\tint[] T = new int[numberT];\n\n\t\tfor (int i = 0; i < numberT; i++) {\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}\n\n\t\tint equalCount = 0;\n\t\tfor(int i = 0; i < numberT; i++) {\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(equalCount);\n\t}",
"BufferedReader br =new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int numberS = Integer.parseInt(br.readLine());",
"numberS",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] progressionS = br.readLine().split(\" \");",
"progressionS",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] S = new int[numberS];",
"S",
"new int[numberS]",
"numberS",
"for (int i = 0; i < numberS; i++) {\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numberS",
"i",
"numberS",
"i++",
"i++",
"i",
"{\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}",
"{\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}",
"S[i] = Integer.parseInt(progressionS[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(progressionS[i])",
"Integer.parseInt",
"Integer",
"progressionS[i]",
"progressionS",
"i",
"int numberT = Integer.parseInt(br.readLine());",
"numberT",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] progressionT = br.readLine().split(\" \");",
"progressionT",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] T = new int[numberT];",
"T",
"new int[numberT]",
"numberT",
"for (int i = 0; i < numberT; i++) {\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numberT",
"i",
"numberT",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}",
"{\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}",
"T[i] = Integer.parseInt(progressionT[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(progressionT[i])",
"Integer.parseInt",
"Integer",
"progressionT[i]",
"progressionT",
"i",
"int equalCount = 0;",
"equalCount",
"0",
"for(int i = 0; i < numberT; i++) {\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numberT",
"i",
"numberT",
"i++",
"i++",
"i",
"{\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int start = 0;",
"start",
"0",
"int end = numberS - 1;",
"end",
"numberS - 1",
"numberS",
"1",
"while(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}",
"start <= end",
"start",
"end",
"{\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}",
"int target = start + (end - start) / 2;",
"target",
"start + (end - start) / 2",
"start",
"(end - start) / 2",
"(end - start)",
"end",
"start",
"2",
"if(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}",
"T[i] == S[target]",
"T[i]",
"T",
"i",
"S[target]",
"S",
"target",
"{\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"equalCount++",
"equalCount",
"break;",
"if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}",
"T[i] > S[target]",
"T[i]",
"T",
"i",
"S[target]",
"S",
"target",
"{\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t}",
"start = target + 1",
"start",
"target + 1",
"target",
"1",
"if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}",
"T[i] < S[target]",
"T[i]",
"T",
"i",
"S[target]",
"S",
"target",
"{\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}",
"end = target - 1",
"end",
"target - 1",
"target",
"1",
"System.out.println(equalCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"equalCount",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br =new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint numberS = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionS = br.readLine().split(\" \");\n\n\t\tint[] S = new int[numberS];\n\n\t\tfor (int i = 0; i < numberS; i++) {\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}\n\n\t\tint numberT = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionT = br.readLine().split(\" \");\n\n\t\tint[] T = new int[numberT];\n\n\t\tfor (int i = 0; i < numberT; i++) {\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}\n\n\t\tint equalCount = 0;\n\t\tfor(int i = 0; i < numberT; i++) {\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(equalCount);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br =new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint numberS = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionS = br.readLine().split(\" \");\n\n\t\tint[] S = new int[numberS];\n\n\t\tfor (int i = 0; i < numberS; i++) {\n S[i] = Integer.parseInt(progressionS[i]);\n\t\t}\n\n\t\tint numberT = Integer.parseInt(br.readLine());\n\n\t\tString[] progressionT = br.readLine().split(\" \");\n\n\t\tint[] T = new int[numberT];\n\n\t\tfor (int i = 0; i < numberT; i++) {\n\t\t\tT[i] = Integer.parseInt(progressionT[i]);\n\t\t}\n\n\t\tint equalCount = 0;\n\t\tfor(int i = 0; i < numberT; i++) {\n\n\t\t\tint start = 0;\n\t\t\tint end = numberS - 1;\n\n\t\t\twhile(start <= end) {\n\t\t\t\tint target = start + (end - start) / 2;\n\n\t\t\t\tif(T[i] == S[target]) {\n\t\t\t\t\tequalCount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[i] > S[target]) {\n\t\t\t\t\tstart = target + 1;\n\t\t\t\t} else if(T[i] < S[target]) {\n\t\t\t\t\tend = target - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(equalCount);\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 br =new BufferedReader(new InputStreamReader(System.in));
int numberS = Integer.parseInt(br.readLine());
String[] progressionS = br.readLine().split(" ");
int[] S = new int[numberS];
for (int i = 0; i < numberS; i++) {
S[i] = Integer.parseInt(progressionS[i]);
}
int numberT = Integer.parseInt(br.readLine());
String[] progressionT = br.readLine().split(" ");
int[] T = new int[numberT];
for (int i = 0; i < numberT; i++) {
T[i] = Integer.parseInt(progressionT[i]);
}
int equalCount = 0;
for(int i = 0; i < numberT; i++) {
int start = 0;
int end = numberS - 1;
while(start <= end) {
int target = start + (end - start) / 2;
if(T[i] == S[target]) {
equalCount++;
break;
} else if(T[i] > S[target]) {
start = target + 1;
} else if(T[i] < S[target]) {
end = target - 1;
}
}
}
System.out.println(equalCount);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
13,
17,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
41,
13,
4,
13,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
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,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
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,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
185,
5
],
[
185,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
12,
15
],
[
15,
16
],
[
16,
17
],
[
15,
18
],
[
8,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
8,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
41,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
47,
49
],
[
47,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
73,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
8,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
6,
86
],
[
86,
87
],
[
185,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
109,
115
],
[
115,
116
],
[
116,
117
],
[
109,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
90,
134
],
[
134,
135
],
[
88,
136
],
[
136,
137
],
[
88,
138
],
[
138,
139
],
[
88,
140
],
[
140,
141
],
[
185,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
144,
151
],
[
151,
152
],
[
151,
153
],
[
144,
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
],
[
169,
171
],
[
168,
172
],
[
172,
173
],
[
173,
174
],
[
172,
175
],
[
175,
176
],
[
175,
177
],
[
144,
178
],
[
178,
179
],
[
142,
180
],
[
180,
181
],
[
142,
182
],
[
182,
183
],
[
0,
184
],
[
184,
185
],
[
184,
186
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String SStr = sc.next();\n int q = sc.nextInt();\n String TStr = sc.next();\n\n int[] S = toIntAry(SStr, n);\n int[] T = toIntAry(TStr, q);\n\n int cnt=0;\n for(int i=0; i<q; i++){\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }\n\n System.out.println(cnt);\n\n\t}\n\n\n\n\n\n\tprivate static boolean binarySearch(int[] s, int key, int n) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\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\n\t\treturn false;\n\t}\n\n\n\n\n\n\tprivate static int[] toIntAry(String str, int n) {\n String[] tmp = str.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < n; i++) {\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\n\t\t}\n return A;\n\t}\n\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String SStr = sc.next();\n int q = sc.nextInt();\n String TStr = sc.next();\n\n int[] S = toIntAry(SStr, n);\n int[] T = toIntAry(TStr, q);\n\n int cnt=0;\n for(int i=0; i<q; i++){\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }\n\n System.out.println(cnt);\n\n\t}\n\n\n\n\n\n\tprivate static boolean binarySearch(int[] s, int key, int n) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\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\n\t\treturn false;\n\t}\n\n\n\n\n\n\tprivate static int[] toIntAry(String str, int n) {\n String[] tmp = str.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < n; i++) {\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\n\t\t}\n return A;\n\t}\n\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String SStr = sc.next();\n int q = sc.nextInt();\n String TStr = sc.next();\n\n int[] S = toIntAry(SStr, n);\n int[] T = toIntAry(TStr, q);\n\n int cnt=0;\n for(int i=0; i<q; i++){\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }\n\n System.out.println(cnt);\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String SStr = sc.next();\n int q = sc.nextInt();\n String TStr = sc.next();\n\n int[] S = toIntAry(SStr, n);\n int[] T = toIntAry(TStr, q);\n\n int cnt=0;\n for(int i=0; i<q; i++){\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }\n\n System.out.println(cnt);\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"sc.useDelimiter(System.getProperty(\"line.separator\"))",
"sc.useDelimiter",
"sc",
"System.getProperty(\"line.separator\")",
"System.getProperty",
"System",
"\"line.separator\"",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"String SStr = sc.next();",
"SStr",
"sc.next()",
"sc.next",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"String TStr = sc.next();",
"TStr",
"sc.next()",
"sc.next",
"sc",
"int[] S = toIntAry(SStr, n);",
"S",
"toIntAry(SStr, n)",
"toIntAry",
"SStr",
"n",
"int[] T = toIntAry(TStr, q);",
"T",
"toIntAry(TStr, q)",
"toIntAry",
"TStr",
"q",
"int cnt=0;",
"cnt",
"0",
"for(int i=0; i<q; i++){\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }",
"{\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }",
"int key = T[i];",
"key",
"T[i]",
"T",
"i",
"if(binarySearch(S,key,n))cnt++;",
"binarySearch(S,key,n)",
"binarySearch",
"S",
"key",
"n",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"private static boolean binarySearch(int[] s, int key, int n) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\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\n\t\treturn false;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\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\n\t\treturn false;\n\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid +1;\n\t\t\t}\n\t\t}",
"left<right",
"left",
"right",
"{\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid +1;\n\t\t\t}\n\t\t}",
"int mid = (left+right)/2;",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid +1;\n\t\t\t}",
"s[mid]==key",
"s[mid]",
"s",
"mid",
"key",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if(s[mid] > key){\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\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[] s",
"s",
"int key",
"key",
"int n",
"n",
"private static int[] toIntAry(String str, int n) {\n String[] tmp = str.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < n; i++) {\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\n\t\t}\n return A;\n\t}",
"toIntAry",
"{\n String[] tmp = str.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < n; i++) {\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\n\t\t}\n return A;\n\t}",
"String[] tmp = str.split(\" \");",
"tmp",
"str.split(\" \")",
"str.split",
"str",
"\" \"",
"int[] A = new int[n];",
"A",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\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(tmp[i]);\n\t\t}",
"{\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\n\t\t}",
"A[i] = Integer.parseInt(tmp[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(tmp[i])",
"Integer.parseInt",
"Integer",
"tmp[i]",
"tmp",
"i",
"return A;",
"A",
"String str",
"str",
"int n",
"n",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String SStr = sc.next();\n int q = sc.nextInt();\n String TStr = sc.next();\n\n int[] S = toIntAry(SStr, n);\n int[] T = toIntAry(TStr, q);\n\n int cnt=0;\n for(int i=0; i<q; i++){\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }\n\n System.out.println(cnt);\n\n\t}\n\n\n\n\n\n\tprivate static boolean binarySearch(int[] s, int key, int n) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\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\n\t\treturn false;\n\t}\n\n\n\n\n\n\tprivate static int[] toIntAry(String str, int n) {\n String[] tmp = str.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < n; i++) {\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\n\t\t}\n return A;\n\t}\n\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String SStr = sc.next();\n int q = sc.nextInt();\n String TStr = sc.next();\n\n int[] S = toIntAry(SStr, n);\n int[] T = toIntAry(TStr, q);\n\n int cnt=0;\n for(int i=0; i<q; i++){\n \tint key = T[i];\n \tif(binarySearch(S,key,n))cnt++;\n }\n\n System.out.println(cnt);\n\n\t}\n\n\n\n\n\n\tprivate static boolean binarySearch(int[] s, int key, int n) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(s[mid]==key){\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] > key){\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\n\t\treturn false;\n\t}\n\n\n\n\n\n\tprivate static int[] toIntAry(String str, int n) {\n String[] tmp = str.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < n; i++) {\n\t\t\tA[i] = Integer.parseInt(tmp[i]);\n\t\t}\n return A;\n\t}\n\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
sc.useDelimiter(System.getProperty("line.separator"));
int n = sc.nextInt();
String SStr = sc.next();
int q = sc.nextInt();
String TStr = sc.next();
int[] S = toIntAry(SStr, n);
int[] T = toIntAry(TStr, q);
int cnt=0;
for(int i=0; i<q; i++){
int key = T[i];
if(binarySearch(S,key,n))cnt++;
}
System.out.println(cnt);
}
private static boolean binarySearch(int[] s, int key, int n) {
int left = 0;
int right = n;
while(left<right){
int mid = (left+right)/2;
if(s[mid]==key){
return true;
}else if(s[mid] > key){
right = mid;
}else{
left = mid +1;
}
}
return false;
}
private static int[] toIntAry(String str, int n) {
String[] tmp = str.split(" ");
int[] A = new int[n];
for (int i = 0; i < n; i++) {
A[i] = Integer.parseInt(tmp[i]);
}
return A;
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
17,
30,
14,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
30,
3,
14,
2,
18,
13,
13,
13,
30,
29,
17,
30,
29,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
170,
5
],
[
170,
6
],
[
6,
7
],
[
170,
8
],
[
8,
9
],
[
170,
10
],
[
10,
11
],
[
170,
12
],
[
12,
13
],
[
170,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
16,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
16,
28
],
[
28,
29
],
[
28,
30
],
[
16,
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
],
[
16,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
16,
57
],
[
57,
58
],
[
57,
59
],
[
16,
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
],
[
16,
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
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
100,
101
],
[
101,
102
],
[
16,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
14,
109
],
[
109,
110
],
[
170,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
113,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
129,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
137,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
125,
153
],
[
153,
154
],
[
113,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
155,
161
],
[
161,
162
],
[
162,
163
],
[
155,
164
],
[
164,
165
],
[
165,
166
],
[
111,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static int n;\n\tpublic static int[] S;\n\tpublic static int q;\n\tpublic static int[] T;\n\n\tpublic static void main(String[] args) {\n\n\t\tint t = 0;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(t);\n\t}\n\n\tpublic static boolean binarySearch(int x) {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\twhile (true) {\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (S[l] == x) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static int n;\n\tpublic static int[] S;\n\tpublic static int q;\n\tpublic static int[] T;\n\n\tpublic static void main(String[] args) {\n\n\t\tint t = 0;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(t);\n\t}\n\n\tpublic static boolean binarySearch(int x) {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\twhile (true) {\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (S[l] == x) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n}",
"Main",
"public static int n;",
"n",
"public static int[] S;",
"S",
"public static int q;",
"q",
"public static int[] T;",
"T",
"public static void main(String[] args) {\n\n\t\tint t = 0;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(t);\n\t}",
"main",
"{\n\n\t\tint t = 0;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(t);\n\t}",
"int t = 0;",
"t",
"0",
"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",
"for (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}",
"if (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}",
"binarySearch(T[i])",
"binarySearch",
"T[i]",
"T",
"i",
"{\n\t\t\t\tt++;\n\t\t\t}",
"t++",
"t",
"System.out.println(t)",
"System.out.println",
"System.out",
"System",
"System.out",
"t",
"String[] args",
"args",
"public static boolean binarySearch(int x) {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\twhile (true) {\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (S[l] == x) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"binarySearch",
"{\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\twhile (true) {\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (S[l] == x) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"int l = 0;",
"l",
"0",
"int r = n - 1;",
"r",
"n - 1",
"n",
"1",
"while (true) {\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"true",
"{\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}",
"l < r",
"l",
"r",
"{\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t}",
"int m = (l + r) / 2;",
"m",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}",
"S[m] < x",
"S[m]",
"S",
"m",
"x",
"{\n\t\t\t\t\tl = m + 1;\n\t\t\t\t}",
"l = m + 1",
"l",
"m + 1",
"m",
"1",
"{\n\t\t\t\t\tr = m;\n\t\t\t\t}",
"r = m",
"r",
"m",
"{\n\t\t\t\tbreak;\n\t\t\t}",
"break;",
"if (S[l] == x) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}",
"S[l] == x",
"S[l]",
"S",
"l",
"x",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"{\n\t\t\treturn false;\n\t\t}",
"return false;",
"false",
"int x",
"x",
"public class Main {\n\n\tpublic static int n;\n\tpublic static int[] S;\n\tpublic static int q;\n\tpublic static int[] T;\n\n\tpublic static void main(String[] args) {\n\n\t\tint t = 0;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(t);\n\t}\n\n\tpublic static boolean binarySearch(int x) {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\twhile (true) {\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (S[l] == x) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n}",
"public class Main {\n\n\tpublic static int n;\n\tpublic static int[] S;\n\tpublic static int q;\n\tpublic static int[] T;\n\n\tpublic static void main(String[] args) {\n\n\t\tint t = 0;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(T[i])) {\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(t);\n\t}\n\n\tpublic static boolean binarySearch(int x) {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\twhile (true) {\n\t\t\tif (l < r) {\n\t\t\t\tint m = (l + r) / 2;\n\t\t\t\tif (S[m] < x) {\n\t\t\t\t\tl = m + 1;\n\t\t\t\t} else {\n\t\t\t\t\tr = m;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (S[l] == x) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static int n;
public static int[] S;
public static int q;
public static int[] T;
public static void main(String[] args) {
int t = 0;
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();
}
for (int i = 0; i < q; i++) {
if (binarySearch(T[i])) {
t++;
}
}
System.out.println(t);
}
public static boolean binarySearch(int x) {
int l = 0;
int r = n - 1;
while (true) {
if (l < r) {
int m = (l + r) / 2;
if (S[m] < x) {
l = m + 1;
} else {
r = m;
}
} else {
break;
}
}
if (S[l] == x) {
return true;
} else {
return false;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
17,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
166,
8
],
[
166,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
11,
14
],
[
14,
15
],
[
11,
16
],
[
16,
17
],
[
11,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
11,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
11,
39
],
[
39,
40
],
[
39,
41
],
[
11,
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
],
[
11,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
11,
68
],
[
68,
69
],
[
68,
70
],
[
11,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
72,
83
],
[
84,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
11,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
92,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
104,
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
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
123,
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
],
[
11,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
9,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"import java.util.*;\n//import java.io.*;\n//import static java.util.Arrays.*;\n//import static java.util.Collections.*;\n//import static java.lang.Math.*;\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n int a,b,c,n,i,q,j,k;\n k=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n \ts[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n \tt[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }\n System.out.println(k);\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n int a,b,c,n,i,q,j,k;\n k=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n \ts[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n \tt[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }\n System.out.println(k);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n int a,b,c,n,i,q,j,k;\n k=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n \ts[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n \tt[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }\n System.out.println(k);\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n int a,b,c,n,i,q,j,k;\n k=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n \ts[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n \tt[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }\n System.out.println(k);\n\t}",
"int a",
"a",
"b",
"b",
"c",
"c",
"n",
"n",
"i",
"i",
"q",
"q",
"j",
"j",
"k;",
"k",
"k=0",
"k",
"0",
"Scanner scan=new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"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++)\n {\n \ts[i]=scan.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \ts[i]=scan.nextInt();\n }",
"{\n \ts[i]=scan.nextInt();\n }",
"s[i]=scan.nextInt()",
"s[i]",
"s",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"q=scan.nextInt()",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int t[]=new int [q];",
"t",
"new int [q]",
"q",
"for(j=0;j<q;j++)\n {\n \tt[j]=scan.nextInt();\n }",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n \tt[j]=scan.nextInt();\n }",
"{\n \tt[j]=scan.nextInt();\n }",
"t[j]=scan.nextInt()",
"t[j]",
"t",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(j=0;j<q;j++)\n {\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }",
"{\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }",
"a=0",
"a",
"0",
"b=n",
"b",
"n",
"while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }",
"a<b",
"a",
"b",
"{\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }",
"c=(a+b)/2",
"c",
"(a+b)/2",
"(a+b)",
"a",
"b",
"2",
"if(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}",
"s[c]==t[j]",
"s[c]",
"s",
"c",
"t[j]",
"t",
"j",
"{\n \t\tk++;\n \t\ta=b+1;\n \t}",
"k++",
"k",
"a=b+1",
"a",
"b+1",
"b",
"1",
"if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}",
"s[c]>t[j]",
"s[c]",
"s",
"c",
"t[j]",
"t",
"j",
"{\n \t\tb=c;\n \t}",
"b=c",
"b",
"c",
"{\n \t\ta=c+1;\n \t}",
"a=c+1",
"a",
"c+1",
"c",
"1",
"System.out.println(k)",
"System.out.println",
"System.out",
"System",
"System.out",
"k",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n int a,b,c,n,i,q,j,k;\n k=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n \ts[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n \tt[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }\n System.out.println(k);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n int a,b,c,n,i,q,j,k;\n k=0;\n Scanner scan=new Scanner(System.in);\n n=scan.nextInt();\n int s[]=new int [n];\n for(i=0;i<n;i++)\n {\n \ts[i]=scan.nextInt();\n }\n q=scan.nextInt();\n int t[]=new int [q];\n for(j=0;j<q;j++)\n {\n \tt[j]=scan.nextInt();\n }\n for(j=0;j<q;j++)\n {\n a=0;\n b=n;\n while(a<b)\n {\n \tc=(a+b)/2;\n \tif(s[c]==t[j])\n \t{\n \t\tk++;\n \t\ta=b+1;\n \t}\n \telse if(s[c]>t[j])\n \t{\n \t\tb=c;\n \t}\n \telse\n \t{\n \t\ta=c+1;\n \t}\n }\n }\n System.out.println(k);\n\t}\n\n}",
"Main"
] | import java.util.*;
//import java.io.*;
//import static java.util.Arrays.*;
//import static java.util.Collections.*;
//import static java.lang.Math.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
int a,b,c,n,i,q,j,k;
k=0;
Scanner scan=new Scanner(System.in);
n=scan.nextInt();
int s[]=new int [n];
for(i=0;i<n;i++)
{
s[i]=scan.nextInt();
}
q=scan.nextInt();
int t[]=new int [q];
for(j=0;j<q;j++)
{
t[j]=scan.nextInt();
}
for(j=0;j<q;j++)
{
a=0;
b=n;
while(a<b)
{
c=(a+b)/2;
if(s[c]==t[j])
{
k++;
a=b+1;
}
else if(s[c]>t[j])
{
b=c;
}
else
{
a=c+1;
}
}
}
System.out.println(k);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
2,
13,
13,
2,
13,
13,
30,
29,
40,
17,
14,
2,
2,
18,
13,
13,
13,
2,
18,
13,
13,
13,
30,
29,
40,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
4,
13,
13,
13,
13,
13,
30,
29,
4,
13,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
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,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
17,
2,
13,
17,
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
],
[
210,
5
],
[
210,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
8,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
16,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
16,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
30,
34
],
[
29,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
39
],
[
28,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
28,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
44,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
53,
59
],
[
59,
60
],
[
60,
61
],
[
53,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
62,
68
],
[
68,
69
],
[
69,
70
],
[
62,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
79,
82
],
[
79,
83
],
[
79,
84
],
[
71,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
87,
90
],
[
87,
91
],
[
87,
92
],
[
6,
93
],
[
93,
94
],
[
6,
95
],
[
95,
96
],
[
6,
97
],
[
97,
98
],
[
6,
99
],
[
99,
100
],
[
210,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
103,
109
],
[
109,
110
],
[
103,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
103,
116
],
[
116,
117
],
[
116,
118
],
[
103,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
120,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
138,
139
],
[
103,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
103,
145
],
[
145,
146
],
[
145,
147
],
[
103,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
149,
157
],
[
157,
158
],
[
158,
159
],
[
149,
160
],
[
161,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
167,
168
],
[
103,
169
],
[
169,
170
],
[
169,
171
],
[
103,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
172,
177
],
[
177,
178
],
[
177,
179
],
[
172,
180
],
[
180,
181
],
[
181,
182
],
[
172,
183
],
[
184,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
187,
190
],
[
190,
191
],
[
190,
192
],
[
187,
193
],
[
187,
194
],
[
194,
195
],
[
194,
196
],
[
186,
197
],
[
185,
198
],
[
198,
199
],
[
199,
200
],
[
103,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
201,
206
],
[
101,
207
],
[
207,
208
],
[
0,
209
],
[
209,
210
],
[
209,
211
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static int search(int l, int r,int[] S, int target){\n int mid = (l+r)/2;\n if(mid == l || mid == r){\n return -1;\n }\n else if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }\n }\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int S[];\n int T[];\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 T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n int num = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }\n System.out.println(num);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static int search(int l, int r,int[] S, int target){\n int mid = (l+r)/2;\n if(mid == l || mid == r){\n return -1;\n }\n else if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }\n }\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int S[];\n int T[];\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 T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n int num = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }\n System.out.println(num);\n }\n}",
"Main",
"public static int search(int l, int r,int[] S, int target){\n int mid = (l+r)/2;\n if(mid == l || mid == r){\n return -1;\n }\n else if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }\n }",
"search",
"{\n int mid = (l+r)/2;\n if(mid == l || mid == r){\n return -1;\n }\n else if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }\n }",
"int mid = (l+r)/2;",
"mid",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(mid == l || mid == r){\n return -1;\n }\n else if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }",
"mid == l || mid == r",
"mid == l",
"mid",
"l",
"mid == r",
"mid",
"r",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }",
"S[r] < target || S[l] > target",
"S[r] < target",
"S[r]",
"S",
"r",
"target",
"S[l] > target",
"S[l]",
"S",
"l",
"target",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }",
"S[mid] == target",
"S[mid]",
"S",
"mid",
"target",
"{\n return 1;\n }",
"return 1;",
"1",
"if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }",
"S[r] == target",
"S[r]",
"S",
"r",
"target",
"{\n return 1;\n }",
"return 1;",
"1",
"if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }",
"S[l] == target",
"S[l]",
"S",
"l",
"target",
"{\n return 1;\n }",
"return 1;",
"1",
"if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }",
"S[mid] < target",
"S[mid]",
"S",
"mid",
"target",
"{\n return search(mid, r, S, target);\n }",
"return search(mid, r, S, target);",
"search(mid, r, S, target)",
"search",
"mid",
"r",
"S",
"target",
"{\n return search(l, mid, S, target);\n }",
"return search(l, mid, S, target);",
"search(l, mid, S, target)",
"search",
"l",
"mid",
"S",
"target",
"int l",
"l",
"int r",
"r",
"int[] S",
"S",
"int target",
"target",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int S[];\n int T[];\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 T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n int num = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }\n System.out.println(num);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int S[];\n int T[];\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 T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n int num = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }\n System.out.println(num);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int S[];",
"S",
"int T[];",
"T",
"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",
"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 num = 0;",
"num",
"0",
"for(int i = 0; i < q; i++){\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }",
"{\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }",
"if(search(0, n-1, S, T[i]) == 1){\n num++;\n }",
"search(0, n-1, S, T[i]) == 1",
"search(0, n-1, S, T[i])",
"search",
"0",
"n-1",
"n",
"1",
"S",
"T[i]",
"T",
"i",
"1",
"{\n num++;\n }",
"num++",
"num",
"System.out.println(num)",
"System.out.println",
"System.out",
"System",
"System.out",
"num",
"String[] args",
"args",
"public class Main {\n public static int search(int l, int r,int[] S, int target){\n int mid = (l+r)/2;\n if(mid == l || mid == r){\n return -1;\n }\n else if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }\n }\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int S[];\n int T[];\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 T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n int num = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }\n System.out.println(num);\n }\n}",
"public class Main {\n public static int search(int l, int r,int[] S, int target){\n int mid = (l+r)/2;\n if(mid == l || mid == r){\n return -1;\n }\n else if(S[r] < target || S[l] > target){\n return -1;\n }\n else if(S[mid] == target){\n return 1;\n }\n else if(S[r] == target){\n return 1;\n }\n else if(S[l] == target){\n return 1;\n }\n else if(S[mid] < target){\n return search(mid, r, S, target);\n }\n else{\n return search(l, mid, S, target);\n }\n }\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int S[];\n int T[];\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 T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n int num = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n-1, S, T[i]) == 1){\n num++;\n }\n }\n System.out.println(num);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static int search(int l, int r,int[] S, int target){
int mid = (l+r)/2;
if(mid == l || mid == r){
return -1;
}
else if(S[r] < target || S[l] > target){
return -1;
}
else if(S[mid] == target){
return 1;
}
else if(S[r] == target){
return 1;
}
else if(S[l] == target){
return 1;
}
else if(S[mid] < target){
return search(mid, r, S, target);
}
else{
return search(l, mid, S, target);
}
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int S[];
int T[];
int n = sc.nextInt();
S = new int[n];
for(int i = 0; i < n; i ++){
S[i] = sc.nextInt();
}
int q = sc.nextInt();
T = new int[q];
for(int i = 0; i < q; i++){
T[i] = sc.nextInt();
}
int num = 0;
for(int i = 0; i < q; i++){
if(search(0, n-1, S, T[i]) == 1){
num++;
}
}
System.out.println(num);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
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,
4,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
42,
40,
4,
13,
30,
0,
13,
20,
12,
13,
30,
29,
2,
2,
13,
17,
4,
18,
13,
12,
13,
30,
4,
13,
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,
4,
18,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
181,
35
],
[
181,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
38,
47
],
[
47,
48
],
[
47,
49
],
[
38,
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
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
38,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
38,
74
],
[
74,
75
],
[
74,
76
],
[
38,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
95,
100
],
[
100,
101
],
[
101,
102
],
[
38,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
36,
109
],
[
109,
110
],
[
181,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
111,
115
],
[
115,
116
],
[
111,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
123,
124
],
[
111,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
128,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
111,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
111,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
111,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
163,
164
],
[
111,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
172,
173
],
[
111,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
0,
180
],
[
180,
181
],
[
180,
182
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Set;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tfinal int n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tfinal int q = sc.nextInt();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static class Scanner {\n\t private BufferedReader br;\n\t private StringTokenizer tok;\n\n\t public Scanner(InputStream is) throws IOException {\n\t br = new BufferedReader(new InputStreamReader(is));\n\t }\n\n\t private void getLine() throws IOException {\n\t while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }\n\t }\n\n\t private boolean hasNext() {\n\t return tok != null && tok.hasMoreTokens();\n\t }\n\n\t public String next() throws IOException {\n\t getLine(); return tok.nextToken();\n\t }\n\n\t public int nextInt() throws IOException {\n\t return Integer.parseInt(next());\n\t }\n\t \n\t public long nextLong() throws IOException {\n\t \treturn Long.parseLong(next());\n\t }\n\t \n\t public void close() throws IOException {\n\t br.close();\n\t }\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.HashMap;",
"HashMap",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.LinkedList;",
"LinkedList",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"import java.util.TreeMap;",
"TreeMap",
"java.util",
"import java.util.TreeSet;",
"TreeSet",
"java.util",
"public class Main {\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tfinal int n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tfinal int q = sc.nextInt();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static class Scanner {\n\t private BufferedReader br;\n\t private StringTokenizer tok;\n\n\t public Scanner(InputStream is) throws IOException {\n\t br = new BufferedReader(new InputStreamReader(is));\n\t }\n\n\t private void getLine() throws IOException {\n\t while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }\n\t }\n\n\t private boolean hasNext() {\n\t return tok != null && tok.hasMoreTokens();\n\t }\n\n\t public String next() throws IOException {\n\t getLine(); return tok.nextToken();\n\t }\n\n\t public int nextInt() throws IOException {\n\t return Integer.parseInt(next());\n\t }\n\t \n\t public long nextLong() throws IOException {\n\t \treturn Long.parseLong(next());\n\t }\n\t \n\t public void close() throws IOException {\n\t br.close();\n\t }\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tfinal int n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tfinal int q = sc.nextInt();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tfinal int n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tfinal int q = sc.nextInt();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"final int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Set<Integer> T = new TreeSet<Integer>();",
"T",
"new TreeSet<Integer>()",
"for(int i = 0; i < n; i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tT.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tT.add(sc.nextInt());\n\t\t}",
"T.add(sc.nextInt())",
"T.add",
"T",
"sc.nextInt()",
"sc.nextInt",
"sc",
"final int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++){\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\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\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"final int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}",
"T.contains(t)",
"T.contains",
"T",
"t",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static class Scanner {\n\t private BufferedReader br;\n\t private StringTokenizer tok;\n\n\t public Scanner(InputStream is) throws IOException {\n\t br = new BufferedReader(new InputStreamReader(is));\n\t }\n\n\t private void getLine() throws IOException {\n\t while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }\n\t }\n\n\t private boolean hasNext() {\n\t return tok != null && tok.hasMoreTokens();\n\t }\n\n\t public String next() throws IOException {\n\t getLine(); return tok.nextToken();\n\t }\n\n\t public int nextInt() throws IOException {\n\t return Integer.parseInt(next());\n\t }\n\t \n\t public long nextLong() throws IOException {\n\t \treturn Long.parseLong(next());\n\t }\n\t \n\t public void close() throws IOException {\n\t br.close();\n\t }\n\t}",
"Scanner",
"private BufferedReader br;",
"br",
"private StringTokenizer tok;",
"tok",
"public Scanner(InputStream is) throws IOException {\n\t br = new BufferedReader(new InputStreamReader(is));\n\t }",
"Scanner",
"{\n\t br = new BufferedReader(new InputStreamReader(is));\n\t }",
"br = new BufferedReader(new InputStreamReader(is))",
"br",
"new BufferedReader(new InputStreamReader(is))",
"InputStream is",
"is",
"private void getLine() throws IOException {\n\t while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }\n\t }",
"getLine",
"{\n\t while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }\n\t }",
"while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }",
"!hasNext()",
"hasNext()",
"hasNext",
"{ tok = new StringTokenizer(br.readLine()); }",
"tok = new StringTokenizer(br.readLine())",
"tok",
"new StringTokenizer(br.readLine())",
"private boolean hasNext() {\n\t return tok != null && tok.hasMoreTokens();\n\t }",
"hasNext",
"{\n\t return tok != null && tok.hasMoreTokens();\n\t }",
"return tok != null && tok.hasMoreTokens();",
"tok != null && tok.hasMoreTokens()",
"tok != null",
"tok",
"null",
"tok.hasMoreTokens()",
"tok.hasMoreTokens",
"tok",
"public String next() throws IOException {\n\t getLine(); return tok.nextToken();\n\t }",
"next",
"{\n\t getLine(); return tok.nextToken();\n\t }",
"getLine()",
"getLine",
"return tok.nextToken();",
"tok.nextToken()",
"tok.nextToken",
"tok",
"public int nextInt() throws IOException {\n\t return Integer.parseInt(next());\n\t }",
"nextInt",
"{\n\t return Integer.parseInt(next());\n\t }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong() throws IOException {\n\t \treturn Long.parseLong(next());\n\t }",
"nextLong",
"{\n\t \treturn Long.parseLong(next());\n\t }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public void close() throws IOException {\n\t br.close();\n\t }",
"close",
"{\n\t br.close();\n\t }",
"br.close()",
"br.close",
"br",
"public class Main {\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tfinal int n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tfinal int q = sc.nextInt();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static class Scanner {\n\t private BufferedReader br;\n\t private StringTokenizer tok;\n\n\t public Scanner(InputStream is) throws IOException {\n\t br = new BufferedReader(new InputStreamReader(is));\n\t }\n\n\t private void getLine() throws IOException {\n\t while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }\n\t }\n\n\t private boolean hasNext() {\n\t return tok != null && tok.hasMoreTokens();\n\t }\n\n\t public String next() throws IOException {\n\t getLine(); return tok.nextToken();\n\t }\n\n\t public int nextInt() throws IOException {\n\t return Integer.parseInt(next());\n\t }\n\t \n\t public long nextLong() throws IOException {\n\t \treturn Long.parseLong(next());\n\t }\n\t \n\t public void close() throws IOException {\n\t br.close();\n\t }\n\t}\n\n}",
"public class Main {\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tfinal int n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tfinal int q = sc.nextInt();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tfinal int t = sc.nextInt();\n\t\t\t\n\t\t\tif(T.contains(t)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static class Scanner {\n\t private BufferedReader br;\n\t private StringTokenizer tok;\n\n\t public Scanner(InputStream is) throws IOException {\n\t br = new BufferedReader(new InputStreamReader(is));\n\t }\n\n\t private void getLine() throws IOException {\n\t while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }\n\t }\n\n\t private boolean hasNext() {\n\t return tok != null && tok.hasMoreTokens();\n\t }\n\n\t public String next() throws IOException {\n\t getLine(); return tok.nextToken();\n\t }\n\n\t public int nextInt() throws IOException {\n\t return Integer.parseInt(next());\n\t }\n\t \n\t public long nextLong() throws IOException {\n\t \treturn Long.parseLong(next());\n\t }\n\t \n\t public void close() throws IOException {\n\t br.close();\n\t }\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
final int n = sc.nextInt();
Set<Integer> T = new TreeSet<Integer>();
for(int i = 0; i < n; i++){
T.add(sc.nextInt());
}
final int q = sc.nextInt();
int count = 0;
for(int i = 0; i < q; i++){
final int t = sc.nextInt();
if(T.contains(t)){
count++;
}
}
System.out.println(count);
}
public static class Scanner {
private BufferedReader br;
private StringTokenizer tok;
public Scanner(InputStream is) throws IOException {
br = new BufferedReader(new InputStreamReader(is));
}
private void getLine() throws IOException {
while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
}
private boolean hasNext() {
return tok != null && tok.hasMoreTokens();
}
public String next() throws IOException {
getLine(); return tok.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public void close() throws IOException {
br.close();
}
}
} |
[
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,
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,
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,
0,
13,
4,
13,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
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
],
[
187,
8
],
[
187,
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
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
27,
32
],
[
11,
33
],
[
33,
34
],
[
33,
35
],
[
11,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
57,
59
],
[
11,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
65,
66
],
[
66,
67
],
[
11,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
70,
75
],
[
11,
76
],
[
76,
77
],
[
76,
78
],
[
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
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
11,
103
],
[
103,
104
],
[
103,
105
],
[
11,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
106,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
11,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
9,
133
],
[
133,
134
],
[
187,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
137,
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
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
164,
165
],
[
158,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
169,
171
],
[
166,
172
],
[
172,
173
],
[
172,
174
],
[
166,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
137,
180
],
[
180,
181
],
[
135,
182
],
[
182,
183
],
[
135,
184
],
[
184,
185
],
[
0,
186
],
[
186,
187
],
[
186,
188
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br =\n\t\t\t\tnew BufferedReader( new InputStreamReader(System.in) );\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] temp;\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic int binarySearch(int Ti, int[] S) {\n\t\tint l = 0;\n\t\tint r = S.length;\n\t\twhile (l < r) {\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}\n\t\treturn 0;\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br =\n\t\t\t\tnew BufferedReader( new InputStreamReader(System.in) );\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] temp;\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic int binarySearch(int Ti, int[] S) {\n\t\tint l = 0;\n\t\tint r = S.length;\n\t\twhile (l < r) {\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}\n\t\treturn 0;\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br =\n\t\t\t\tnew BufferedReader( new InputStreamReader(System.in) );\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] temp;\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br =\n\t\t\t\tnew BufferedReader( new InputStreamReader(System.in) );\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] temp;\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader br =\n\t\t\t\tnew 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[] temp;",
"temp",
"temp = br.readLine().split(\" \")",
"temp",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i=0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(temp[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(temp[i]);\n\t\t}",
"{\n\t\t\tS[i] = Integer.parseInt(temp[i]);\n\t\t}",
"S[i] = Integer.parseInt(temp[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(temp[i])",
"Integer.parseInt",
"Integer",
"temp[i]",
"temp",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"temp = br.readLine().split(\" \")",
"temp",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i=0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}",
"{\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}",
"T[i] = Integer.parseInt(temp[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(temp[i])",
"Integer.parseInt",
"Integer",
"temp[i]",
"temp",
"i",
"int count = 0;",
"count",
"0",
"for (int i=0; i < q; i++) {\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}",
"{\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}",
"count += binarySearch(T[i], S)",
"count",
"binarySearch(T[i], S)",
"binarySearch",
"T[i]",
"T",
"i",
"S",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static int binarySearch(int Ti, int[] S) {\n\t\tint l = 0;\n\t\tint r = S.length;\n\t\twhile (l < r) {\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}\n\t\treturn 0;\n\t}",
"binarySearch",
"{\n\t\tint l = 0;\n\t\tint r = S.length;\n\t\twhile (l < r) {\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}\n\t\treturn 0;\n\t}",
"int l = 0;",
"l",
"0",
"int r = S.length;",
"r",
"S.length",
"S",
"S.length",
"while (l < r) {\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}",
"l < r",
"l",
"r",
"{\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}",
"int m = (l + r) / 2;",
"m",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;",
"Ti == S[m]",
"Ti",
"S[m]",
"S",
"m",
"return 1;",
"1",
"if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;",
"Ti < S[m]",
"Ti",
"S[m]",
"S",
"m",
"r = m",
"r",
"m",
"l = m+1",
"l",
"m+1",
"m",
"1",
"return 0;",
"0",
"int Ti",
"Ti",
"int[] S",
"S",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br =\n\t\t\t\tnew BufferedReader( new InputStreamReader(System.in) );\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] temp;\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic int binarySearch(int Ti, int[] S) {\n\t\tint l = 0;\n\t\tint r = S.length;\n\t\twhile (l < r) {\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}\n\t\treturn 0;\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br =\n\t\t\t\tnew BufferedReader( new InputStreamReader(System.in) );\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] temp;\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\ttemp = br.readLine().split(\" \");\n\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i < q; i++) {\n\t\t\tcount += binarySearch(T[i], S);\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic int binarySearch(int Ti, int[] S) {\n\t\tint l = 0;\n\t\tint r = S.length;\n\t\twhile (l < r) {\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (Ti == S[m]) return 1;\n\t\t\telse if (Ti < S[m]) r = m;\n\t\t\telse l = m+1;\n\t\t}\n\t\treturn 0;\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
// TODO ?????????????????????????????????????????????
BufferedReader br =
new BufferedReader( new InputStreamReader(System.in) );
int n = Integer.parseInt(br.readLine());
String[] temp;
temp = br.readLine().split(" ");
int[] S = new int[n];
for (int i=0; i < n; i++) {
S[i] = Integer.parseInt(temp[i]);
}
int q = Integer.parseInt(br.readLine());
temp = br.readLine().split(" ");
int[] T = new int[q];
for (int i=0; i < q; i++) {
T[i] = Integer.parseInt(temp[i]);
}
int count = 0;
for (int i=0; i < q; i++) {
count += binarySearch(T[i], S);
}
System.out.println(count);
}
static int binarySearch(int Ti, int[] S) {
int l = 0;
int r = S.length;
while (l < r) {
int m = (l + r) / 2;
if (Ti == S[m]) return 1;
else if (Ti < S[m]) r = m;
else l = m+1;
}
return 0;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
4,
13,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
4,
18,
13,
40,
17,
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,
13,
30,
14,
2,
18,
13,
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
],
[
149,
5
],
[
149,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
6,
17
],
[
17,
18
],
[
149,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
21,
27
],
[
27,
28
],
[
27,
29
],
[
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
],
[
21,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
21,
56
],
[
56,
57
],
[
56,
58
],
[
21,
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
],
[
74,
76
],
[
74,
77
],
[
77,
78
],
[
78,
79
],
[
73,
80
],
[
80,
81
],
[
72,
82
],
[
82,
83
],
[
21,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
19,
90
],
[
90,
91
],
[
149,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
115,
121
],
[
121,
122
],
[
122,
123
],
[
115,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
125,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
94,
141
],
[
141,
142
],
[
142,
143
],
[
92,
144
],
[
144,
145
],
[
92,
146
],
[
146,
147
],
[
0,
148
],
[
148,
149
],
[
148,
150
]
] | [
"\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n solve(sc);\n }\n }\n\n static void solve(Scanner sc) {\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int sum = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }\n\n System.out.println(sum);\n }\n\n static int binarySearch(int[] arr, int target) {\n // 探索範囲\n int begin = 0;\n int end = arr.length;\n\n while (begin < end) {\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }\n return -1;\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n solve(sc);\n }\n }\n\n static void solve(Scanner sc) {\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int sum = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }\n\n System.out.println(sum);\n }\n\n static int binarySearch(int[] arr, int target) {\n // 探索範囲\n int begin = 0;\n int end = arr.length;\n\n while (begin < end) {\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }\n return -1;\n }\n}",
"Main",
"public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n solve(sc);\n }\n }",
"main",
"{\n try (Scanner sc = new Scanner(System.in)) {\n solve(sc);\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n solve(sc);\n }",
"{\n solve(sc);\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"solve(sc)",
"solve",
"sc",
"String[] args",
"args",
"static void solve(Scanner sc) {\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int sum = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }\n\n System.out.println(sum);\n }",
"solve",
"{\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int sum = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }\n\n System.out.println(sum);\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 sum = 0;",
"sum",
"0",
"for (int i = 0; i < q; i++) {\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }",
"{\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }",
"if (binarySearch(S, sc.nextInt()) != -1)\n sum++;",
"binarySearch(S, sc.nextInt()) != -1",
"binarySearch(S, sc.nextInt())",
"binarySearch",
"S",
"sc.nextInt()",
"sc.nextInt",
"sc",
"-1",
"1",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"Scanner sc",
"sc",
"static int binarySearch(int[] arr, int target) {\n // 探索範囲\n int begin = 0;\n int end = arr.length;\n\n while (begin < end) {\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }\n return -1;\n }",
"binarySearch",
"{\n // 探索範囲\n int begin = 0;\n int end = arr.length;\n\n while (begin < end) {\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }\n return -1;\n }",
"int begin = 0;",
"begin",
"0",
"int end = arr.length;",
"end",
"arr.length",
"arr",
"arr.length",
"while (begin < end) {\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }",
"begin < end",
"begin",
"end",
"{\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }",
"int center = (begin + end) / 2;",
"center",
"(begin + end) / 2",
"(begin + end)",
"begin",
"end",
"2",
"if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }",
"arr[center] == target",
"arr[center]",
"arr",
"center",
"target",
"{\n return center;\n }",
"return center;",
"center",
"{\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }",
"if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }",
"arr[center] > target",
"arr[center]",
"arr",
"center",
"target",
"{\n end = center;// 前を探す\n }",
"end = center",
"end",
"center",
"{\n begin = center + 1;// 後ろを探す\n }",
"begin = center + 1",
"begin",
"center + 1",
"center",
"1",
"return -1;",
"-1",
"1",
"int[] arr",
"arr",
"int target",
"target",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n solve(sc);\n }\n }\n\n static void solve(Scanner sc) {\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int sum = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }\n\n System.out.println(sum);\n }\n\n static int binarySearch(int[] arr, int target) {\n // 探索範囲\n int begin = 0;\n int end = arr.length;\n\n while (begin < end) {\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }\n return -1;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n solve(sc);\n }\n }\n\n static void solve(Scanner sc) {\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int sum = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, sc.nextInt()) != -1)\n sum++;\n }\n\n System.out.println(sum);\n }\n\n static int binarySearch(int[] arr, int target) {\n // 探索範囲\n int begin = 0;\n int end = arr.length;\n\n while (begin < end) {\n int center = (begin + end) / 2;\n if (arr[center] == target) {\n return center;\n } else {\n if (arr[center] > target) {\n end = center;// 前を探す\n } else {\n begin = center + 1;// 後ろを探す\n }\n }\n }\n return -1;\n }\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
solve(sc);
}
}
static void solve(Scanner sc) {
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 sum = 0;
for (int i = 0; i < q; i++) {
if (binarySearch(S, sc.nextInt()) != -1)
sum++;
}
System.out.println(sum);
}
static int binarySearch(int[] arr, int target) {
// 探索範囲
int begin = 0;
int end = arr.length;
while (begin < end) {
int center = (begin + end) / 2;
if (arr[center] == target) {
return center;
} else {
if (arr[center] > target) {
end = center;// 前を探す
} else {
begin = center + 1;// 後ろを探す
}
}
}
return -1;
}
}
|
[
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,
18,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
18,
13,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
14,
2,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
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
],
[
200,
11
],
[
200,
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
],
[
114,
115
],
[
114,
116
],
[
107,
117
],
[
117,
118
],
[
118,
119
],
[
107,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
122,
129
],
[
129,
130
],
[
130,
131
],
[
14,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
12,
138
],
[
138,
139
],
[
200,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
142,
151
],
[
151,
152
],
[
142,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
157,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
165,
171
],
[
171,
172
],
[
171,
173
],
[
157,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
174,
180
],
[
180,
181
],
[
157,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
185,
187
],
[
182,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
190,
192
],
[
142,
193
],
[
193,
194
],
[
140,
195
],
[
195,
196
],
[
140,
197
],
[
197,
198
],
[
0,
199
],
[
199,
200
],
[
199,
201
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] s = br.readLine().split(\" \");\n int[] S = new int[n];\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(s[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] t = br.readLine().split(\" \");\n int[] T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(t[i]);\n }\n\n int ans = 0;\n\n //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§) \n for(int i = 0; i < T.length; i++){\n if(binarySearch(T[i], S)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n\n public static boolean binarySearch(int key, int[] target){\n int left = 0;\n int right = target.length;\n int middle;\n\n while(left < right){\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }\n return false;\n }\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"public class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] s = br.readLine().split(\" \");\n int[] S = new int[n];\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(s[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] t = br.readLine().split(\" \");\n int[] T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(t[i]);\n }\n\n int ans = 0;\n\n //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§) \n for(int i = 0; i < T.length; i++){\n if(binarySearch(T[i], S)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n\n public static boolean binarySearch(int key, int[] target){\n int left = 0;\n int right = target.length;\n int middle;\n\n while(left < right){\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }\n return false;\n }\n\n}",
"Main",
"public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] s = br.readLine().split(\" \");\n int[] S = new int[n];\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(s[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] t = br.readLine().split(\" \");\n int[] T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(t[i]);\n }\n\n int ans = 0;\n\n //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§) \n for(int i = 0; i < T.length; i++){\n if(binarySearch(T[i], S)){\n ans++;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] s = br.readLine().split(\" \");\n int[] S = new int[n];\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(s[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] t = br.readLine().split(\" \");\n int[] T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(t[i]);\n }\n\n int ans = 0;\n\n //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§) \n for(int i = 0; i < T.length; i++){\n if(binarySearch(T[i], S)){\n ans++;\n }\n }\n System.out.println(ans);\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[] s = br.readLine().split(\" \");",
"s",
"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(s[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = Integer.parseInt(s[i]);\n }",
"{\n S[i] = Integer.parseInt(s[i]);\n }",
"S[i] = Integer.parseInt(s[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(s[i])",
"Integer.parseInt",
"Integer",
"s[i]",
"s",
"i",
"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[] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(t[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = Integer.parseInt(t[i]);\n }",
"{\n T[i] = Integer.parseInt(t[i]);\n }",
"T[i] = Integer.parseInt(t[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(t[i])",
"Integer.parseInt",
"Integer",
"t[i]",
"t",
"i",
"int ans = 0;",
"ans",
"0",
"for(int i = 0; i < T.length; i++){\n if(binarySearch(T[i], S)){\n ans++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.length",
"i",
"T.length",
"T",
"T.length",
"i++",
"i++",
"i",
"{\n if(binarySearch(T[i], S)){\n ans++;\n }\n }",
"{\n if(binarySearch(T[i], S)){\n ans++;\n }\n }",
"if(binarySearch(T[i], S)){\n ans++;\n }",
"binarySearch(T[i], S)",
"binarySearch",
"T[i]",
"T",
"i",
"S",
"{\n ans++;\n }",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public static boolean binarySearch(int key, int[] target){\n int left = 0;\n int right = target.length;\n int middle;\n\n while(left < right){\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = target.length;\n int middle;\n\n while(left < right){\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = target.length;",
"right",
"target.length",
"target",
"target.length",
"int middle;",
"middle",
"while(left < right){\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }",
"left < right",
"left",
"right",
"{\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }",
"middle = (left + right) / 2",
"middle",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(key < target[middle]) right = middle;",
"key < target[middle]",
"key",
"target[middle]",
"target",
"middle",
"right = middle",
"right",
"middle",
"if(key == target[middle]) return true;",
"key == target[middle]",
"key",
"target[middle]",
"target",
"middle",
"return true;",
"true",
"if(key > target[middle]) left = middle + 1;",
"key > target[middle]",
"key",
"target[middle]",
"target",
"middle",
"left = middle + 1",
"left",
"middle + 1",
"middle",
"1",
"return false;",
"false",
"int key",
"key",
"int[] target",
"target",
"public class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] s = br.readLine().split(\" \");\n int[] S = new int[n];\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(s[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] t = br.readLine().split(\" \");\n int[] T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(t[i]);\n }\n\n int ans = 0;\n\n //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§) \n for(int i = 0; i < T.length; i++){\n if(binarySearch(T[i], S)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n\n public static boolean binarySearch(int key, int[] target){\n int left = 0;\n int right = target.length;\n int middle;\n\n while(left < right){\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }\n return false;\n }\n\n}",
"public class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] s = br.readLine().split(\" \");\n int[] S = new int[n];\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(s[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] t = br.readLine().split(\" \");\n int[] T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(t[i]);\n }\n\n int ans = 0;\n\n //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§) \n for(int i = 0; i < T.length; i++){\n if(binarySearch(T[i], S)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n\n public static boolean binarySearch(int key, int[] target){\n int left = 0;\n int right = target.length;\n int middle;\n\n while(left < right){\n middle = (left + right) / 2;\n if(key < target[middle]) right = middle;\n if(key == target[middle]) return true;\n if(key > target[middle]) left = middle + 1;\n }\n return false;\n }\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] s = br.readLine().split(" ");
int[] S = new int[n];
for(int i = 0; i < n; i++){
S[i] = Integer.parseInt(s[i]);
}
int q = Integer.parseInt(br.readLine());
String[] t = br.readLine().split(" ");
int[] T = new int[q];
for(int i = 0; i < q; i++){
T[i] = Integer.parseInt(t[i]);
}
int ans = 0;
//??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)
for(int i = 0; i < T.length; i++){
if(binarySearch(T[i], S)){
ans++;
}
}
System.out.println(ans);
}
public static boolean binarySearch(int key, int[] target){
int left = 0;
int right = target.length;
int middle;
while(left < right){
middle = (left + right) / 2;
if(key < target[middle]) right = middle;
if(key == target[middle]) return true;
if(key > target[middle]) left = middle + 1;
}
return false;
}
} |
[
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,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
4,
18,
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,
0,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
29,
17,
29,
17,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
0,
13,
17,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
18,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
41,
13,
4,
18,
13,
13,
13,
0,
13,
2,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
13,
14,
2,
13,
40,
17,
0,
13,
13,
29,
4,
18,
13,
13,
29,
40,
17,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
244,
11
],
[
244,
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
],
[
16,
37
],
[
37,
38
],
[
37,
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
],
[
16,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
16,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
69,
74
],
[
16,
75
],
[
75,
76
],
[
75,
77
],
[
16,
78
],
[
78,
79
],
[
78,
80
],
[
78,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
84,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
83,
91
],
[
91,
92
],
[
16,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
12,
99
],
[
99,
100
],
[
244,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
103,
112
],
[
112,
113
],
[
103,
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
],
[
128,
130
],
[
127,
131
],
[
126,
132
],
[
132,
133
],
[
132,
134
],
[
126,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
135,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
135,
146
],
[
146,
147
],
[
103,
148
],
[
148,
149
],
[
101,
150
],
[
150,
151
],
[
101,
152
],
[
152,
153
],
[
0,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
154,
158
],
[
158,
159
],
[
154,
160
],
[
160,
161
],
[
154,
162
],
[
162,
163
],
[
154,
164
],
[
164,
165
],
[
154,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
168,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
174,
178
],
[
168,
179
],
[
179,
180
],
[
179,
181
],
[
168,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
184,
188
],
[
168,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
166,
194
],
[
194,
195
],
[
166,
196
],
[
196,
197
],
[
154,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
208,
211
],
[
208,
212
],
[
205,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
205,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
223,
224
],
[
222,
225
],
[
222,
226
],
[
205,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
227,
232
],
[
232,
233
],
[
232,
234
],
[
205,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
236,
239
],
[
201,
240
],
[
240,
241
],
[
241,
242
],
[
0,
243
],
[
243,
244
],
[
243,
245
]
] | [
"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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\n }\n\n return false;\n }\n}\n\nclass StrSplitToInt {\n String s;\n String split;\n int currentPos;\n int nextPos;\n int endPos;\n\n public StrSplitToInt(String s,String split) {\n this.s = s;\n this.split = split;\n currentPos = 0;\n nextPos = s.indexOf(split, currentPos);\n endPos = s.length();\n }\n\n public int nextInt() {\n if( currentPos < endPos ) {\n String i = s.substring(currentPos, nextPos);\n currentPos = nextPos + split.length();\n nextPos = s.indexOf(split, currentPos);\n if(nextPos == -1) nextPos = endPos;\n\n return Integer.parseInt(i);\n }\n else\n return -1;\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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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();",
"line",
"br.readLine()",
"br.readLine",
"br",
"StrSplitToInt stoi = new StrSplitToInt(line, \" \");",
"stoi",
"new StrSplitToInt(line, \" \")",
"for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"seqS[i] = stoi.nextInt();",
"seqS[i] = stoi.nextInt()",
"seqS[i]",
"seqS",
"i",
"stoi.nextInt()",
"stoi.nextInt",
"stoi",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] lines = br.readLine().split(\" \");",
"lines",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int cnt=0;",
"cnt",
"0",
"for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;\n }",
"String ref",
"lines",
"{\n if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;\n }",
"{\n if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;\n }",
"if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;",
"isExistSeachByBinary(seqS, Integer.parseInt(ref))",
"isExistSeachByBinary",
"seqS",
"Integer.parseInt(ref)",
"Integer.parseInt",
"Integer",
"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 ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\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 ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\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 ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right) / 2;\n if( tar[mid] > ref ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\n }",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if( tar[mid] > ref ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;",
"tar[mid] > ref",
"tar[mid]",
"tar",
"mid",
"ref",
"right = mid",
"right",
"mid",
"if(tar[mid] < ref ) left = mid + 1;\n else return true;",
"tar[mid] < ref",
"tar[mid]",
"tar",
"mid",
"ref",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return true;",
"true",
"return false;",
"false",
"int[] tar",
"tar",
"int ref",
"ref",
"class StrSplitToInt {\n String s;\n String split;\n int currentPos;\n int nextPos;\n int endPos;\n\n public StrSplitToInt(String s,String split) {\n this.s = s;\n this.split = split;\n currentPos = 0;\n nextPos = s.indexOf(split, currentPos);\n endPos = s.length();\n }\n\n public int nextInt() {\n if( currentPos < endPos ) {\n String i = s.substring(currentPos, nextPos);\n currentPos = nextPos + split.length();\n nextPos = s.indexOf(split, currentPos);\n if(nextPos == -1) nextPos = endPos;\n\n return Integer.parseInt(i);\n }\n else\n return -1;\n }\n}",
"StrSplitToInt",
"String s;",
"s",
"String split;",
"split",
"int currentPos;",
"currentPos",
"int nextPos;",
"nextPos",
"int endPos;",
"endPos",
"public StrSplitToInt(String s,String split) {\n this.s = s;\n this.split = split;\n currentPos = 0;\n nextPos = s.indexOf(split, currentPos);\n endPos = s.length();\n }",
"StrSplitToInt",
"{\n this.s = s;\n this.split = split;\n currentPos = 0;\n nextPos = s.indexOf(split, currentPos);\n endPos = s.length();\n }",
"this.s = s",
"this.s",
"this",
"this.s",
"s",
"this.split = split",
"this.split",
"this",
"this.split",
"split",
"currentPos = 0",
"currentPos",
"0",
"nextPos = s.indexOf(split, currentPos)",
"nextPos",
"s.indexOf(split, currentPos)",
"s.indexOf",
"s",
"split",
"currentPos",
"endPos = s.length()",
"endPos",
"s.length()",
"s.length",
"s",
"String s",
"s",
"String split",
"split",
"public int nextInt() {\n if( currentPos < endPos ) {\n String i = s.substring(currentPos, nextPos);\n currentPos = nextPos + split.length();\n nextPos = s.indexOf(split, currentPos);\n if(nextPos == -1) nextPos = endPos;\n\n return Integer.parseInt(i);\n }\n else\n return -1;\n }",
"nextInt",
"{\n if( currentPos < endPos ) {\n String i = s.substring(currentPos, nextPos);\n currentPos = nextPos + split.length();\n nextPos = s.indexOf(split, currentPos);\n if(nextPos == -1) nextPos = endPos;\n\n return Integer.parseInt(i);\n }\n else\n return -1;\n }",
"if( currentPos < endPos ) {\n String i = s.substring(currentPos, nextPos);\n currentPos = nextPos + split.length();\n nextPos = s.indexOf(split, currentPos);\n if(nextPos == -1) nextPos = endPos;\n\n return Integer.parseInt(i);\n }\n else\n return -1;",
"currentPos < endPos",
"currentPos",
"endPos",
"{\n String i = s.substring(currentPos, nextPos);\n currentPos = nextPos + split.length();\n nextPos = s.indexOf(split, currentPos);\n if(nextPos == -1) nextPos = endPos;\n\n return Integer.parseInt(i);\n }",
"String i = s.substring(currentPos, nextPos);",
"i",
"s.substring(currentPos, nextPos)",
"s.substring",
"s",
"currentPos",
"nextPos",
"currentPos = nextPos + split.length()",
"currentPos",
"nextPos + split.length()",
"nextPos",
"split.length()",
"split.length",
"split",
"nextPos = s.indexOf(split, currentPos)",
"nextPos",
"s.indexOf(split, currentPos)",
"s.indexOf",
"s",
"split",
"currentPos",
"if(nextPos == -1) nextPos = endPos;",
"nextPos == -1",
"nextPos",
"-1",
"1",
"nextPos = endPos",
"nextPos",
"endPos",
"return Integer.parseInt(i);",
"Integer.parseInt(i)",
"Integer.parseInt",
"Integer",
"i",
"return -1;",
"-1",
"1",
"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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\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();\n StrSplitToInt stoi = new StrSplitToInt(line, \" \");\n for (int i=0; i<n; i++)\n seqS[i] = stoi.nextInt();\n\n int q = Integer.parseInt(br.readLine());\n String[] lines = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : lines) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 ) right = mid;\n else if(tar[mid] < ref ) left = mid + 1;\n else return true;\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();
StrSplitToInt stoi = new StrSplitToInt(line, " ");
for (int i=0; i<n; i++)
seqS[i] = stoi.nextInt();
int q = Integer.parseInt(br.readLine());
String[] lines = br.readLine().split(" ");
int cnt=0;
for (String ref : lines) {
if( isExistSeachByBinary(seqS, Integer.parseInt(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 ) right = mid;
else if(tar[mid] < ref ) left = mid + 1;
else return true;
}
return false;
}
}
class StrSplitToInt {
String s;
String split;
int currentPos;
int nextPos;
int endPos;
public StrSplitToInt(String s,String split) {
this.s = s;
this.split = split;
currentPos = 0;
nextPos = s.indexOf(split, currentPos);
endPos = s.length();
}
public int nextInt() {
if( currentPos < endPos ) {
String i = s.substring(currentPos, nextPos);
currentPos = nextPos + split.length();
nextPos = s.indexOf(split, currentPos);
if(nextPos == -1) nextPos = endPos;
return Integer.parseInt(i);
}
else
return -1;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
0,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
14,
2,
4,
18,
13,
4,
18,
13,
30,
41,
13,
4,
18,
13,
42,
4,
18,
13,
30,
14,
4,
18,
13,
4,
18,
13,
30,
40,
13,
30,
41,
13,
4,
18,
13,
42,
4,
18,
13,
30,
14,
4,
18,
13,
4,
18,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
176,
17
],
[
176,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
22,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
22,
33
],
[
33,
34
],
[
33,
35
],
[
22,
36
],
[
36,
37
],
[
36,
38
],
[
22,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
22,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
22,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
50,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
71,
73
],
[
22,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
22,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
22,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
22,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
90,
100
],
[
100,
101
],
[
101,
102
],
[
90,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
111,
113
],
[
22,
114
],
[
114,
115
],
[
114,
116
],
[
22,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
140,
141
],
[
141,
142
],
[
136,
143
],
[
143,
144
],
[
144,
145
],
[
117,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
152,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
158,
161
],
[
161,
162
],
[
162,
163
],
[
157,
164
],
[
164,
165
],
[
165,
166
],
[
22,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
18,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Set;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n\t\t\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Iterator;",
"Iterator",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n\t\t\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n\t\t\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }\n\t}",
"main",
"{\n // TODO ?????????????????????????????????????????????\n\t\t\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }\n\t}",
"try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }",
"{\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"new BufferedReader(new InputStreamReader(System.in))",
"String line;",
"line",
"line=br.readLine()",
"line",
"br.readLine()",
"br.readLine",
"br",
"Set<Integer> set1=new HashSet<Integer>();",
"set1",
"new HashSet<Integer>()",
"Set<Integer> set2=new HashSet<Integer>();",
"set2",
"new HashSet<Integer>()",
"line=br.readLine()",
"line",
"br.readLine()",
"br.readLine",
"br",
"String[] str=line.split(\" \");",
"str",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<str.length",
"i",
"str.length",
"str",
"str.length",
"i++",
"i++",
"i",
"{\n \tset1.add(Integer.parseInt(str[i]));\n }",
"{\n \tset1.add(Integer.parseInt(str[i]));\n }",
"set1.add(Integer.parseInt(str[i]))",
"set1.add",
"set1",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"line=br.readLine()",
"line",
"br.readLine()",
"br.readLine",
"br",
"line=br.readLine()",
"line",
"br.readLine()",
"br.readLine",
"br",
"str=line.split(\" \")",
"str",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<str.length",
"i",
"str.length",
"str",
"str.length",
"i++",
"i++",
"i",
"{\n \tset2.add(Integer.parseInt(str[i]));\n }",
"{\n \tset2.add(Integer.parseInt(str[i]));\n }",
"set2.add(Integer.parseInt(str[i]))",
"set2.add",
"set2",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int result=0;",
"result",
"0",
"if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }",
"set1.size()>set2.size()",
"set1.size()",
"set1.size",
"set1",
"set2.size()",
"set2.size",
"set2",
"{\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }",
"Iterator it=set2.iterator();",
"it",
"set2.iterator()",
"set2.iterator",
"set2",
"while(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}",
"it.hasNext()",
"it.hasNext",
"it",
"{\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}",
"if(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}",
"set1.contains(it.next())",
"set1.contains",
"set1",
"it.next()",
"it.next",
"it",
"{\n \t\t\tresult++;\n \t\t}",
"result++",
"result",
"{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }",
"Iterator it=set1.iterator();",
"it",
"set1.iterator()",
"set1.iterator",
"set1",
"while(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}",
"it.hasNext()",
"it.hasNext",
"it",
"{\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}",
"if(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}",
"set2.contains(it.next())",
"set2.contains",
"set2",
"it.next()",
"it.next",
"it",
"{\n \t\t\tresult++;\n \t\t}",
"result++",
"result",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n\t\t\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n\t\t\n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n Set<Integer> set1=new HashSet<Integer>();\n Set<Integer> set2=new HashSet<Integer>();\n line=br.readLine();\n String[] str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset1.add(Integer.parseInt(str[i]));\n }\n line=br.readLine();\n line=br.readLine();\n str=line.split(\" \");\n for(int i=0;i<str.length;i++){\n \tset2.add(Integer.parseInt(str[i]));\n }\n int result=0;\n if(set1.size()>set2.size()){\n \tIterator it=set2.iterator();\n \twhile(it.hasNext()){\n \t\tif(set1.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }else{\n \tIterator it=set1.iterator();\n \twhile(it.hasNext()){\n \t\tif(set2.contains(it.next())){\n \t\t\tresult++;\n \t\t}\n \t}\n }\n System.out.println(result);\n }\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Main {
public static void main(String[] args) throws Exception {
// TODO ?????????????????????????????????????????????
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
String line;
line=br.readLine();
Set<Integer> set1=new HashSet<Integer>();
Set<Integer> set2=new HashSet<Integer>();
line=br.readLine();
String[] str=line.split(" ");
for(int i=0;i<str.length;i++){
set1.add(Integer.parseInt(str[i]));
}
line=br.readLine();
line=br.readLine();
str=line.split(" ");
for(int i=0;i<str.length;i++){
set2.add(Integer.parseInt(str[i]));
}
int result=0;
if(set1.size()>set2.size()){
Iterator it=set2.iterator();
while(it.hasNext()){
if(set1.contains(it.next())){
result++;
}
}
}else{
Iterator it=set1.iterator();
while(it.hasNext()){
if(set2.contains(it.next())){
result++;
}
}
}
System.out.println(result);
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
13,
41,
13,
4,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
13,
13,
41,
13,
4,
13,
4,
18,
4,
18,
13,
17,
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,
4,
13,
13,
18,
13,
13,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
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,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
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,
29,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
204,
8
],
[
204,
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
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
24,
29
],
[
11,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
11,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
39,
44
],
[
11,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
50,
51
],
[
50,
52
],
[
50,
53
],
[
9,
54
],
[
54,
55
],
[
204,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
62,
72
],
[
72,
73
],
[
73,
74
],
[
62,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
78,
81
],
[
81,
82
],
[
81,
83
],
[
77,
84
],
[
84,
85
],
[
58,
86
],
[
86,
87
],
[
56,
88
],
[
88,
89
],
[
56,
90
],
[
90,
91
],
[
204,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
94,
105
],
[
105,
106
],
[
94,
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
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
119,
125
],
[
125,
126
],
[
126,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
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
],
[
94,
146
],
[
146,
147
],
[
92,
148
],
[
148,
149
],
[
92,
150
],
[
150,
151
],
[
204,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
159,
160
],
[
160,
161
],
[
152,
162
],
[
162,
163
],
[
204,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
169,
171
],
[
166,
172
],
[
172,
173
],
[
172,
174
],
[
166,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
176,
181
],
[
181,
182
],
[
181,
183
],
[
176,
184
],
[
184,
185
],
[
185,
186
],
[
176,
187
],
[
188,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
189,
193
],
[
193,
194
],
[
194,
195
],
[
193,
196
],
[
196,
197
],
[
196,
198
],
[
166,
199
],
[
199,
200
],
[
164,
201
],
[
201,
202
],
[
0,
203
],
[
203,
204
],
[
203,
205
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\t int n = readInt(r);\n\t\t int[] s = strAryToIntAry(r.readLine().split(\" \"));\n\t\t int q = readInt(r);\n\t\t int[] t = strAryToIntAry(r.readLine().split(\" \"));\n\n\t\t System.out.println(search(s, t));\n\t}\n\n\tpublic static int search(int[] s,int[] t){\n\t\tint sum = 0;\n\t\tfor(int i = 0 ; i < t.length ; i++ ){\n\t\t\tif(binarySearch(s,t[i])) sum++;\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static boolean binarySearch(int[] s,int key){\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\tint mid;\n\t\twhile(left <= right){\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int readInt(BufferedReader r) throws Exception{\n return Integer.parseInt(r.readLine());\n }\n\n\tpublic static int[] strAryToIntAry(String[] strAry){\n\t\tint arraySize = strAry.length;\n\t\tint[] intAry= new int[arraySize];\n\t\tfor(int i = 0 ; i < arraySize ; i++){\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}\n\n\t\treturn intAry;\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\t int n = readInt(r);\n\t\t int[] s = strAryToIntAry(r.readLine().split(\" \"));\n\t\t int q = readInt(r);\n\t\t int[] t = strAryToIntAry(r.readLine().split(\" \"));\n\n\t\t System.out.println(search(s, t));\n\t}\n\n\tpublic static int search(int[] s,int[] t){\n\t\tint sum = 0;\n\t\tfor(int i = 0 ; i < t.length ; i++ ){\n\t\t\tif(binarySearch(s,t[i])) sum++;\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static boolean binarySearch(int[] s,int key){\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\tint mid;\n\t\twhile(left <= right){\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int readInt(BufferedReader r) throws Exception{\n return Integer.parseInt(r.readLine());\n }\n\n\tpublic static int[] strAryToIntAry(String[] strAry){\n\t\tint arraySize = strAry.length;\n\t\tint[] intAry= new int[arraySize];\n\t\tfor(int i = 0 ; i < arraySize ; i++){\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}\n\n\t\treturn intAry;\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\t int n = readInt(r);\n\t\t int[] s = strAryToIntAry(r.readLine().split(\" \"));\n\t\t int q = readInt(r);\n\t\t int[] t = strAryToIntAry(r.readLine().split(\" \"));\n\n\t\t System.out.println(search(s, t));\n\t}",
"main",
"{\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\t int n = readInt(r);\n\t\t int[] s = strAryToIntAry(r.readLine().split(\" \"));\n\t\t int q = readInt(r);\n\t\t int[] t = strAryToIntAry(r.readLine().split(\" \"));\n\n\t\t System.out.println(search(s, t));\n\t}",
"BufferedReader r = new BufferedReader(new InputStreamReader(System.in));",
"r",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = readInt(r);",
"n",
"readInt(r)",
"readInt",
"r",
"int[] s = strAryToIntAry(r.readLine().split(\" \"));",
"s",
"strAryToIntAry(r.readLine().split(\" \"))",
"strAryToIntAry",
"r.readLine().split(\" \")",
"r.readLine().split",
"r.readLine()",
"r.readLine",
"r",
"\" \"",
"int q = readInt(r);",
"q",
"readInt(r)",
"readInt",
"r",
"int[] t = strAryToIntAry(r.readLine().split(\" \"));",
"t",
"strAryToIntAry(r.readLine().split(\" \"))",
"strAryToIntAry",
"r.readLine().split(\" \")",
"r.readLine().split",
"r.readLine()",
"r.readLine",
"r",
"\" \"",
"System.out.println(search(s, t))",
"System.out.println",
"System.out",
"System",
"System.out",
"search(s, t)",
"search",
"s",
"t",
"String[] args",
"args",
"public static int search(int[] s,int[] t){\n\t\tint sum = 0;\n\t\tfor(int i = 0 ; i < t.length ; i++ ){\n\t\t\tif(binarySearch(s,t[i])) sum++;\n\t\t}\n\t\treturn sum;\n\t}",
"search",
"{\n\t\tint sum = 0;\n\t\tfor(int i = 0 ; i < t.length ; i++ ){\n\t\t\tif(binarySearch(s,t[i])) sum++;\n\t\t}\n\t\treturn sum;\n\t}",
"int sum = 0;",
"sum",
"0",
"for(int i = 0 ; i < t.length ; i++ ){\n\t\t\tif(binarySearch(s,t[i])) sum++;\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(binarySearch(s,t[i])) sum++;\n\t\t}",
"{\n\t\t\tif(binarySearch(s,t[i])) sum++;\n\t\t}",
"if(binarySearch(s,t[i])) sum++;",
"binarySearch(s,t[i])",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"sum++",
"sum",
"return sum;",
"sum",
"int[] s",
"s",
"int[] t",
"t",
"public static boolean binarySearch(int[] s,int key){\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\tint mid;\n\t\twhile(left <= right){\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\tint mid;\n\t\twhile(left <= right){\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"int left = 0;",
"left",
"0",
"int right = s.length - 1;",
"right",
"s.length - 1",
"s.length",
"s",
"s.length",
"1",
"int mid;",
"mid",
"while(left <= right){\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"mid = (left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\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\treturn true;\n\t\t\t}",
"return true;",
"true",
"if(key < s[mid]){\n\t\t\t\tright = mid - 1;\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 - 1;\n\t\t\t}",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] s",
"s",
"int key",
"key",
"public static int readInt(BufferedReader r) throws Exception{\n return Integer.parseInt(r.readLine());\n }",
"readInt",
"{\n return Integer.parseInt(r.readLine());\n }",
"return Integer.parseInt(r.readLine());",
"Integer.parseInt(r.readLine())",
"Integer.parseInt",
"Integer",
"r.readLine()",
"r.readLine",
"r",
"BufferedReader r",
"r",
"public static int[] strAryToIntAry(String[] strAry){\n\t\tint arraySize = strAry.length;\n\t\tint[] intAry= new int[arraySize];\n\t\tfor(int i = 0 ; i < arraySize ; i++){\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}\n\n\t\treturn intAry;\n\t}",
"strAryToIntAry",
"{\n\t\tint arraySize = strAry.length;\n\t\tint[] intAry= new int[arraySize];\n\t\tfor(int i = 0 ; i < arraySize ; i++){\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}\n\n\t\treturn intAry;\n\t}",
"int arraySize = strAry.length;",
"arraySize",
"strAry.length",
"strAry",
"strAry.length",
"int[] intAry= new int[arraySize];",
"intAry",
"new int[arraySize]",
"arraySize",
"for(int i = 0 ; i < arraySize ; i++){\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < arraySize",
"i",
"arraySize",
"i++",
"i++",
"i",
"{\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}",
"{\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}",
"intAry[i] =Integer.parseInt(strAry[i])",
"intAry[i]",
"intAry",
"i",
"Integer.parseInt(strAry[i])",
"Integer.parseInt",
"Integer",
"strAry[i]",
"strAry",
"i",
"return intAry;",
"intAry",
"String[] strAry",
"strAry",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\t int n = readInt(r);\n\t\t int[] s = strAryToIntAry(r.readLine().split(\" \"));\n\t\t int q = readInt(r);\n\t\t int[] t = strAryToIntAry(r.readLine().split(\" \"));\n\n\t\t System.out.println(search(s, t));\n\t}\n\n\tpublic static int search(int[] s,int[] t){\n\t\tint sum = 0;\n\t\tfor(int i = 0 ; i < t.length ; i++ ){\n\t\t\tif(binarySearch(s,t[i])) sum++;\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static boolean binarySearch(int[] s,int key){\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\tint mid;\n\t\twhile(left <= right){\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int readInt(BufferedReader r) throws Exception{\n return Integer.parseInt(r.readLine());\n }\n\n\tpublic static int[] strAryToIntAry(String[] strAry){\n\t\tint arraySize = strAry.length;\n\t\tint[] intAry= new int[arraySize];\n\t\tfor(int i = 0 ; i < arraySize ; i++){\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}\n\n\t\treturn intAry;\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\t int n = readInt(r);\n\t\t int[] s = strAryToIntAry(r.readLine().split(\" \"));\n\t\t int q = readInt(r);\n\t\t int[] t = strAryToIntAry(r.readLine().split(\" \"));\n\n\t\t System.out.println(search(s, t));\n\t}\n\n\tpublic static int search(int[] s,int[] t){\n\t\tint sum = 0;\n\t\tfor(int i = 0 ; i < t.length ; i++ ){\n\t\t\tif(binarySearch(s,t[i])) sum++;\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static boolean binarySearch(int[] s,int key){\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\tint mid;\n\t\twhile(left <= right){\n\t\t\tmid = (left+right)/2;\n\t\t\tif(key == s[mid]){\n\t\t\t\treturn true;\n\t\t\t}else if(key < s[mid]){\n\t\t\t\tright = mid - 1;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int readInt(BufferedReader r) throws Exception{\n return Integer.parseInt(r.readLine());\n }\n\n\tpublic static int[] strAryToIntAry(String[] strAry){\n\t\tint arraySize = strAry.length;\n\t\tint[] intAry= new int[arraySize];\n\t\tfor(int i = 0 ; i < arraySize ; i++){\n\t\t\tintAry[i] =Integer.parseInt(strAry[i]);\n\t\t}\n\n\t\treturn intAry;\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
int n = readInt(r);
int[] s = strAryToIntAry(r.readLine().split(" "));
int q = readInt(r);
int[] t = strAryToIntAry(r.readLine().split(" "));
System.out.println(search(s, t));
}
public static int search(int[] s,int[] t){
int sum = 0;
for(int i = 0 ; i < t.length ; i++ ){
if(binarySearch(s,t[i])) sum++;
}
return sum;
}
public static boolean binarySearch(int[] s,int key){
int left = 0;
int right = s.length - 1;
int mid;
while(left <= right){
mid = (left+right)/2;
if(key == s[mid]){
return true;
}else if(key < s[mid]){
right = mid - 1;
}else{
left = mid + 1;
}
}
return false;
}
public static int readInt(BufferedReader r) throws Exception{
return Integer.parseInt(r.readLine());
}
public static int[] strAryToIntAry(String[] strAry){
int arraySize = strAry.length;
int[] intAry= new int[arraySize];
for(int i = 0 ; i < arraySize ; i++){
intAry[i] =Integer.parseInt(strAry[i]);
}
return intAry;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
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,
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,
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
],
[
87,
5
],
[
87,
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
],
[
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
],
[
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
],
[
69,
73
],
[
68,
74
],
[
74,
75
],
[
67,
76
],
[
76,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
6,
84
],
[
84,
85
],
[
0,
86
],
[
86,
87
],
[
86,
88
]
] | [
"import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n int cnt = 0;\n\t\tint[] num = new int[n];\n\n\t\tfor(int i=0; i< n;i++) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n int m = sc.nextInt();\n\t\tfor(int i = 0;i<m;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n int cnt = 0;\n\t\tint[] num = new int[n];\n\n\t\tfor(int i=0; i< n;i++) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n int m = sc.nextInt();\n\t\tfor(int i = 0;i<m;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n int cnt = 0;\n\t\tint[] num = new int[n];\n\n\t\tfor(int i=0; i< n;i++) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n int m = sc.nextInt();\n\t\tfor(int i = 0;i<m;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n int cnt = 0;\n\t\tint[] num = new int[n];\n\n\t\tfor(int i=0; i< n;i++) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n int m = sc.nextInt();\n\t\tfor(int i = 0;i<m;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}\n\t\tSystem.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 cnt = 0;",
"cnt",
"0",
"int[] num = new int[n];",
"num",
"new int[n]",
"n",
"for(int i=0; i< n;i++) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i< n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tnum[i] = sc.nextInt();\n\t\t}",
"num[i] = sc.nextInt()",
"num[i]",
"num",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0;i<m;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}",
"{\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;",
"Arrays.binarySearch(num, a) > -1",
"Arrays.binarySearch(num, a)",
"Arrays.binarySearch",
"Arrays",
"num",
"a",
"-1",
"1",
"cnt++",
"cnt",
"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 Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n int cnt = 0;\n\t\tint[] num = new int[n];\n\n\t\tfor(int i=0; i< n;i++) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n int m = sc.nextInt();\n\t\tfor(int i = 0;i<m;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n }\n}",
"public class Main{\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n int cnt = 0;\n\t\tint[] num = new int[n];\n\n\t\tfor(int i=0; i< n;i++) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n int m = sc.nextInt();\n\t\tfor(int i = 0;i<m;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n }\n}",
"Main"
] | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int cnt = 0;
int[] num = new int[n];
for(int i=0; i< n;i++) {
num[i] = sc.nextInt();
}
int m = sc.nextInt();
for(int i = 0;i<m;i++) {
int a = sc.nextInt();
if (Arrays.binarySearch(num, a) > -1)
cnt++;
}
System.out.println(cnt);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
13,
13,
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,
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,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
139,
5
],
[
139,
6
],
[
6,
7
],
[
6,
8
],
[
139,
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
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
61,
67
],
[
67,
68
],
[
67,
69
],
[
67,
70
],
[
11,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
9,
77
],
[
77,
78
],
[
139,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
81,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
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
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
102,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
112,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
112,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
122,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
79,
134
],
[
134,
135
],
[
79,
136
],
[
136,
137
],
[
0,
138
],
[
138,
139
],
[
138,
140
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\n\t\tfor(int j = 0; j < q; j++) {\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void binarySearch(long[] S, long T) {\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\t\n\t\twhile(left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(S[mid] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\n\t\tfor(int j = 0; j < q; j++) {\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void binarySearch(long[] S, long T) {\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\t\n\t\twhile(left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(S[mid] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n\n}",
"Main",
"static int count = 0;",
"count",
"0",
"public static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\n\t\tfor(int j = 0; j < q; j++) {\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\n\t\tfor(int j = 0; j < q; j++) {\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] S = new long[n];",
"S",
"new long[n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = sc.nextLong();\n\t\t}",
"{\n\t\t\tS[i] = sc.nextLong();\n\t\t}",
"S[i] = sc.nextLong()",
"S[i]",
"S",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int j = 0; j < q; j++) {\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}",
"{\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}",
"long T = sc.nextLong();",
"T",
"sc.nextLong()",
"sc.nextLong",
"sc",
"binarySearch(S, T)",
"binarySearch",
"S",
"T",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static void binarySearch(long[] S, long T) {\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\t\n\t\twhile(left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(S[mid] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\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 = S.length;\n\t\t\n\t\twhile(left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(S[mid] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}",
"int left = 0;",
"left",
"0",
"int right = S.length;",
"right",
"S.length",
"S",
"S.length",
"while(left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(S[mid] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\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] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\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] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"S[mid] == T",
"S[mid]",
"S",
"mid",
"T",
"{\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t}",
"count++",
"count",
"return;",
"if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"S[mid] > T",
"S[mid]",
"S",
"mid",
"T",
"{\n\t\t\t\tright = mid;\n\t\t\t}",
"right = mid",
"right",
"mid",
"if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"S[mid] < T",
"S[mid]",
"S",
"mid",
"T",
"{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"long[] S",
"S",
"long T",
"T",
"public class Main {\n\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\n\t\tfor(int j = 0; j < q; j++) {\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void binarySearch(long[] S, long T) {\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\t\n\t\twhile(left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(S[mid] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n\n}",
"public class Main {\n\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\n\t\tfor(int j = 0; j < q; j++) {\n\n\t\t\tlong T = sc.nextLong();\n\t\t\tbinarySearch(S, T);\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void binarySearch(long[] S, long T) {\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\t\n\t\twhile(left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(S[mid] == T) {\n\t\t\t\tcount++;\n\t\t\t\treturn;\n\t\t\t} else if(S[mid] > T) {\n\t\t\t\tright = mid;\n\t\t\t} else if(S[mid] < T) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int count = 0;
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();
for(int j = 0; j < q; j++) {
long T = sc.nextLong();
binarySearch(S, T);
}
System.out.println(count);
}
public static void binarySearch(long[] S, long T) {
int left = 0;
int right = S.length;
while(left < right) {
int mid = (left + right) / 2;
if(S[mid] == T) {
count++;
return;
} else if(S[mid] > T) {
right = mid;
} else if(S[mid] < T) {
left = mid + 1;
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
2,
13,
17,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
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,
30,
11,
1,
0,
13,
13,
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
],
[
170,
5
],
[
170,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
8,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
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
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
8,
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
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
115,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
110,
121
],
[
122,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
101,
135
],
[
135,
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
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
154,
155
],
[
154,
156
],
[
149,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
8,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
6,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"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 i,j,n,q,count=0,mid;\n\t\tn=scan.nextInt();\n\t\tint[] s=new int[n];\n\t\tfor(i=0;i<n;i++) {\n\t\t\ts[i]=scan.nextInt();\n\t\t}\n\t\tmid=n/2;\n\t\tq=scan.nextInt();\n\t\tint[] t=new int[q];\n\t\tfor(i=0;i<q;i++) {\n\t\t\tt[i]=scan.nextInt();\n\t\t}\n\t\tfor(i=0;i<q;i++) {\n\t\t\tif(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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\tSystem.out.println(count);\n\t}\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 i,j,n,q,count=0,mid;\n\t\tn=scan.nextInt();\n\t\tint[] s=new int[n];\n\t\tfor(i=0;i<n;i++) {\n\t\t\ts[i]=scan.nextInt();\n\t\t}\n\t\tmid=n/2;\n\t\tq=scan.nextInt();\n\t\tint[] t=new int[q];\n\t\tfor(i=0;i<q;i++) {\n\t\t\tt[i]=scan.nextInt();\n\t\t}\n\t\tfor(i=0;i<q;i++) {\n\t\t\tif(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint i,j,n,q,count=0,mid;\n\t\tn=scan.nextInt();\n\t\tint[] s=new int[n];\n\t\tfor(i=0;i<n;i++) {\n\t\t\ts[i]=scan.nextInt();\n\t\t}\n\t\tmid=n/2;\n\t\tq=scan.nextInt();\n\t\tint[] t=new int[q];\n\t\tfor(i=0;i<q;i++) {\n\t\t\tt[i]=scan.nextInt();\n\t\t}\n\t\tfor(i=0;i<q;i++) {\n\t\t\tif(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner scan=new Scanner(System.in);\n\t\tint i,j,n,q,count=0,mid;\n\t\tn=scan.nextInt();\n\t\tint[] s=new int[n];\n\t\tfor(i=0;i<n;i++) {\n\t\t\ts[i]=scan.nextInt();\n\t\t}\n\t\tmid=n/2;\n\t\tq=scan.nextInt();\n\t\tint[] t=new int[q];\n\t\tfor(i=0;i<q;i++) {\n\t\t\tt[i]=scan.nextInt();\n\t\t}\n\t\tfor(i=0;i<q;i++) {\n\t\t\tif(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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\tSystem.out.println(count);\n\t}",
"Scanner scan=new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int i",
"i",
"j",
"j",
"n",
"n",
"q",
"q",
"count=0",
"count",
"0",
"mid;",
"mid",
"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++) {\n\t\t\ts[i]=scan.nextInt();\n\t\t}",
"i=0;",
"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",
"mid=n/2",
"mid",
"n/2",
"n",
"2",
"q=scan.nextInt()",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] t=new int[q];",
"t",
"new int[q]",
"q",
"for(i=0;i<q;i++) {\n\t\t\tt[i]=scan.nextInt();\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tt[i]=scan.nextInt();\n\t\t}",
"{\n\t\t\tt[i]=scan.nextInt();\n\t\t}",
"t[i]=scan.nextInt()",
"t[i]",
"t",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(i=0;i<q;i++) {\n\t\t\tif(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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[i]<s[mid]",
"t[i]",
"t",
"i",
"s[mid]",
"s",
"mid",
"{\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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<mid",
"j",
"mid",
"j++",
"j++",
"j",
"{\n\t\t\t\t\tif(t[i]==s[j]) {\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\tif(t[i]==s[j]) {\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(t[i]==s[j]) {\n\t\t\t\t\t\tcount++;\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\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"count++",
"count",
"break;",
"{\n\t\t\t\tfor(j=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;",
"j=mid",
"j",
"mid",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\t\tif(t[i]==s[j]) {\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\tif(t[i]==s[j]) {\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(t[i]==s[j]) {\n\t\t\t\t\t\tcount++;\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\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\tpublic static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint i,j,n,q,count=0,mid;\n\t\tn=scan.nextInt();\n\t\tint[] s=new int[n];\n\t\tfor(i=0;i<n;i++) {\n\t\t\ts[i]=scan.nextInt();\n\t\t}\n\t\tmid=n/2;\n\t\tq=scan.nextInt();\n\t\tint[] t=new int[q];\n\t\tfor(i=0;i<q;i++) {\n\t\t\tt[i]=scan.nextInt();\n\t\t}\n\t\tfor(i=0;i<q;i++) {\n\t\t\tif(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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\tSystem.out.println(count);\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint i,j,n,q,count=0,mid;\n\t\tn=scan.nextInt();\n\t\tint[] s=new int[n];\n\t\tfor(i=0;i<n;i++) {\n\t\t\ts[i]=scan.nextInt();\n\t\t}\n\t\tmid=n/2;\n\t\tq=scan.nextInt();\n\t\tint[] t=new int[q];\n\t\tfor(i=0;i<q;i++) {\n\t\t\tt[i]=scan.nextInt();\n\t\t}\n\t\tfor(i=0;i<q;i++) {\n\t\t\tif(t[i]<s[mid]) {\n\t\t\t\tfor(j=0;j<mid;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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=mid;j<n;j++) {\n\t\t\t\t\tif(t[i]==s[j]) {\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\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int i,j,n,q,count=0,mid;
n=scan.nextInt();
int[] s=new int[n];
for(i=0;i<n;i++) {
s[i]=scan.nextInt();
}
mid=n/2;
q=scan.nextInt();
int[] t=new int[q];
for(i=0;i<q;i++) {
t[i]=scan.nextInt();
}
for(i=0;i<q;i++) {
if(t[i]<s[mid]) {
for(j=0;j<mid;j++) {
if(t[i]==s[j]) {
count++;
break;
}
}
}
else {
for(j=mid;j<n;j++) {
if(t[i]==s[j]) {
count++;
break;
}
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
2,
4,
18,
13,
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,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
94,
5
],
[
94,
6
],
[
6,
7
],
[
6,
8
],
[
94,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
18,
21
],
[
21,
22
],
[
22,
23
],
[
12,
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
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
40,
47
],
[
37,
48
],
[
12,
49
],
[
49,
50
],
[
49,
51
],
[
12,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
58,
59
],
[
12,
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
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
82,
83
],
[
77,
84
],
[
12,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
10,
91
],
[
91,
92
],
[
0,
93
],
[
93,
94
],
[
93,
95
]
] | [
"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 = Integer.parseInt(sc.next());\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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%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 = Integer.parseInt(sc.next());\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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%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 = Integer.parseInt(sc.next());\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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%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 = Integer.parseInt(sc.next());\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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%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 = 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\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%100000] = 1;\n\t\t}",
"{\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[Integer.parseInt(sc.next())%100000] = 1;\n\t\t}",
"boo[Integer.parseInt(sc.next())%100000] = 1",
"boo[Integer.parseInt(sc.next())%100000]",
"boo",
"Integer.parseInt(sc.next())%100000",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%100000] ;\n\t\t}",
"{\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[Integer.parseInt(sc.next())%100000] ;\n\t\t}",
"ans += boo[Integer.parseInt(sc.next())%100000]",
"ans",
"boo[Integer.parseInt(sc.next())%100000]",
"boo",
"Integer.parseInt(sc.next())%100000",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"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 = Integer.parseInt(sc.next());\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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%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 = Integer.parseInt(sc.next());\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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%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 = Integer.parseInt(sc.next());
//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[Integer.parseInt(sc.next())%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[Integer.parseInt(sc.next())%100000] ;
}
System.out.println(ans);
}
} |
[
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,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
2,
13,
17,
14,
4,
13,
13,
13,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
13,
30,
29,
17,
30,
29,
4,
13,
13,
13,
13,
13,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
13,
30,
29,
17,
30,
29,
4,
13,
13,
13,
13,
13,
30,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
330,
11
],
[
330,
12
],
[
12,
13
],
[
12,
14
],
[
330,
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
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
17,
52
],
[
52,
53
],
[
52,
54
],
[
17,
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
],
[
78,
79
],
[
78,
80
],
[
67,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
82,
85
],
[
82,
86
],
[
82,
87
],
[
81,
88
],
[
88,
89
],
[
89,
90
],
[
17,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
15,
97
],
[
97,
98
],
[
330,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
121,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
130,
133
],
[
130,
134
],
[
130,
135
],
[
109,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
142,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
153,
154
],
[
148,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
157,
160
],
[
157,
161
],
[
157,
162
],
[
136,
163
],
[
163,
164
],
[
164,
165
],
[
99,
166
],
[
166,
167
],
[
99,
168
],
[
168,
169
],
[
99,
170
],
[
170,
171
],
[
99,
172
],
[
172,
173
],
[
330,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
174,
181
],
[
181,
182
],
[
181,
183
],
[
174,
185
],
[
185,
186
],
[
185,
187
],
[
174,
188
],
[
188,
189
],
[
188,
190
],
[
174,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
194,
198
],
[
198,
199
],
[
199,
200
],
[
194,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
205,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
216,
217
],
[
215,
218
],
[
201,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
219,
223
],
[
223,
224
],
[
224,
225
],
[
193,
226
],
[
226,
227
],
[
174,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
231,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
231,
239
],
[
239,
240
],
[
240,
241
],
[
174,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
246,
250
],
[
250,
251
],
[
250,
252
],
[
242,
253
],
[
253,
254
],
[
174,
255
],
[
255,
256
],
[
255,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
259,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
265,
267
],
[
258,
268
],
[
268,
269
],
[
174,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
273,
274
],
[
272,
275
],
[
275,
276
],
[
276,
277
],
[
174,
278
],
[
278,
279
],
[
278,
280
],
[
280,
281
],
[
281,
282
],
[
282,
283
],
[
283,
284
],
[
281,
285
],
[
285,
286
],
[
280,
287
],
[
287,
288
],
[
287,
289
],
[
280,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
280,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
298,
299
],
[
299,
300
],
[
300,
301
],
[
299,
302
],
[
298,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
280,
307
],
[
307,
308
],
[
308,
309
],
[
309,
310
],
[
174,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
316,
317
],
[
315,
318
],
[
318,
319
],
[
174,
320
],
[
320,
321
],
[
320,
322
],
[
322,
323
],
[
323,
324
],
[
324,
325
],
[
325,
326
],
[
324,
327
],
[
327,
328
],
[
0,
329
],
[
329,
330
],
[
329,
331
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\t\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint q = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\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\tstatic boolean binarySearch(int[] S, int T, int a, int b) {\n\t\tint c = (a + b) / 2;\n\t\tif(T < S[c]) {\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tstatic class FastScanner {\n\t private final InputStream in = System.in;\n\t private final byte[] buffer = new byte[1024];\n\t private int ptr = 0;\n\t private int buflen = 0;\n\t private boolean hasNextByte() {\n\t if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\t private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\t private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t public boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t public String next() {\n\t if (!hasNext()) throw new NoSuchElementException();\n\t StringBuilder sb = new StringBuilder();\n\t int b = readByte();\n\t while(isPrintableChar(b)) {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return sb.toString();\n\t }\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\t public int nextInt(){\n\t \treturn Integer.parseInt(next());\n\t }\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"public class Main {\n\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\t\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint q = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\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\tstatic boolean binarySearch(int[] S, int T, int a, int b) {\n\t\tint c = (a + b) / 2;\n\t\tif(T < S[c]) {\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tstatic class FastScanner {\n\t private final InputStream in = System.in;\n\t private final byte[] buffer = new byte[1024];\n\t private int ptr = 0;\n\t private int buflen = 0;\n\t private boolean hasNextByte() {\n\t if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\t private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\t private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t public boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t public String next() {\n\t if (!hasNext()) throw new NoSuchElementException();\n\t StringBuilder sb = new StringBuilder();\n\t int b = readByte();\n\t while(isPrintableChar(b)) {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return sb.toString();\n\t }\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\t public int nextInt(){\n\t \treturn Integer.parseInt(next());\n\t }\n\t}\n}",
"Main",
"private static FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"public static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\t\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint q = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\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\tint n = sc.nextInt();\n\t\t\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint q = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t}",
"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 cnt = 0;",
"cnt",
"0",
"for(int i=0; i<q; i++) {\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\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\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"int T = sc.nextInt();",
"T",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a = 0;",
"a",
"0",
"int b = n-1;",
"b",
"n-1",
"n",
"1",
"if(binarySearch(S, T, a, b)) {\n\t\t\t\tcnt++;\n\t\t\t}",
"binarySearch(S, T, a, b)",
"binarySearch",
"S",
"T",
"a",
"b",
"{\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[] S, int T, int a, int b) {\n\t\tint c = (a + b) / 2;\n\t\tif(T < S[c]) {\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}",
"binarySearch",
"{\n\t\tint c = (a + b) / 2;\n\t\tif(T < S[c]) {\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}",
"int c = (a + b) / 2;",
"c",
"(a + b) / 2",
"(a + b)",
"a",
"b",
"2",
"if(T < S[c]) {\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}",
"T < S[c]",
"T",
"S[c]",
"S",
"c",
"{\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t}",
"b = c - 1",
"b",
"c - 1",
"c",
"1",
"if(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}",
"b < a",
"b",
"a",
"{\n\t\t\t\treturn false;\n\t\t\t}",
"return false;",
"false",
"{\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}",
"return binarySearch(S, T, a, b);",
"binarySearch(S, T, a, b)",
"binarySearch",
"S",
"T",
"a",
"b",
"if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}",
"T > S[c]",
"T",
"S[c]",
"S",
"c",
"{\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t}",
"a = c + 1",
"a",
"c + 1",
"c",
"1",
"if(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}",
"b < a",
"b",
"a",
"{\n\t\t\t\treturn false;\n\t\t\t}",
"return false;",
"false",
"{\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}",
"return binarySearch(S, T, a, b);",
"binarySearch(S, T, a, b)",
"binarySearch",
"S",
"T",
"a",
"b",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"int[] S",
"S",
"int T",
"T",
"int a",
"a",
"int b",
"b",
"static class FastScanner {\n\t private final InputStream in = System.in;\n\t private final byte[] buffer = new byte[1024];\n\t private int ptr = 0;\n\t private int buflen = 0;\n\t private boolean hasNextByte() {\n\t if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\t private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\t private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t public boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t public String next() {\n\t if (!hasNext()) throw new NoSuchElementException();\n\t StringBuilder sb = new StringBuilder();\n\t int b = readByte();\n\t while(isPrintableChar(b)) {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return sb.toString();\n\t }\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\t public int nextInt(){\n\t \treturn Integer.parseInt(next());\n\t }\n\t}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n\t if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }",
"hasNextByte",
"{\n\t if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }",
"if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }",
"ptr < buflen",
"ptr",
"buflen",
"{\n\t return true;\n\t }",
"return true;",
"true",
"{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }",
"ptr = 0",
"ptr",
"0",
"try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }",
"catch (IOException e) {\n\t e.printStackTrace();\n\t }",
"IOException e",
"{\n\t e.printStackTrace();\n\t }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t buflen = in.read(buffer);\n\t }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n\t return false;\n\t }",
"buflen <= 0",
"buflen",
"0",
"{\n\t return false;\n\t }",
"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",
"private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}",
"skipUnprintable",
"{ while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}",
"while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"public boolean hasNext() { skipUnprintable(); return hasNextByte();}",
"hasNext",
"{ skipUnprintable(); return hasNextByte();}",
"skipUnprintable()",
"skipUnprintable",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t if (!hasNext()) throw new NoSuchElementException();\n\t StringBuilder sb = new StringBuilder();\n\t int b = readByte();\n\t while(isPrintableChar(b)) {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return sb.toString();\n\t }",
"next",
"{\n\t if (!hasNext()) throw new NoSuchElementException();\n\t StringBuilder sb = new StringBuilder();\n\t int b = readByte();\n\t while(isPrintableChar(b)) {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return 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 sb.appendCodePoint(b);\n\t b = readByte();\n\t }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\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 return Long.parseLong(next());\n\t }",
"nextLong",
"{\n\t return Long.parseLong(next());\n\t }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public int nextInt(){\n\t \treturn Integer.parseInt(next());\n\t }",
"nextInt",
"{\n\t \treturn Integer.parseInt(next());\n\t }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public class Main {\n\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\t\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint q = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\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\tstatic boolean binarySearch(int[] S, int T, int a, int b) {\n\t\tint c = (a + b) / 2;\n\t\tif(T < S[c]) {\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tstatic class FastScanner {\n\t private final InputStream in = System.in;\n\t private final byte[] buffer = new byte[1024];\n\t private int ptr = 0;\n\t private int buflen = 0;\n\t private boolean hasNextByte() {\n\t if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\t private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\t private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t public boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t public String next() {\n\t if (!hasNext()) throw new NoSuchElementException();\n\t StringBuilder sb = new StringBuilder();\n\t int b = readByte();\n\t while(isPrintableChar(b)) {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return sb.toString();\n\t }\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\t public int nextInt(){\n\t \treturn Integer.parseInt(next());\n\t }\n\t}\n}",
"public class Main {\n\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\t\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint q = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint T = sc.nextInt();\n\t\t\t\n\t\t\tint a = 0;\n\t\t\tint b = n-1;\n\t\t\tif(binarySearch(S, T, a, b)) {\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\tstatic boolean binarySearch(int[] S, int T, int a, int b) {\n\t\tint c = (a + b) / 2;\n\t\tif(T < S[c]) {\n\t\t\tb = c - 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else if(T > S[c]) {\n\t\t\ta = c + 1;\n\t\t\tif(b < a) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn binarySearch(S, T, a, b);\n\t\t\t}\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tstatic class FastScanner {\n\t private final InputStream in = System.in;\n\t private final byte[] buffer = new byte[1024];\n\t private int ptr = 0;\n\t private int buflen = 0;\n\t private boolean hasNextByte() {\n\t if (ptr < buflen) {\n\t return true;\n\t }else{\n\t ptr = 0;\n\t try {\n\t buflen = in.read(buffer);\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t if (buflen <= 0) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\t private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\t private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t public boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t public String next() {\n\t if (!hasNext()) throw new NoSuchElementException();\n\t StringBuilder sb = new StringBuilder();\n\t int b = readByte();\n\t while(isPrintableChar(b)) {\n\t sb.appendCodePoint(b);\n\t b = readByte();\n\t }\n\t return sb.toString();\n\t }\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\t public int nextInt(){\n\t \treturn Integer.parseInt(next());\n\t }\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
public class Main {
private static FastScanner sc = new FastScanner();
public static void main(String[] args) {
int n = sc.nextInt();
int[] S = new int[n];
for(int i=0; i<n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int cnt = 0;
for(int i=0; i<q; i++) {
int T = sc.nextInt();
int a = 0;
int b = n-1;
if(binarySearch(S, T, a, b)) {
cnt++;
}
}
System.out.println(cnt);
}
static boolean binarySearch(int[] S, int T, int a, int b) {
int c = (a + b) / 2;
if(T < S[c]) {
b = c - 1;
if(b < a) {
return false;
} else {
return binarySearch(S, T, a, b);
}
} else if(T > S[c]) {
a = c + 1;
if(b < a) {
return false;
} else {
return binarySearch(S, T, a, b);
}
} else {
return true;
}
}
static 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;}
private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
public boolean hasNext() { skipUnprintable(); return hasNextByte();}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while(isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt(){
return Integer.parseInt(next());
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
40,
17,
41,
13,
18,
13,
13,
42,
2,
4,
18,
13,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
14,
2,
18,
13,
13,
13,
40,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
169,
17
],
[
169,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
23,
25
],
[
20,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
28,
30
],
[
20,
31
],
[
31,
32
],
[
31,
33
],
[
20,
34
],
[
34,
35
],
[
34,
36
],
[
20,
37
],
[
37,
38
],
[
37,
39
],
[
20,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
40,
44
],
[
40,
45
],
[
20,
46
],
[
46,
47
],
[
47,
48
],
[
18,
49
],
[
49,
50
],
[
169,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
55,
61
],
[
61,
62
],
[
61,
63
],
[
55,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
55,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
55,
89
],
[
89,
90
],
[
89,
91
],
[
55,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
92,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
104,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
104,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
104,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
124,
125
],
[
124,
126
],
[
120,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
136,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
136,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
104,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
150,
156
],
[
156,
157
],
[
55,
158
],
[
158,
159
],
[
159,
160
],
[
158,
161
],
[
53,
162
],
[
162,
163
],
[
53,
164
],
[
164,
165
],
[
53,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author silviase\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n binarySearch solver = new binarySearch();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class binarySearch {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nextInt();\n int q = in.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }\n out.println(cnt);\n }\n\n }\n}\n\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n binarySearch solver = new binarySearch();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class binarySearch {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nextInt();\n int q = in.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }\n out.println(cnt);\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n binarySearch solver = new binarySearch();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n binarySearch solver = new binarySearch();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"Scanner in = new Scanner(inputStream);",
"in",
"new Scanner(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"binarySearch solver = new binarySearch();",
"solver",
"new binarySearch()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class binarySearch {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nextInt();\n int q = in.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }\n out.println(cnt);\n }\n\n }",
"binarySearch",
"public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nextInt();\n int q = in.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }\n out.println(cnt);\n }",
"solve",
"{\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nextInt();\n int q = in.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }\n out.println(cnt);\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) a[i] = in.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = in.nextInt();",
"a[i] = in.nextInt()",
"a[i]",
"a",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }",
"{\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }",
"int key = in.nextInt();",
"key",
"in.nextInt()",
"in.nextInt",
"in",
"int ng = -1;",
"ng",
"-1",
"1",
"int ok = a.length;",
"ok",
"a.length",
"a",
"a.length",
"while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }",
"Math.abs(ok - ng) > 1",
"Math.abs(ok - ng)",
"Math.abs",
"Math",
"ok - ng",
"ok",
"ng",
"1",
"{\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }",
"int mid = (ok + ng) / 2;",
"mid",
"(ok + ng) / 2",
"(ok + ng)",
"ok",
"ng",
"2",
"if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }",
"a[mid] >= key",
"a[mid]",
"a",
"mid",
"key",
"{\n ok = mid;\n }",
"ok = mid",
"ok",
"mid",
"{\n ng = mid;\n }",
"ng = mid",
"ng",
"mid",
"if (a[ok] == key) cnt++;",
"a[ok] == key",
"a[ok]",
"a",
"ok",
"key",
"cnt++",
"cnt",
"out.println(cnt)",
"out.println",
"out",
"cnt",
"int testNumber",
"testNumber",
"Scanner in",
"in",
"PrintWriter out",
"out",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n binarySearch solver = new binarySearch();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class binarySearch {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nextInt();\n int q = in.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }\n out.println(cnt);\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n binarySearch solver = new binarySearch();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class binarySearch {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nextInt();\n int q = in.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n int ng = -1;\n int ok = a.length;\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n if (a[mid] >= key) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n if (a[ok] == key) cnt++;\n }\n out.println(cnt);\n }\n\n }\n}",
"Main"
] | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author silviase
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Scanner in = new Scanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
binarySearch solver = new binarySearch();
solver.solve(1, in, out);
out.close();
}
static class binarySearch {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = in.nextInt();
int q = in.nextInt();
int cnt = 0;
for (int i = 0; i < q; i++) {
int key = in.nextInt();
int ng = -1;
int ok = a.length;
while (Math.abs(ok - ng) > 1) {
int mid = (ok + ng) / 2;
if (a[mid] >= key) {
ok = mid;
} else {
ng = mid;
}
}
if (a[ok] == key) cnt++;
}
out.println(cnt);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
20,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
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,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
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,
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
],
[
221,
14
],
[
221,
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
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
17,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
17,
40
],
[
40,
41
],
[
40,
42
],
[
17,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
17,
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
],
[
17,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
17,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
17,
84
],
[
84,
85
],
[
84,
86
],
[
17,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
17,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
17,
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
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
119,
121
],
[
17,
122
],
[
122,
123
],
[
122,
124
],
[
17,
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
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
137,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
137,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
163,
165
],
[
158,
166
],
[
166,
167
],
[
167,
168
],
[
166,
169
],
[
158,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
175,
176
],
[
175,
177
],
[
170,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
181,
183
],
[
178,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
170,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
192,
196
],
[
196,
197
],
[
196,
198
],
[
191,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
202,
204
],
[
199,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
207,
211
],
[
17,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
212,
217
],
[
15,
218
],
[
218,
219
],
[
0,
220
],
[
220,
221
],
[
220,
222
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString s = in.readLine();\n\t\tint n = Integer.parseInt(s);\n\t\ts = in.readLine();\n\t\tint[] a = new int[n];\n\t\tString[] as = s.split(\" \");\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\ts = in.readLine();\n\t\tint q = Integer.parseInt(s);\n\t\tint[] t = new int[q];\n\t\ts = in.readLine();\n\t\tas = s.split(\" \");\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\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.nio.charset.StandardCharsets;",
"StandardCharsets",
"java.nio.charset",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString s = in.readLine();\n\t\tint n = Integer.parseInt(s);\n\t\ts = in.readLine();\n\t\tint[] a = new int[n];\n\t\tString[] as = s.split(\" \");\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\ts = in.readLine();\n\t\tint q = Integer.parseInt(s);\n\t\tint[] t = new int[q];\n\t\ts = in.readLine();\n\t\tas = s.split(\" \");\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\t\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString s = in.readLine();\n\t\tint n = Integer.parseInt(s);\n\t\ts = in.readLine();\n\t\tint[] a = new int[n];\n\t\tString[] as = s.split(\" \");\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\ts = in.readLine();\n\t\tint q = Integer.parseInt(s);\n\t\tint[] t = new int[q];\n\t\ts = in.readLine();\n\t\tas = s.split(\" \");\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString s = in.readLine();\n\t\tint n = Integer.parseInt(s);\n\t\ts = in.readLine();\n\t\tint[] a = new int[n];\n\t\tString[] as = s.split(\" \");\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\ts = in.readLine();\n\t\tint q = Integer.parseInt(s);\n\t\tint[] t = new int[q];\n\t\ts = in.readLine();\n\t\tas = s.split(\" \");\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);",
"reader",
"new InputStreamReader(System.in, StandardCharsets.UTF_8)",
"BufferedReader in = new BufferedReader(reader);",
"in",
"new BufferedReader(reader)",
"String s = in.readLine();",
"s",
"in.readLine()",
"in.readLine",
"in",
"int n = Integer.parseInt(s);",
"n",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"s = in.readLine()",
"s",
"in.readLine()",
"in.readLine",
"in",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"String[] as = s.split(\" \");",
"as",
"s.split(\" \")",
"s.split",
"s",
"\" \"",
"for(int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(as[i]);\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(as[i]);\n\t\t}",
"{\n\t\t\ta[i] = Integer.parseInt(as[i]);\n\t\t}",
"a[i] = Integer.parseInt(as[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(as[i])",
"Integer.parseInt",
"Integer",
"as[i]",
"as",
"i",
"s = in.readLine()",
"s",
"in.readLine()",
"in.readLine",
"in",
"int q = Integer.parseInt(s);",
"q",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"s = in.readLine()",
"s",
"in.readLine()",
"in.readLine",
"in",
"as = s.split(\" \")",
"as",
"s.split(\" \")",
"s.split",
"s",
"\" \"",
"for(int i = 0; i < q; i++) {\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}",
"{\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}",
"t[i] = Integer.parseInt(as[i])",
"t[i]",
"t",
"i",
"Integer.parseInt(as[i])",
"Integer.parseInt",
"Integer",
"as[i]",
"as",
"i",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\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 left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int left = 0;",
"left",
"0",
"int right = n-1;",
"right",
"n-1",
"n",
"1",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"while (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}",
"left <= right",
"left",
"right",
"{\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}",
"if(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"a[mid] == t[i]",
"a[mid]",
"a",
"mid",
"t[i]",
"t",
"i",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"a[mid] < t[i]",
"a[mid]",
"a",
"mid",
"t[i]",
"t",
"i",
"{\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t}",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"a[mid] > t[i]",
"a[mid]",
"a",
"mid",
"t[i]",
"t",
"i",
"{\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"right = mid-1",
"right",
"mid-1",
"mid",
"1",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"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\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString s = in.readLine();\n\t\tint n = Integer.parseInt(s);\n\t\ts = in.readLine();\n\t\tint[] a = new int[n];\n\t\tString[] as = s.split(\" \");\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\ts = in.readLine();\n\t\tint q = Integer.parseInt(s);\n\t\tint[] t = new int[q];\n\t\ts = in.readLine();\n\t\tas = s.split(\" \");\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\t\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString s = in.readLine();\n\t\tint n = Integer.parseInt(s);\n\t\ts = in.readLine();\n\t\tint[] a = new int[n];\n\t\tString[] as = s.split(\" \");\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\ts = in.readLine();\n\t\tint q = Integer.parseInt(s);\n\t\tint[] t = new int[q];\n\t\ts = in.readLine();\n\t\tas = s.split(\" \");\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tt[i] = Integer.parseInt(as[i]);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n-1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile (left <= right) {\n\n\t\t\t\tif(a[mid] == t[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(a[mid] < t[i]) {\n\t\t\t\t\t left = mid+1;\n\t\t\t\t\t mid = (left + right) / 2;\n\t\t\t\t} else if(a[mid] > t[i]) {\n\t\t\t\t\tright = mid-1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\t\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
BufferedReader in = new BufferedReader(reader);
String s = in.readLine();
int n = Integer.parseInt(s);
s = in.readLine();
int[] a = new int[n];
String[] as = s.split(" ");
for(int i = 0; i < n; i++) {
a[i] = Integer.parseInt(as[i]);
}
s = in.readLine();
int q = Integer.parseInt(s);
int[] t = new int[q];
s = in.readLine();
as = s.split(" ");
for(int i = 0; i < q; i++) {
t[i] = Integer.parseInt(as[i]);
}
int count = 0;
for(int i = 0; i < q; i++) {
int left = 0;
int right = n-1;
int mid = (left + right) / 2;
while (left <= right) {
if(a[mid] == t[i]) {
count++;
break;
} else if(a[mid] < t[i]) {
left = mid+1;
mid = (left + right) / 2;
} else if(a[mid] > t[i]) {
right = mid-1;
mid = (left + right) / 2;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
41,
13,
17,
2,
2,
13,
13,
2,
13,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
40,
13,
40,
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
],
[
142,
8
],
[
142,
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
],
[
78,
79
],
[
77,
80
],
[
11,
81
],
[
81,
82
],
[
81,
83
],
[
11,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
84,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
101,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
120,
125
],
[
125,
126
],
[
112,
127
],
[
127,
128
],
[
128,
129
],
[
11,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
11,
136
],
[
136,
137
],
[
137,
138
],
[
9,
139
],
[
139,
140
],
[
0,
141
],
[
141,
142
],
[
141,
143
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n \tfor (int i = 0; i < n; i++) {\n \t\ts[i] = sc.nextInt();\n \t}\n\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n \tfor (int i = 0; i < q; i++) {\n \t\tt[i] = sc.nextInt();\n \t}\n\n \tArrays.sort(s);\n \tArrays.sort(t);\n \t\n \tint count = 0;\n \tfor (int i = 0, key = 0; i < n && key < q;) {\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}\n\t\t\n \tSystem.out.println(count);\n\n \tsc.close();\n\t}\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n \tfor (int i = 0; i < n; i++) {\n \t\ts[i] = sc.nextInt();\n \t}\n\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n \tfor (int i = 0; i < q; i++) {\n \t\tt[i] = sc.nextInt();\n \t}\n\n \tArrays.sort(s);\n \tArrays.sort(t);\n \t\n \tint count = 0;\n \tfor (int i = 0, key = 0; i < n && key < q;) {\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}\n\t\t\n \tSystem.out.println(count);\n\n \tsc.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n \tfor (int i = 0; i < n; i++) {\n \t\ts[i] = sc.nextInt();\n \t}\n\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n \tfor (int i = 0; i < q; i++) {\n \t\tt[i] = sc.nextInt();\n \t}\n\n \tArrays.sort(s);\n \tArrays.sort(t);\n \t\n \tint count = 0;\n \tfor (int i = 0, key = 0; i < n && key < q;) {\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}\n\t\t\n \tSystem.out.println(count);\n\n \tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n \tfor (int i = 0; i < n; i++) {\n \t\ts[i] = sc.nextInt();\n \t}\n\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n \tfor (int i = 0; i < q; i++) {\n \t\tt[i] = sc.nextInt();\n \t}\n\n \tArrays.sort(s);\n \tArrays.sort(t);\n \t\n \tint count = 0;\n \tfor (int i = 0, key = 0; i < n && key < q;) {\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}\n\t\t\n \tSystem.out.println(count);\n\n \tsc.close();\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\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",
"Arrays.sort(s)",
"Arrays.sort",
"Arrays",
"s",
"Arrays.sort(t)",
"Arrays.sort",
"Arrays",
"t",
"int count = 0;",
"count",
"0",
"for (int i = 0, key = 0; i < n && key < q;) {\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}",
"int i = 0, key = 0;",
"int i = 0",
"i",
"0",
"key = 0;",
"key",
"0",
"i < n && key < q",
"i < n",
"i",
"n",
"key < q",
"key",
"q",
"{\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}",
"{\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}",
"if (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}",
"s[i] < t[key]",
"s[i]",
"s",
"i",
"t[key]",
"t",
"key",
"{\n \t\t\ti++;\n \t\t}",
"i++",
"i",
"if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}",
"s[i] == t[key]",
"s[i]",
"s",
"i",
"t[key]",
"t",
"key",
"{\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t}",
"count++",
"count",
"i++",
"i",
"key++",
"key",
"{\n \t\t\tkey++;\n \t\t}",
"key++",
"key",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n \tfor (int i = 0; i < n; i++) {\n \t\ts[i] = sc.nextInt();\n \t}\n\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n \tfor (int i = 0; i < q; i++) {\n \t\tt[i] = sc.nextInt();\n \t}\n\n \tArrays.sort(s);\n \tArrays.sort(t);\n \t\n \tint count = 0;\n \tfor (int i = 0, key = 0; i < n && key < q;) {\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}\n\t\t\n \tSystem.out.println(count);\n\n \tsc.close();\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n \tfor (int i = 0; i < n; i++) {\n \t\ts[i] = sc.nextInt();\n \t}\n\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n \tfor (int i = 0; i < q; i++) {\n \t\tt[i] = sc.nextInt();\n \t}\n\n \tArrays.sort(s);\n \tArrays.sort(t);\n \t\n \tint count = 0;\n \tfor (int i = 0, key = 0; i < n && key < q;) {\n \t\tif (s[i] < t[key]) {\n \t\t\ti++;\n \t\t} else if (s[i] == t[key]) {\n \t\t\tcount++;\n \t\t\ti++;\n \t\t\tkey++;\n// \t\t\tSystem.out.println(s[i]);\n \t\t} else {\n \t\t\tkey++;\n \t\t}\n \t}\n\t\t\n \tSystem.out.println(count);\n\n \tsc.close();\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();
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = sc.nextInt();
}
Arrays.sort(s);
Arrays.sort(t);
int count = 0;
for (int i = 0, key = 0; i < n && key < q;) {
if (s[i] < t[key]) {
i++;
} else if (s[i] == t[key]) {
count++;
i++;
key++;
// System.out.println(s[i]);
} else {
key++;
}
}
System.out.println(count);
sc.close();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
40,
17,
41,
13,
13,
42,
2,
4,
18,
13,
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
],
[
120,
5
],
[
120,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
61,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
61,
71
],
[
71,
72
],
[
71,
73
],
[
61,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
75,
82
],
[
74,
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
],
[
97,
99
],
[
91,
100
],
[
100,
101
],
[
100,
102
],
[
61,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
103,
109
],
[
109,
110
],
[
8,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
6,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
] | [
"import java.util.*;\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 a[] = new int[114514];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}\n\n",
"import java.util.*;",
"util.*",
"java",
"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 a[] = new int[114514];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\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 a[] = new int[114514];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint a[] = new int[114514];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int a[] = new int[114514];",
"a",
"new int[114514]",
"114514",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = scan.nextInt();\n\t\t}",
"a[i] = scan.nextInt()",
"a[i]",
"a",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int ans = 0;",
"ans",
"0",
"for (int i=0; i<q; i++) {\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}",
"{\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}",
"int key = scan.nextInt();",
"key",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int ng = -1;",
"ng",
"-1",
"1",
"int ok = n;",
"ok",
"n",
"while (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}",
"Math.abs(ok-ng) > 1",
"Math.abs(ok-ng)",
"Math.abs",
"Math",
"ok-ng",
"ok",
"ng",
"1",
"{\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}",
"int mid = (ok+ng)/2;",
"mid",
"(ok+ng)/2",
"(ok+ng)",
"ok",
"ng",
"2",
"if (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;",
"a[mid] >= key",
"a[mid]",
"a",
"mid",
"key",
"ok = mid",
"ok",
"mid",
"ng = mid",
"ng",
"mid",
"if (a[ok]==key) ans++;",
"a[ok]==key",
"a[ok]",
"a",
"ok",
"key",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint a[] = new int[114514];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint a[] = new int[114514];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = scan.nextInt();\n\t\t\tint ng = -1; int ok = n;\n\t\t\twhile (Math.abs(ok-ng) > 1) {\n\t\t\t\tint mid = (ok+ng)/2;\n\t\t\t\tif (a[mid] >= key) ok = mid;\n\t\t\t\telse ng = mid;\n\t\t\t}\n\t\t\tif (a[ok]==key) ans++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int a[] = new int[114514];
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
}
int q = scan.nextInt();
int ans = 0;
for (int i=0; i<q; i++) {
int key = scan.nextInt();
int ng = -1; int ok = n;
while (Math.abs(ok-ng) > 1) {
int mid = (ok+ng)/2;
if (a[mid] >= key) ok = mid;
else ng = mid;
}
if (a[ok]==key) ans++;
}
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,
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,
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,
3,
30,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
150,
5
],
[
150,
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
],
[
86,
87
],
[
86,
88
],
[
83,
89
],
[
89,
90
],
[
89,
91
],
[
83,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
83,
97
],
[
97,
98
],
[
83,
99
],
[
99,
100
],
[
99,
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
],
[
115,
118
],
[
109,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
119,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
125,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
125,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
8,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
6,
147
],
[
147,
148
],
[
0,
149
],
[
149,
150
],
[
149,
151
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tint C = 0;\n\t\tScanner in = new Scanner(System.in);\n\t\t//??°???S?????????\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\t//??°???T?????????\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\t\n\t\n\t\tfor(int i = 0;i<q;i++){\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\tpublic static void main(String[] args) {\n\t\tint C = 0;\n\t\tScanner in = new Scanner(System.in);\n\t\t//??°???S?????????\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\t//??°???T?????????\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\t\n\t\n\t\tfor(int i = 0;i<q;i++){\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tint C = 0;\n\t\tScanner in = new Scanner(System.in);\n\t\t//??°???S?????????\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\t//??°???T?????????\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\t\n\t\n\t\tfor(int i = 0;i<q;i++){\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}",
"main",
"{\n\t\tint C = 0;\n\t\tScanner in = new Scanner(System.in);\n\t\t//??°???S?????????\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\t//??°???T?????????\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\t\n\t\n\t\tfor(int i = 0;i<q;i++){\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}",
"int C = 0;",
"C",
"0",
"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;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",
"for(int i = 0;i<q;i++){\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\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 searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"{\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"int searchkey = T[i];",
"searchkey",
"T[i]",
"T",
"i",
"int lowerBound = 0;",
"lowerBound",
"0",
"int upperBound = n-1;",
"upperBound",
"n-1",
"n",
"1",
"int curIn;",
"curIn",
"while(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"true",
"{\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"curIn = (lowerBound+upperBound)/2",
"curIn",
"(lowerBound+upperBound)/2",
"(lowerBound+upperBound)",
"lowerBound",
"upperBound",
"2",
"if(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}",
"S[curIn] == searchkey",
"S[curIn]",
"S",
"curIn",
"searchkey",
"{\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"C++",
"C",
"break;",
"if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}",
"lowerBound>upperBound",
"lowerBound",
"upperBound",
"break;",
"{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}",
"if(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;",
"S[curIn]<searchkey",
"S[curIn]",
"S",
"curIn",
"searchkey",
"lowerBound = curIn +1",
"lowerBound",
"curIn +1",
"curIn",
"1",
"upperBound = curIn -1",
"upperBound",
"curIn -1",
"curIn",
"1",
"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\tint C = 0;\n\t\tScanner in = new Scanner(System.in);\n\t\t//??°???S?????????\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\t//??°???T?????????\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\t\n\t\n\t\tfor(int i = 0;i<q;i++){\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args) {\n\t\tint C = 0;\n\t\tScanner in = new Scanner(System.in);\n\t\t//??°???S?????????\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\t//??°???T?????????\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\t\n\t\n\t\tfor(int i = 0;i<q;i++){\n\t\t\tint searchkey = T[i];\n\t\t\tint lowerBound = 0;\n\t\t\tint upperBound = n-1;\n\t\t\tint curIn;\n\t\t\twhile(true){\n\t\t\t\tcurIn = (lowerBound+upperBound)/2;\n\t\t\t\tif(S[curIn] == searchkey) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(lowerBound>upperBound) break;\n\t\t\t\telse{\n\t\t\t\t\tif(S[curIn]<searchkey)\n\t\t\t\t\t\tlowerBound = curIn +1;\n\t\t\t\t\telse\n\t\t\t\t\t\tupperBound = curIn -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
int C = 0;
Scanner in = new Scanner(System.in);
//??°???S?????????
int n = in.nextInt();
int[] S = new int[n];
for(int i = 0;i<n;i++) S[i] = in.nextInt();
//??°???T?????????
int q = in.nextInt();
int[] T = new int[q];
for(int i = 0;i<q;i++) T[i] = in.nextInt();
for(int i = 0;i<q;i++){
int searchkey = T[i];
int lowerBound = 0;
int upperBound = n-1;
int curIn;
while(true){
curIn = (lowerBound+upperBound)/2;
if(S[curIn] == searchkey) {
C++;
break;
}else if(lowerBound>upperBound) break;
else{
if(S[curIn]<searchkey)
lowerBound = curIn +1;
else
upperBound = curIn -1;
}
}
}
System.out.println(C);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
2,
13,
17,
41,
13,
17,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
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,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
138,
5
],
[
138,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
61,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
61,
72
],
[
72,
73
],
[
72,
74
],
[
61,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
61,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
87,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
97,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
97,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
116,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
8,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
6,
135
],
[
135,
136
],
[
0,
137
],
[
137,
138
],
[
137,
139
]
] | [
"import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<p; i++){\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\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 = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<p; i++){\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<p; i++){\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\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\tint[] s = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<p; i++){\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int 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 p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"for(int i=0; i<p; i++){\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\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\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int upp = n - 1;",
"upp",
"n - 1",
"n",
"1",
"int low = 0;",
"low",
"0",
"int mid = (upp + low) / 2;",
"mid",
"(upp + low) / 2",
"(upp + low)",
"upp",
"low",
"2",
"while(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}",
"low<=upp",
"low",
"upp",
"{\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}",
"if(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}",
"s[mid]==q",
"s[mid]",
"s",
"mid",
"q",
"{\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans++",
"ans",
"break;",
"if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}",
"s[mid]<q",
"s[mid]",
"s",
"mid",
"q",
"{\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}",
"low = mid + 1",
"low",
"mid + 1",
"mid",
"1",
"mid = (low + upp) / 2",
"mid",
"(low + upp) / 2",
"(low + upp)",
"low",
"upp",
"2",
"{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}",
"upp = mid - 1",
"upp",
"mid - 1",
"mid",
"1",
"mid = (low + upp) / 2",
"mid",
"(low + upp) / 2",
"(low + upp)",
"low",
"upp",
"2",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<p; i++){\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i=0; i<p; i++){\n\t\t\tint q = sc.nextInt();\n\t\t\tint upp = n - 1;\n\t\t\tint low = 0;\n\t\t\tint mid = (upp + low) / 2;\n\t\t\twhile(low<=upp){\n\t\t\t\tif(s[mid]==q){\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<q){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tupp = mid - 1;\n\t\t\t\t\tmid = (low + upp) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\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 p = sc.nextInt();
int ans = 0;
for(int i=0; i<p; i++){
int q = sc.nextInt();
int upp = n - 1;
int low = 0;
int mid = (upp + low) / 2;
while(low<=upp){
if(s[mid]==q){
ans++;
break;
}
else if(s[mid]<q){
low = mid + 1;
mid = (low + upp) / 2;
}
else{
upp = mid - 1;
mid = (low + upp) / 2;
}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
40,
17,
41,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
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,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
146,
5
],
[
146,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
109,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
126,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
121,
133
],
[
133,
134
],
[
134,
135
],
[
134,
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\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }\n System.out.println(c);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }\n System.out.println(c);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }\n System.out.println(c);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }\n System.out.println(c);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n }",
"{\n s[i] = sc.nextInt();\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] t = new int[n];",
"t",
"new int[n]",
"n",
"for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = sc.nextInt();\n }",
"{\n t[i] = sc.nextInt();\n }",
"t[i] = sc.nextInt()",
"t[i]",
"t",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int c = 0;",
"c",
"0",
"for (int i = 0; i < q; i++) {\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }",
"{\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }",
"int left = -1;",
"left",
"-1",
"1",
"int right = n;",
"right",
"n",
"while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }",
"right - left > 1",
"right - left",
"right",
"left",
"1",
"{\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }",
"int mid = left + (right - left) / 2;",
"mid",
"left + (right - left) / 2",
"left",
"(right - left) / 2",
"(right - left)",
"right",
"left",
"2",
"if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }",
"s[mid] == t[i]",
"s[mid]",
"s",
"mid",
"t[i]",
"t",
"i",
"{\n c++;\n break;\n }",
"c++",
"c",
"break;",
"if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }",
"s[mid] > t[i]",
"s[mid]",
"s",
"mid",
"t[i]",
"t",
"i",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid;\n }",
"left = mid",
"left",
"mid",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }\n System.out.println(c);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n // if (Arrays.binarySearch(s, t[i]) >= 0) {\n // c++;\n // }\n int left = -1;\n int right = n;\n while (right - left > 1) {\n int mid = left + (right - left) / 2;\n if (s[mid] == t[i]) {\n c++;\n break;\n } else if (s[mid] > t[i]) {\n right = mid;\n } else {\n left = mid;\n }\n }\n }\n System.out.println(c);\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[] t = new int[n];
for (int i = 0; i < q; i++) {
t[i] = sc.nextInt();
}
int c = 0;
for (int i = 0; i < q; i++) {
// if (Arrays.binarySearch(s, t[i]) >= 0) {
// c++;
// }
int left = -1;
int right = n;
while (right - left > 1) {
int mid = left + (right - left) / 2;
if (s[mid] == t[i]) {
c++;
break;
} else if (s[mid] > t[i]) {
right = mid;
} else {
left = mid;
}
}
}
System.out.println(c);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
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,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
123,
5
],
[
123,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
6,
12
],
[
12,
13
],
[
123,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
16,
25
],
[
25,
26
],
[
25,
27
],
[
16,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
16,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
16,
54
],
[
54,
55
],
[
54,
56
],
[
16,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
57,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
62,
68
],
[
68,
69
],
[
68,
70
],
[
62,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
62,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
88,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
88,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
100,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
16,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
0,
122
],
[
122,
123
],
[
122,
124
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tnew Main().run();\n\t}",
"main",
"{\n\t\tnew Main().run();\n\t}",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"private void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"run",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] num = new int[n];",
"num",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}",
"num[i] = scanner.nextInt()",
"num[i]",
"num",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int m = scanner.nextInt();",
"m",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int count = 0;",
"count",
"0",
"while (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"m-- > 0",
"m--",
"m",
"0",
"{\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int a = scanner.nextInt();",
"a",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int l = 0;",
"l",
"0",
"int r = n - 1;",
"r",
"n - 1",
"n",
"1",
"while (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"l <= r",
"l",
"r",
"{\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int mid = (l + r) / 2;",
"mid",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"num[mid] > a",
"num[mid]",
"num",
"mid",
"a",
"{\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t}",
"r = mid - 1",
"r",
"mid - 1",
"mid",
"1",
"if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"num[mid] < a",
"num[mid]",
"num",
"mid",
"a",
"{\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t}",
"l = mid + 1",
"l",
"mid + 1",
"mid",
"1",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tint l = 0;\n\t\t\tint r = n - 1;\n\t\t\twhile (l <= r) {\n\t\t\t\tint mid = (l + r) / 2;\n\t\t\t\tif (num[mid] > a) {\n\t\t\t\t\tr = mid - 1;\n\t\t\t\t} else if (num[mid] < a) {\n\t\t\t\t\tl = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
private void run() {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] num = new int[n];
for (int i = 0; i < n; i++) {
num[i] = scanner.nextInt();
}
int m = scanner.nextInt();
int count = 0;
while (m-- > 0) {
int a = scanner.nextInt();
int l = 0;
int r = n - 1;
while (l <= r) {
int mid = (l + r) / 2;
if (num[mid] > a) {
r = mid - 1;
} else if (num[mid] < a) {
l = mid + 1;
} else {
count++;
break;
}
}
}
System.out.println(count);
}
} |
[
7,
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,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
13,
13,
4,
18,
13,
4,
18,
13,
14,
2,
13,
40,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
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,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
154,
5
],
[
154,
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
],
[
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
73,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
81,
82
],
[
70,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
83,
88
],
[
88,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
6,
96
],
[
96,
97
],
[
154,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
100,
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
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
128,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
100,
144
],
[
144,
145
],
[
145,
146
],
[
98,
147
],
[
147,
148
],
[
98,
149
],
[
149,
150
],
[
98,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n int q = Integer.parseInt(sc.next());\n int c = 0;\n for(int i = 0; i < q; i++){\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }\n \n System.out.println(c);\n }\n \n static int binarySearch(int[] a, int n, int key){\n \n int left = 0;\n int right = n;\n \n while(left < right){\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return -1;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n int q = Integer.parseInt(sc.next());\n int c = 0;\n for(int i = 0; i < q; i++){\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }\n \n System.out.println(c);\n }\n \n static int binarySearch(int[] a, int n, int key){\n \n int left = 0;\n int right = n;\n \n while(left < right){\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return -1;\n }\n}",
"Main",
"public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n int q = Integer.parseInt(sc.next());\n int c = 0;\n for(int i = 0; i < q; i++){\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }\n \n System.out.println(c);\n }",
"main",
"{\n \n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n int q = Integer.parseInt(sc.next());\n int c = 0;\n for(int i = 0; i < q; i++){\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }\n \n System.out.println(c);\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",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n s[i] = Integer.parseInt(sc.next());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(sc.next());\n }",
"{\n s[i] = Integer.parseInt(sc.next());\n }",
"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 c = 0;",
"c",
"0",
"for(int i = 0; i < q; i++){\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }",
"{\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }",
"int x = binarySearch(s, n, Integer.parseInt(sc.next()));",
"x",
"binarySearch(s, n, Integer.parseInt(sc.next()))",
"binarySearch",
"s",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"if(x != -1) c++;",
"x != -1",
"x",
"-1",
"1",
"c++",
"c",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"static int binarySearch(int[] a, int n, int key){\n \n int left = 0;\n int right = n;\n \n while(left < right){\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return -1;\n }",
"binarySearch",
"{\n \n int left = 0;\n int right = n;\n \n while(left < right){\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return -1;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left < right){\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(a[mid] == key){\n return mid;\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 mid;\n }",
"return mid;",
"mid",
"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 -1;",
"-1",
"1",
"int[] a",
"a",
"int n",
"n",
"int key",
"key",
"public class Main {\n\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n int q = Integer.parseInt(sc.next());\n int c = 0;\n for(int i = 0; i < q; i++){\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }\n \n System.out.println(c);\n }\n \n static int binarySearch(int[] a, int n, int key){\n \n int left = 0;\n int right = n;\n \n while(left < right){\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return -1;\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n int q = Integer.parseInt(sc.next());\n int c = 0;\n for(int i = 0; i < q; i++){\n int x = binarySearch(s, n, Integer.parseInt(sc.next()));\n if(x != -1) c++;\n }\n \n System.out.println(c);\n }\n \n static int binarySearch(int[] a, int n, int key){\n \n int left = 0;\n int right = n;\n \n while(left < right){\n int mid = (left + right) / 2;\n if(a[mid] == key){\n return mid;\n }else if(key < a[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return -1;\n }\n}",
"Main"
] | 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());
int[] s = new int[n];
for(int i = 0; i < n; i++){
s[i] = Integer.parseInt(sc.next());
}
int q = Integer.parseInt(sc.next());
int c = 0;
for(int i = 0; i < q; i++){
int x = binarySearch(s, n, Integer.parseInt(sc.next()));
if(x != -1) c++;
}
System.out.println(c);
}
static int binarySearch(int[] a, int n, int key){
int left = 0;
int right = n;
while(left < right){
int mid = (left + right) / 2;
if(a[mid] == key){
return mid;
}else if(key < a[mid]){
right = mid;
}else{
left = mid + 1;
}
}
return -1;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
18,
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,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
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
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
8,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
8,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
8,
63
],
[
63,
64
],
[
63,
65
],
[
8,
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
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
99,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
125,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
112,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
137,
139
],
[
132,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
132,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
150,
152
],
[
145,
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;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint i, j,n,q,mid,left,right;\n\t\tint cnt=0;\n\t\tn = sc.nextInt();\n\t\tint [] S = new int [n];\n\t\tfor(i=0;i<n;i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint [] T = new int[q];\n\t\tfor(i=0;i<q;i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t for(i=0;i<q;i++){\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }\n\t\t\n\t 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\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint i, j,n,q,mid,left,right;\n\t\tint cnt=0;\n\t\tn = sc.nextInt();\n\t\tint [] S = new int [n];\n\t\tfor(i=0;i<n;i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint [] T = new int[q];\n\t\tfor(i=0;i<q;i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t for(i=0;i<q;i++){\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }\n\t\t\n\t System.out.println(cnt);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint i, j,n,q,mid,left,right;\n\t\tint cnt=0;\n\t\tn = sc.nextInt();\n\t\tint [] S = new int [n];\n\t\tfor(i=0;i<n;i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint [] T = new int[q];\n\t\tfor(i=0;i<q;i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t for(i=0;i<q;i++){\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }\n\t\t\n\t System.out.println(cnt);\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint i, j,n,q,mid,left,right;\n\t\tint cnt=0;\n\t\tn = sc.nextInt();\n\t\tint [] S = new int [n];\n\t\tfor(i=0;i<n;i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint [] T = new int[q];\n\t\tfor(i=0;i<q;i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t for(i=0;i<q;i++){\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }\n\t\t\n\t System.out.println(cnt);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int i",
"i",
"j",
"j",
"n",
"n",
"q",
"q",
"mid",
"mid",
"left",
"left",
"right;",
"right",
"int cnt=0;",
"cnt",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int [] S = new int [n];",
"S",
"new int [n]",
"n",
"for(i=0;i<n;i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int [] T = new int[q];",
"T",
"new int[q]",
"q",
"for(i=0;i<q;i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}",
"i=0;",
"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(i=0;i<q;i++){\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }",
"{\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }",
"left =0",
"left",
"0",
"right = S.length",
"right",
"S.length",
"S",
"S.length",
"while(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}",
"left < right",
"left",
"right",
"{\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}",
"mid = (left + right)/2",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }",
"T[i]==S[mid]",
"T[i]",
"T",
"i",
"S[mid]",
"S",
"mid",
"{\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }",
"cnt++",
"cnt",
"break;",
"if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;",
"T[i]>S[mid]",
"T[i]",
"T",
"i",
"S[mid]",
"S",
"mid",
"left = mid +1",
"left",
"mid +1",
"mid",
"1",
"if(T[i] < S[mid]) right = mid;",
"T[i] < S[mid]",
"T[i]",
"T",
"i",
"S[mid]",
"S",
"mid",
"right = mid",
"right",
"mid",
"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\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint i, j,n,q,mid,left,right;\n\t\tint cnt=0;\n\t\tn = sc.nextInt();\n\t\tint [] S = new int [n];\n\t\tfor(i=0;i<n;i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint [] T = new int[q];\n\t\tfor(i=0;i<q;i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t for(i=0;i<q;i++){\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }\n\t\t\n\t System.out.println(cnt);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint i, j,n,q,mid,left,right;\n\t\tint cnt=0;\n\t\tn = sc.nextInt();\n\t\tint [] S = new int [n];\n\t\tfor(i=0;i<n;i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tint [] T = new int[q];\n\t\tfor(i=0;i<q;i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t for(i=0;i<q;i++){\n\t \tleft =0;\n\t \tright = S.length;\n\t \twhile(left < right){\n\t \t\t mid = (left + right)/2;\n\t \t\t if(T[i]==S[mid]){\n\t \t\t\t cnt++;\n\t \t\t\t break;\n\t \t\t }\n\t \t\t if(T[i]>S[mid]) left = mid +1;\n\t \t\t else if(T[i] < S[mid]) right = mid;\n\t \t}\n\t }\n\t\t\n\t System.out.println(cnt);\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int i, j,n,q,mid,left,right;
int cnt=0;
n = sc.nextInt();
int [] S = new int [n];
for(i=0;i<n;i++){
S[i] = sc.nextInt();
}
q = sc.nextInt();
int [] T = new int[q];
for(i=0;i<q;i++){
T[i] = sc.nextInt();
}
for(i=0;i<q;i++){
left =0;
right = S.length;
while(left < right){
mid = (left + right)/2;
if(T[i]==S[mid]){
cnt++;
break;
}
if(T[i]>S[mid]) left = mid +1;
else if(T[i] < S[mid]) right = mid;
}
}
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,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
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,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
167,
5
],
[
167,
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
],
[
79,
81
],
[
79,
82
],
[
78,
83
],
[
83,
84
],
[
84,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
6,
92
],
[
92,
93
],
[
167,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
96,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
96,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
119,
125
],
[
125,
126
],
[
126,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
134,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
128,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
147,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
96,
160
],
[
160,
161
],
[
94,
162
],
[
162,
163
],
[
94,
164
],
[
164,
165
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n int q = in.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = in.nextInt();\n }\n\n int c = 0;\n for (int i : t) {\n if (binarySearch(s, i)) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n private static boolean binarySearch(int[] s, int val) {\n int left = 0;\n int right = s.length - 1;\n int mid = (right + left) / 2;\n\n while (left <= right) {\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }\n return false;\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n int q = in.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = in.nextInt();\n }\n\n int c = 0;\n for (int i : t) {\n if (binarySearch(s, i)) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n private static boolean binarySearch(int[] s, int val) {\n int left = 0;\n int right = s.length - 1;\n int mid = (right + left) / 2;\n\n while (left <= right) {\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }\n return false;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n int q = in.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = in.nextInt();\n }\n\n int c = 0;\n for (int i : t) {\n if (binarySearch(s, i)) {\n c++;\n }\n }\n System.out.println(c);\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n int q = in.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = in.nextInt();\n }\n\n int c = 0;\n for (int i : t) {\n if (binarySearch(s, i)) {\n c++;\n }\n }\n System.out.println(c);\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; i < n; i++) {\n s[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = in.nextInt();\n }",
"{\n s[i] = in.nextInt();\n }",
"s[i] = in.nextInt()",
"s[i]",
"s",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"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++) {\n t[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = in.nextInt();\n }",
"{\n t[i] = in.nextInt();\n }",
"t[i] = in.nextInt()",
"t[i]",
"t",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int c = 0;",
"c",
"0",
"for (int i : t) {\n if (binarySearch(s, i)) {\n c++;\n }\n }",
"int i",
"t",
"{\n if (binarySearch(s, i)) {\n c++;\n }\n }",
"{\n if (binarySearch(s, i)) {\n c++;\n }\n }",
"if (binarySearch(s, i)) {\n c++;\n }",
"binarySearch(s, i)",
"binarySearch",
"s",
"i",
"{\n c++;\n }",
"c++",
"c",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"private static boolean binarySearch(int[] s, int val) {\n int left = 0;\n int right = s.length - 1;\n int mid = (right + left) / 2;\n\n while (left <= right) {\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = s.length - 1;\n int mid = (right + left) / 2;\n\n while (left <= right) {\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = s.length - 1;",
"right",
"s.length - 1",
"s.length",
"s",
"s.length",
"1",
"int mid = (right + left) / 2;",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"while (left <= right) {\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }",
"left <= right",
"left",
"right",
"{\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }",
"if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }",
"s[mid] == val",
"s[mid]",
"s",
"mid",
"val",
"{\n return true;\n }",
"return true;",
"true",
"if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }",
"s[mid] > val",
"s[mid]",
"s",
"mid",
"val",
"{\n right = mid - 1;\n mid = (right + left) / 2;\n }",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"mid = (right + left) / 2",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"{\n left = mid + 1;\n mid = (right + left) / 2;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"mid = (right + left) / 2",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"return false;",
"false",
"int[] s",
"s",
"int val",
"val",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n int q = in.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = in.nextInt();\n }\n\n int c = 0;\n for (int i : t) {\n if (binarySearch(s, i)) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n private static boolean binarySearch(int[] s, int val) {\n int left = 0;\n int right = s.length - 1;\n int mid = (right + left) / 2;\n\n while (left <= right) {\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }\n return false;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n int q = in.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = in.nextInt();\n }\n\n int c = 0;\n for (int i : t) {\n if (binarySearch(s, i)) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n private static boolean binarySearch(int[] s, int val) {\n int left = 0;\n int right = s.length - 1;\n int mid = (right + left) / 2;\n\n while (left <= right) {\n if (s[mid] == val) {\n return true;\n } else if (s[mid] > val) {\n right = mid - 1;\n mid = (right + left) / 2;\n } else {\n left = mid + 1;\n mid = (right + left) / 2;\n }\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public 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; 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 c = 0;
for (int i : t) {
if (binarySearch(s, i)) {
c++;
}
}
System.out.println(c);
}
private static boolean binarySearch(int[] s, int val) {
int left = 0;
int right = s.length - 1;
int mid = (right + left) / 2;
while (left <= right) {
if (s[mid] == val) {
return true;
} else if (s[mid] > val) {
right = mid - 1;
mid = (right + left) / 2;
} else {
left = mid + 1;
mid = (right + left) / 2;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
18,
13,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
114,
8
],
[
114,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
11,
49
],
[
49,
50
],
[
49,
51
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
11,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
11,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
11,
108
],
[
108,
109
],
[
109,
110
],
[
9,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tscan.close();\n\t\t\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tscan.close();\n\t\t\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tscan.close();\n\t\t\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tscan.close();\n\t\t\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 ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"if (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}",
"Arrays.binarySearch(S, T[i]) >= 0",
"Arrays.binarySearch(S, T[i])",
"Arrays.binarySearch",
"Arrays",
"S",
"T[i]",
"T",
"i",
"0",
"{\n\t\t\t\tans++;\n\t\t\t}",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tscan.close();\n\t\t\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tscan.close();\n\t\t\n\t}\n\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[] 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 ans = 0;
for (int i = 0; i < q; i++) {
if (Arrays.binarySearch(S, T[i]) >= 0) {
ans++;
}
}
System.out.println(ans);
scan.close();
}
} |
[
7,
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,
13,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
2,
13,
17,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
13,
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
],
[
4,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
26,
31
],
[
11,
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
],
[
11,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
11,
62
],
[
62,
63
],
[
62,
64
],
[
11,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
68,
73
],
[
11,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
11,
96
],
[
96,
97
],
[
96,
98
],
[
11,
99
],
[
99,
100
],
[
99,
101
],
[
99,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
103,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
103,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
124,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
123,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
134,
140
],
[
140,
141
],
[
140,
142
],
[
134,
143
],
[
143,
144
],
[
143,
145
],
[
123,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
11,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
9,
159
],
[
159,
160
]
] | [
"import java.io.*;\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;\n int m = (r-l)/2;\n while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(r+l)/2;\n }\n }\n System.out.println(ans);\n }\n}",
"import java.io.*;",
"io.*",
"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;\n int m = (r-l)/2;\n while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(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;\n int m = (r-l)/2;\n while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(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;\n int m = (r-l)/2;\n while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(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;\n int m = (r-l)/2;\n while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(r+l)/2;\n }\n }",
"int i",
"a2",
"{\n int l = 0;\n int r = n1;\n int m = (r-l)/2;\n while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(r+l)/2;\n }\n }",
"{\n int l = 0;\n int r = n1;\n int m = (r-l)/2;\n while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(r+l)/2;\n }\n }",
"int l = 0;",
"l",
"0",
"int r = n1;",
"r",
"n1",
"int m = (r-l)/2;",
"m",
"(r-l)/2",
"(r-l)",
"r",
"l",
"2",
"while (r>l+1){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(r+l)/2;\n }",
"r>l+1",
"r",
"l+1",
"l",
"1",
"{\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n m=(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",
"m=(r+l)/2",
"m",
"(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.*;
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;
int m = (r-l)/2;
while (r>l+1){
if(a1[m] == i){
ans++;
break;
}
if(a1[m]>i)
r=m;
else
l=m;
m=(r+l)/2;
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
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,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
40,
17,
41,
13,
13,
41,
13,
17,
42,
2,
4,
18,
13,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
14,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
169,
11
],
[
169,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
14,
22
],
[
22,
23
],
[
22,
24
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
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
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
14,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
14,
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
],
[
14,
80
],
[
80,
81
],
[
80,
82
],
[
14,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
83,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
103,
105
],
[
95,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
111,
113
],
[
107,
114
],
[
106,
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
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
115,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
136,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
95,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
14,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
14,
163
],
[
163,
164
],
[
164,
165
],
[
12,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.List;\n\npublic class Main\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, A[] = new int[100000], m[] = new int[50000];\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tm[i] = sc.nextInt();\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.List;",
"List",
"java.util",
"public class Main\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, A[] = new int[100000], m[] = new int[50000];\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tm[i] = sc.nextInt();\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, A[] = new int[100000], m[] = new int[50000];\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tm[i] = sc.nextInt();\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, A[] = new int[100000], m[] = new int[50000];\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tm[i] = sc.nextInt();\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n",
"n",
"q",
"q",
"A[] = new int[100000]",
"A",
"new int[100000]",
"100000",
"m[] = new int[50000];",
"m",
"new int[50000]",
"50000",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < n; i++)\n\t\t{\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",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < q; i++)\n\t\t{\n\t\t\tm[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tm[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tm[i] = sc.nextInt();\n\t\t}",
"m[i] = sc.nextInt()",
"m[i]",
"m",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"for(int i = 0; i < q; i++)\n\t\t{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\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 ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}",
"int ok = -1;",
"ok",
"-1",
"1",
"int ng = n;",
"ng",
"n",
"boolean aru = false;",
"aru",
"false",
"while(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}",
"Math.abs(ok - ng) > 1",
"Math.abs(ok - ng)",
"Math.abs",
"Math",
"ok - ng",
"ok",
"ng",
"1",
"{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}",
"int mid = (ok + ng) / 2;",
"mid",
"(ok + ng) / 2",
"(ok + ng)",
"ok",
"ng",
"2",
"if(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"A[mid] == m[i]",
"A[mid]",
"A",
"mid",
"m[i]",
"m",
"i",
"{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"aru = true",
"aru",
"true",
"break;",
"if(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}",
"A[mid] > m[i]",
"A[mid]",
"A",
"mid",
"m[i]",
"m",
"i",
"{\n\t\t\t\t\tng = mid;\n\t\t\t\t}",
"ng = mid",
"ng",
"mid",
"{\n\t\t\t\t\tok = mid;\n\t\t\t\t}",
"ok = mid",
"ok",
"mid",
"if(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}",
"aru",
"{\n\t\t\t\t++ans;\n\t\t\t}",
"++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\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, A[] = new int[100000], m[] = new int[50000];\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tm[i] = sc.nextInt();\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, A[] = new int[100000], m[] = new int[50000];\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tm[i] = sc.nextInt();\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < q; i++)\n\t\t{\n\t\t\tint ok = -1;\n\t\t\tint ng = n;\n\t\t\tboolean aru = false;\n\t\t\twhile(Math.abs(ok - ng) > 1)\n\t\t\t{\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(A[mid] == m[i])\n\t\t\t\t{\n\t\t\t\t\taru = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(A[mid] > m[i])\n\t\t\t\t{\n\t\t\t\t\tng = mid;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tok = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aru)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"Main"
] | import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
public class Main
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n, q, A[] = new int[100000], m[] = new int[50000];
n = sc.nextInt();
for(int i = 0; i < n; i++)
{
A[i] = sc.nextInt();
}
q = sc.nextInt();
for(int i = 0; i < q; i++)
{
m[i] = sc.nextInt();
}
int ans = 0;
for(int i = 0; i < q; i++)
{
int ok = -1;
int ng = n;
boolean aru = false;
while(Math.abs(ok - ng) > 1)
{
int mid = (ok + ng) / 2;
if(A[mid] == m[i])
{
aru = true;
break;
}
if(A[mid] > m[i])
{
ng = mid;
}
else
{
ok = mid;
}
}
if(aru)
{
++ans;
}
}
System.out.println(ans);
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
17,
41,
13,
20,
17,
41,
13,
20,
0,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
13,
0,
13,
17,
0,
13,
2,
13,
17,
42,
17,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
13,
13,
30,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
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
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
11,
14
],
[
14,
15
],
[
11,
16
],
[
16,
17
],
[
11,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
11,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
29,
31
],
[
11,
33
],
[
33,
34
],
[
33,
35
],
[
11,
37
],
[
37,
38
],
[
37,
39
],
[
11,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
11,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
50,
51
],
[
50,
52
],
[
45,
53
],
[
53,
54
],
[
54,
55
],
[
45,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
11,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
11,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
11,
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
],
[
102,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
102,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
116,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
116,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
140,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
116,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
159,
160
],
[
159,
161
],
[
154,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
162,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
11,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
9,
181
],
[
181,
182
]
] | [
"import java.util.*;\nimport java.io.*;\nclass Main{\n public static void main(String args[]){\n\tint r,l,m,n,q,i,j,count=0;\n\tint s[] = new int[1000000];\n\tint t[] = new int[1000000];\n\tScanner scan = new Scanner(System.in);\n\t\n\tn = scan.nextInt();\n\tfor(i=0;i<n;i++){\n\t s[i] = scan.nextInt();\n\t}\n\tq = scan.nextInt();\n\tfor(j=0;j<q;j++){\n\t t[j] = scan.nextInt();\n\t}\n\t\n\tfor(j=0;j<q;j++){\n\t r = n;\n\t l = 0;\n\t m = n/2;\n\t while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}\n\t}\n\tSystem.out.println(count);\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main{\n public static void main(String args[]){\n\tint r,l,m,n,q,i,j,count=0;\n\tint s[] = new int[1000000];\n\tint t[] = new int[1000000];\n\tScanner scan = new Scanner(System.in);\n\t\n\tn = scan.nextInt();\n\tfor(i=0;i<n;i++){\n\t s[i] = scan.nextInt();\n\t}\n\tq = scan.nextInt();\n\tfor(j=0;j<q;j++){\n\t t[j] = scan.nextInt();\n\t}\n\t\n\tfor(j=0;j<q;j++){\n\t r = n;\n\t l = 0;\n\t m = n/2;\n\t while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}\n\t}\n\tSystem.out.println(count);\n }\n}",
"Main",
"public static void main(String args[]){\n\tint r,l,m,n,q,i,j,count=0;\n\tint s[] = new int[1000000];\n\tint t[] = new int[1000000];\n\tScanner scan = new Scanner(System.in);\n\t\n\tn = scan.nextInt();\n\tfor(i=0;i<n;i++){\n\t s[i] = scan.nextInt();\n\t}\n\tq = scan.nextInt();\n\tfor(j=0;j<q;j++){\n\t t[j] = scan.nextInt();\n\t}\n\t\n\tfor(j=0;j<q;j++){\n\t r = n;\n\t l = 0;\n\t m = n/2;\n\t while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}\n\t}\n\tSystem.out.println(count);\n }",
"main",
"{\n\tint r,l,m,n,q,i,j,count=0;\n\tint s[] = new int[1000000];\n\tint t[] = new int[1000000];\n\tScanner scan = new Scanner(System.in);\n\t\n\tn = scan.nextInt();\n\tfor(i=0;i<n;i++){\n\t s[i] = scan.nextInt();\n\t}\n\tq = scan.nextInt();\n\tfor(j=0;j<q;j++){\n\t t[j] = scan.nextInt();\n\t}\n\t\n\tfor(j=0;j<q;j++){\n\t r = n;\n\t l = 0;\n\t m = n/2;\n\t while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}\n\t}\n\tSystem.out.println(count);\n }",
"int r",
"r",
"l",
"l",
"m",
"m",
"n",
"n",
"q",
"q",
"i",
"i",
"j",
"j",
"count=0;",
"count",
"0",
"int s[] = new int[1000000];",
"s",
"new int[1000000]",
"1000000",
"int t[] = new int[1000000];",
"t",
"new int[1000000]",
"1000000",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(i=0;i<n;i++){\n\t s[i] = scan.nextInt();\n\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t s[i] = scan.nextInt();\n\t}",
"{\n\t s[i] = scan.nextInt();\n\t}",
"s[i] = scan.nextInt()",
"s[i]",
"s",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"q = scan.nextInt()",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(j=0;j<q;j++){\n\t t[j] = scan.nextInt();\n\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t t[j] = scan.nextInt();\n\t}",
"{\n\t t[j] = scan.nextInt();\n\t}",
"t[j] = scan.nextInt()",
"t[j]",
"t",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(j=0;j<q;j++){\n\t r = n;\n\t l = 0;\n\t m = n/2;\n\t while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}\n\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t r = n;\n\t l = 0;\n\t m = n/2;\n\t while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}\n\t}",
"{\n\t r = n;\n\t l = 0;\n\t m = n/2;\n\t while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}\n\t}",
"r = n",
"r",
"n",
"l = 0",
"l",
"0",
"m = n/2",
"m",
"n/2",
"n",
"2",
"while(true){\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}",
"true",
"{\n\t\tif(s[m]==t[j]){count++;break;}\n\t\tif(m==l){break;} \n\t\tif(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}\n\t\tif(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}\n\t\t}",
"if(s[m]==t[j]){count++;break;}",
"s[m]==t[j]",
"s[m]",
"s",
"m",
"t[j]",
"t",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(m==l){break;}",
"m==l",
"m",
"l",
"{break;}",
"break;",
"if(s[m]>t[j]){/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}",
"s[m]>t[j]",
"s[m]",
"s",
"m",
"t[j]",
"t",
"j",
"{/*探す値が左側にあった場合*/\n\t\t r = m;\n\t\t m = (r+l)/2;\n\t\t}",
"r = m",
"r",
"m",
"m = (r+l)/2",
"m",
"(r+l)/2",
"(r+l)",
"r",
"l",
"2",
"if(s[m]<t[j]){/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}",
"s[m]<t[j]",
"s[m]",
"s",
"m",
"t[j]",
"t",
"j",
"{/*探す値が右側にあった場合*/\n\t\t l = m+1;\n\t\t m = (r+l)/2;\n\t\t}",
"l = m+1",
"l",
"m+1",
"m",
"1",
"m = (r+l)/2",
"m",
"(r+l)/2",
"(r+l)",
"r",
"l",
"2",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String args[]",
"args"
] | import java.util.*;
import java.io.*;
class Main{
public static void main(String args[]){
int r,l,m,n,q,i,j,count=0;
int s[] = new int[1000000];
int t[] = new int[1000000];
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
for(i=0;i<n;i++){
s[i] = scan.nextInt();
}
q = scan.nextInt();
for(j=0;j<q;j++){
t[j] = scan.nextInt();
}
for(j=0;j<q;j++){
r = n;
l = 0;
m = n/2;
while(true){
if(s[m]==t[j]){count++;break;}
if(m==l){break;}
if(s[m]>t[j]){/*探す値が左側にあった場合*/
r = m;
m = (r+l)/2;
}
if(s[m]<t[j]){/*探す値が右側にあった場合*/
l = m+1;
m = (r+l)/2;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
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,
4,
18,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
135,
8
],
[
135,
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
],
[
11,
54
],
[
54,
55
],
[
11,
56
],
[
56,
57
],
[
11,
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
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
72,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
72,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
98,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
98,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
110,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
110,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
11,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
9,
132
],
[
132,
133
],
[
0,
134
],
[
134,
135
],
[
134,
136
]
] | [
"import java.io.IOException;\nimport 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(); //数列Sの長さ\n int[] s = new int[n]; //数列S\n for(int i=0; i<n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt(); //数列Tの長さ\n int count = 0; //出力結果(個数)\n int left,right,mid,t;\n\n for(int i=0; i<q; i++) {\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}\n",
"import java.io.IOException;",
"IOException",
"java.io",
"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(); //数列Sの長さ\n int[] s = new int[n]; //数列S\n for(int i=0; i<n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt(); //数列Tの長さ\n int count = 0; //出力結果(個数)\n int left,right,mid,t;\n\n for(int i=0; i<q; i++) {\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //数列Sの長さ\n int[] s = new int[n]; //数列S\n for(int i=0; i<n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt(); //数列Tの長さ\n int count = 0; //出力結果(個数)\n int left,right,mid,t;\n\n for(int i=0; i<q; i++) {\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\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(); //数列Sの長さ\n int[] s = new int[n]; //数列S\n for(int i=0; i<n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt(); //数列Tの長さ\n int count = 0; //出力結果(個数)\n int left,right,mid,t;\n\n for(int i=0; i<q; i++) {\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n];",
"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 count = 0;",
"count",
"0",
"int left",
"left",
"right",
"right",
"mid",
"mid",
"t;",
"t",
"for(int i=0; i<q; i++) {\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }",
"{\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }",
"left = 0",
"left",
"0",
"right = n-1",
"right",
"n-1",
"n",
"1",
"t = sc.nextInt()",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }",
"left<=right",
"left",
"right",
"{\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }",
"mid = (left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }",
"s[mid] < t",
"s[mid]",
"s",
"mid",
"t",
"{\n left = mid+1;\n }",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }",
"s[mid] > t",
"s[mid]",
"s",
"mid",
"t",
"{\n right = mid-1;\n }",
"right = mid-1",
"right",
"mid-1",
"mid",
"1",
"{\n count++;\n break;\n }",
"count++",
"count",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //数列Sの長さ\n int[] s = new int[n]; //数列S\n for(int i=0; i<n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt(); //数列Tの長さ\n int count = 0; //出力結果(個数)\n int left,right,mid,t;\n\n for(int i=0; i<q; i++) {\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //数列Sの長さ\n int[] s = new int[n]; //数列S\n for(int i=0; i<n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt(); //数列Tの長さ\n int count = 0; //出力結果(個数)\n int left,right,mid,t;\n\n for(int i=0; i<q; i++) {\n left = 0;\n right = n-1;\n t = sc.nextInt();\n while(left<=right) {\n mid = (left+right)/2;\n if(s[mid] < t) {\n left = mid+1;\n } else if (s[mid] > t) {\n right = mid-1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"Main"
] | import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(); //数列Sの長さ
int[] s = new int[n]; //数列S
for(int i=0; i<n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt(); //数列Tの長さ
int count = 0; //出力結果(個数)
int left,right,mid,t;
for(int i=0; i<q; i++) {
left = 0;
right = n-1;
t = sc.nextInt();
while(left<=right) {
mid = (left+right)/2;
if(s[mid] < t) {
left = mid+1;
} else if (s[mid] > t) {
right = mid-1;
} else {
count++;
break;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
13,
13,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
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
],
[
70,
74
],
[
70,
75
],
[
8,
76
],
[
76,
77
],
[
77,
78
],
[
6,
79
],
[
79,
80
],
[
4,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
83,
90
],
[
90,
91
],
[
83,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
92,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
112,
125
],
[
125,
126
],
[
83,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
81,
133
],
[
133,
134
],
[
81,
135
],
[
135,
136
],
[
81,
137
],
[
137,
138
],
[
81,
139
],
[
139,
140
]
] | [
"import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint numS = scanner.nextInt();//要素数\n\t\tint arrayS[] = new int[numS];\n\t\t\n\t\tfor(int i = 0; i < numS; i ++ ){\n\t\t\tarrayS[i] = scanner.nextInt();\n\t\t}\n\t\tint numT = scanner.nextInt();//要素数\n\t\tint arrayT[] = new int[numT];\n\t\t\n\t\tfor(int i = 0; i < numT; i ++ ){\n\t\t\tarrayT[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tLinearSearch(numS,arrayS,numT,arrayT);\n\t\t\n\t\tscanner.close();\n\t}\n\t\n\tpublic static void LinearSearch(int numS,int[] arrayS,int numT, int[] arrayT){ \n\t\tint count = 0;\n\t\tint match = 0;\n\t\tint i;\n\t\t\n\t\tfor(i = 0; i < numT; i ++ ){\n\t\t\tcount = 0;\n\t\t\twhile( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(match);\t\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint numS = scanner.nextInt();//要素数\n\t\tint arrayS[] = new int[numS];\n\t\t\n\t\tfor(int i = 0; i < numS; i ++ ){\n\t\t\tarrayS[i] = scanner.nextInt();\n\t\t}\n\t\tint numT = scanner.nextInt();//要素数\n\t\tint arrayT[] = new int[numT];\n\t\t\n\t\tfor(int i = 0; i < numT; i ++ ){\n\t\t\tarrayT[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tLinearSearch(numS,arrayS,numT,arrayT);\n\t\t\n\t\tscanner.close();\n\t}\n\t\n\tpublic static void LinearSearch(int numS,int[] arrayS,int numT, int[] arrayT){ \n\t\tint count = 0;\n\t\tint match = 0;\n\t\tint i;\n\t\t\n\t\tfor(i = 0; i < numT; i ++ ){\n\t\t\tcount = 0;\n\t\t\twhile( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(match);\t\n\t}\n}",
"Main",
"public static void main(String args[]) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint numS = scanner.nextInt();//要素数\n\t\tint arrayS[] = new int[numS];\n\t\t\n\t\tfor(int i = 0; i < numS; i ++ ){\n\t\t\tarrayS[i] = scanner.nextInt();\n\t\t}\n\t\tint numT = scanner.nextInt();//要素数\n\t\tint arrayT[] = new int[numT];\n\t\t\n\t\tfor(int i = 0; i < numT; i ++ ){\n\t\t\tarrayT[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tLinearSearch(numS,arrayS,numT,arrayT);\n\t\t\n\t\tscanner.close();\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint numS = scanner.nextInt();//要素数\n\t\tint arrayS[] = new int[numS];\n\t\t\n\t\tfor(int i = 0; i < numS; i ++ ){\n\t\t\tarrayS[i] = scanner.nextInt();\n\t\t}\n\t\tint numT = scanner.nextInt();//要素数\n\t\tint arrayT[] = new int[numT];\n\t\t\n\t\tfor(int i = 0; i < numT; i ++ ){\n\t\t\tarrayT[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tLinearSearch(numS,arrayS,numT,arrayT);\n\t\t\n\t\tscanner.close();\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int numS = scanner.nextInt();",
"numS",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int arrayS[] = new int[numS];",
"arrayS",
"new int[numS]",
"numS",
"for(int i = 0; i < numS; i ++ ){\n\t\t\tarrayS[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numS",
"i",
"numS",
"i ++",
"i ++",
"i",
"{\n\t\t\tarrayS[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tarrayS[i] = scanner.nextInt();\n\t\t}",
"arrayS[i] = scanner.nextInt()",
"arrayS[i]",
"arrayS",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int numT = scanner.nextInt();",
"numT",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int arrayT[] = new int[numT];",
"arrayT",
"new int[numT]",
"numT",
"for(int i = 0; i < numT; i ++ ){\n\t\t\tarrayT[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numT",
"i",
"numT",
"i ++",
"i ++",
"i",
"{\n\t\t\tarrayT[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tarrayT[i] = scanner.nextInt();\n\t\t}",
"arrayT[i] = scanner.nextInt()",
"arrayT[i]",
"arrayT",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"LinearSearch(numS,arrayS,numT,arrayT)",
"LinearSearch",
"numS",
"arrayS",
"numT",
"arrayT",
"scanner.close()",
"scanner.close",
"scanner",
"String args[]",
"args",
"public static void LinearSearch(int numS,int[] arrayS,int numT, int[] arrayT){ \n\t\tint count = 0;\n\t\tint match = 0;\n\t\tint i;\n\t\t\n\t\tfor(i = 0; i < numT; i ++ ){\n\t\t\tcount = 0;\n\t\t\twhile( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(match);\t\n\t}",
"LinearSearch",
"{ \n\t\tint count = 0;\n\t\tint match = 0;\n\t\tint i;\n\t\t\n\t\tfor(i = 0; i < numT; i ++ ){\n\t\t\tcount = 0;\n\t\t\twhile( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(match);\t\n\t}",
"int count = 0;",
"count",
"0",
"int match = 0;",
"match",
"0",
"int i;",
"i",
"for(i = 0; i < numT; i ++ ){\n\t\t\tcount = 0;\n\t\t\twhile( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}",
"i = 0;",
"i = 0",
"i",
"0",
"i < numT",
"i",
"numT",
"i ++",
"i ++",
"i",
"{\n\t\t\tcount = 0;\n\t\t\twhile( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tcount = 0;\n\t\t\twhile( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}",
"count = 0",
"count",
"0",
"while( count < numS ){\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}",
"count < numS",
"count",
"numS",
"{\n\t\t\t\tif(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcount ++;\n\t\t\t}",
"if(arrayT[i] == arrayS[count]){\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"arrayT[i] == arrayS[count]",
"arrayT[i]",
"arrayT",
"i",
"arrayS[count]",
"arrayS",
"count",
"{\n\t\t\t\t\tmatch ++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"match ++",
"match",
"break;",
"count ++",
"count",
"System.out.println(match)",
"System.out.println",
"System.out",
"System",
"System.out",
"match",
"int numS",
"numS",
"int[] arrayS",
"arrayS",
"int numT",
"numT",
"int[] arrayT",
"arrayT"
] | import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int numS = scanner.nextInt();//要素数
int arrayS[] = new int[numS];
for(int i = 0; i < numS; i ++ ){
arrayS[i] = scanner.nextInt();
}
int numT = scanner.nextInt();//要素数
int arrayT[] = new int[numT];
for(int i = 0; i < numT; i ++ ){
arrayT[i] = scanner.nextInt();
}
LinearSearch(numS,arrayS,numT,arrayT);
scanner.close();
}
public static void LinearSearch(int numS,int[] arrayS,int numT, int[] arrayT){
int count = 0;
int match = 0;
int i;
for(i = 0; i < numT; i ++ ){
count = 0;
while( count < numS ){
if(arrayT[i] == arrayS[count]){
match ++;
break;
}
count ++;
}
}
System.out.println(match);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
4,
18,
13,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
4,
18,
13,
18,
13,
13,
13,
30,
0,
13,
13,
14,
2,
4,
18,
13,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
142,
11
],
[
142,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
39,
40
],
[
40,
41
],
[
14,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
44,
49
],
[
14,
50
],
[
50,
51
],
[
50,
52
],
[
14,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
71,
73
],
[
65,
74
],
[
74,
75
],
[
74,
76
],
[
65,
77
],
[
77,
78
],
[
77,
79
],
[
65,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
97,
98
],
[
97,
99
],
[
93,
100
],
[
92,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
92,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
106,
113
],
[
105,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
105,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
123,
125
],
[
119,
126
],
[
118,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
14,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
12,
139
],
[
139,
140
],
[
0,
141
],
[
141,
142
],
[
141,
143
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n\npublic class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????????\n\t\tint n = Integer.parseInt(bf.readLine());\n\t\tString[] sString = bf.readLine().split(\" \");\n\t\tint q = Integer.parseInt(bf.readLine());\n\t\tString[] tString = bf.readLine().split(\" \");\n\t\n\t\tint count=0;\n\t\t\n\n\t\t\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n }",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????????\n\t\tint n = Integer.parseInt(bf.readLine());\n\t\tString[] sString = bf.readLine().split(\" \");\n\t\tint q = Integer.parseInt(bf.readLine());\n\t\tString[] tString = bf.readLine().split(\" \");\n\t\n\t\tint count=0;\n\t\t\n\n\t\t\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n }",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????????\n\t\tint n = Integer.parseInt(bf.readLine());\n\t\tString[] sString = bf.readLine().split(\" \");\n\t\tint q = Integer.parseInt(bf.readLine());\n\t\tString[] tString = bf.readLine().split(\" \");\n\t\n\t\tint count=0;\n\t\t\n\n\t\t\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????????\n\t\tint n = Integer.parseInt(bf.readLine());\n\t\tString[] sString = bf.readLine().split(\" \");\n\t\tint q = Integer.parseInt(bf.readLine());\n\t\tString[] tString = bf.readLine().split(\" \");\n\t\n\t\tint count=0;\n\t\t\n\n\t\t\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));",
"bf",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(bf.readLine());",
"n",
"Integer.parseInt(bf.readLine())",
"Integer.parseInt",
"Integer",
"bf.readLine()",
"bf.readLine",
"bf",
"String[] sString = bf.readLine().split(\" \");",
"sString",
"bf.readLine().split(\" \")",
"bf.readLine().split",
"bf.readLine()",
"bf.readLine",
"bf",
"\" \"",
"int q = Integer.parseInt(bf.readLine());",
"q",
"Integer.parseInt(bf.readLine())",
"Integer.parseInt",
"Integer",
"bf.readLine()",
"bf.readLine",
"bf",
"String[] tString = bf.readLine().split(\" \");",
"tString",
"bf.readLine().split(\" \")",
"bf.readLine().split",
"bf.readLine()",
"bf.readLine",
"bf",
"\" \"",
"int count=0;",
"count",
"0",
"for(int i=0;i<q;i++){\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}",
"{\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}",
"int search = Integer.parseInt(tString[i]);",
"search",
"Integer.parseInt(tString[i])",
"Integer.parseInt",
"Integer",
"tString[i]",
"tString",
"i",
"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(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\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(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\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(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}",
"Integer.parseInt(sString[mid])==search",
"Integer.parseInt(sString[mid])",
"Integer.parseInt",
"Integer",
"sString[mid]",
"sString",
"mid",
"search",
"{\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}",
"count++",
"count",
"break;",
"if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}",
"Integer.parseInt(sString[mid])>search",
"Integer.parseInt(sString[mid])",
"Integer.parseInt",
"Integer",
"sString[mid]",
"sString",
"mid",
"search",
"{\n\t\t\t\tright=mid;\n\t\t\t}",
"right=mid",
"right",
"mid",
"if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}",
"Integer.parseInt(sString[mid])<search",
"Integer.parseInt(sString[mid])",
"Integer.parseInt",
"Integer",
"sString[mid]",
"sString",
"mid",
"search",
"{\n\t\t\t\tleft= mid+1;\n\t\t\t}",
"left= mid+1",
"left",
"mid+1",
"mid",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????????\n\t\tint n = Integer.parseInt(bf.readLine());\n\t\tString[] sString = bf.readLine().split(\" \");\n\t\tint q = Integer.parseInt(bf.readLine());\n\t\tString[] tString = bf.readLine().split(\" \");\n\t\n\t\tint count=0;\n\t\t\n\n\t\t\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n }",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????????\n\t\tint n = Integer.parseInt(bf.readLine());\n\t\tString[] sString = bf.readLine().split(\" \");\n\t\tint q = Integer.parseInt(bf.readLine());\n\t\tString[] tString = bf.readLine().split(\" \");\n\t\n\t\tint count=0;\n\t\t\n\n\t\t\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint search = Integer.parseInt(tString[i]);\n\t\t\tint left=0;\n\t\t\tint right = n;\n\t\twhile(left<right){\n\t\t\tint mid = (left+right)/2;\n\t\t\tif(Integer.parseInt(sString[mid])==search){\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}else if(Integer.parseInt(sString[mid])>search){\n\t\t\t\tright=mid;\n\t\t\t}else if(Integer.parseInt(sString[mid])<search){\n\t\t\t\tleft= mid+1;\n\t\t\t}\n\t\t}\n\t\t}\n\t\tSystem.out.println(count);\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) throws NumberFormatException, IOException {
//????????????????????????
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
//?????????
int n = Integer.parseInt(bf.readLine());
String[] sString = bf.readLine().split(" ");
int q = Integer.parseInt(bf.readLine());
String[] tString = bf.readLine().split(" ");
int count=0;
for(int i=0;i<q;i++){
int search = Integer.parseInt(tString[i]);
int left=0;
int right = n;
while(left<right){
int mid = (left+right)/2;
if(Integer.parseInt(sString[mid])==search){
count++;
break;
}else if(Integer.parseInt(sString[mid])>search){
right=mid;
}else if(Integer.parseInt(sString[mid])<search){
left= mid+1;
}
}
}
System.out.println(count);
}
} |
[
7,
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,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
28,
13,
13,
30,
14,
4,
18,
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
],
[
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
],
[
11,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
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
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
11,
67
],
[
67,
68
],
[
67,
69
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
70,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
74,
79
],
[
79,
80
],
[
11,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
9,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
] | [
"import java.util.HashSet;\nimport java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n HashSet<Integer> S = new HashSet<Integer>();\n HashSet<Integer> T = new HashSet<Integer>();\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n for(int i = 0; i < n; i++)\n\tS.add(sc.nextInt());\n int q = sc.nextInt();\n for(int i = 0; i < q; i++)\n\tT.add(sc.nextInt());\n int count = 0;\n for(Integer T1 : T)\n\tif(S.contains(T1)) count++;\n System.out.println(count);\n }\n}",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n HashSet<Integer> S = new HashSet<Integer>();\n HashSet<Integer> T = new HashSet<Integer>();\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n for(int i = 0; i < n; i++)\n\tS.add(sc.nextInt());\n int q = sc.nextInt();\n for(int i = 0; i < q; i++)\n\tT.add(sc.nextInt());\n int count = 0;\n for(Integer T1 : T)\n\tif(S.contains(T1)) count++;\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) {\n HashSet<Integer> S = new HashSet<Integer>();\n HashSet<Integer> T = new HashSet<Integer>();\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n for(int i = 0; i < n; i++)\n\tS.add(sc.nextInt());\n int q = sc.nextInt();\n for(int i = 0; i < q; i++)\n\tT.add(sc.nextInt());\n int count = 0;\n for(Integer T1 : T)\n\tif(S.contains(T1)) count++;\n System.out.println(count);\n }",
"main",
"{\n HashSet<Integer> S = new HashSet<Integer>();\n HashSet<Integer> T = new HashSet<Integer>();\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n for(int i = 0; i < n; i++)\n\tS.add(sc.nextInt());\n int q = sc.nextInt();\n for(int i = 0; i < q; i++)\n\tT.add(sc.nextInt());\n int count = 0;\n for(Integer T1 : T)\n\tif(S.contains(T1)) count++;\n System.out.println(count);\n }",
"HashSet<Integer> S = new HashSet<Integer>();",
"S",
"new HashSet<Integer>()",
"HashSet<Integer> T = new HashSet<Integer>();",
"T",
"new HashSet<Integer>()",
"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\tS.add(sc.nextInt());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"S.add(sc.nextInt());",
"S.add(sc.nextInt())",
"S.add",
"S",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < q; i++)\n\tT.add(sc.nextInt());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"T.add(sc.nextInt());",
"T.add(sc.nextInt())",
"T.add",
"T",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(Integer T1 : T)\n\tif(S.contains(T1)) count++;",
"Integer T1",
"T",
"if(S.contains(T1)) count++;",
"if(S.contains(T1)) count++;",
"S.contains(T1)",
"S.contains",
"S",
"T1",
"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 HashSet<Integer> S = new HashSet<Integer>();\n HashSet<Integer> T = new HashSet<Integer>();\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n for(int i = 0; i < n; i++)\n\tS.add(sc.nextInt());\n int q = sc.nextInt();\n for(int i = 0; i < q; i++)\n\tT.add(sc.nextInt());\n int count = 0;\n for(Integer T1 : T)\n\tif(S.contains(T1)) count++;\n System.out.println(count);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n HashSet<Integer> S = new HashSet<Integer>();\n HashSet<Integer> T = new HashSet<Integer>();\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n for(int i = 0; i < n; i++)\n\tS.add(sc.nextInt());\n int q = sc.nextInt();\n for(int i = 0; i < q; i++)\n\tT.add(sc.nextInt());\n int count = 0;\n for(Integer T1 : T)\n\tif(S.contains(T1)) count++;\n System.out.println(count);\n }\n}",
"Main"
] | import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
HashSet<Integer> S = new HashSet<Integer>();
HashSet<Integer> T = new HashSet<Integer>();
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i = 0; i < n; i++)
S.add(sc.nextInt());
int q = sc.nextInt();
for(int i = 0; i < q; i++)
T.add(sc.nextInt());
int count = 0;
for(Integer T1 : T)
if(S.contains(T1)) count++;
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
13,
42,
2,
17,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
0,
13,
13,
14,
2,
18,
13,
13,
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
],
[
142,
5
],
[
142,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
85,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
114,
116
],
[
106,
117
],
[
117,
118
],
[
117,
119
],
[
85,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
125,
127
],
[
120,
128
],
[
128,
129
],
[
8,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
8,
136
],
[
136,
137
],
[
137,
138
],
[
6,
139
],
[
139,
140
],
[
0,
141
],
[
141,
142
],
[
141,
143
]
] | [
"import java.util.*;\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 ans = 0;\n for (int i = 0; i < q; i++) {\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }\n System.out.println(ans);\n sc.close();\n\n }\n\n}\n",
"import java.util.*;",
"util.*",
"java",
"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 ans = 0;\n for (int i = 0; i < q; i++) {\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }\n System.out.println(ans);\n sc.close();\n\n }\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 ans = 0;\n for (int i = 0; i < q; i++) {\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }\n System.out.println(ans);\n sc.close();\n\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 ans = 0;\n for (int i = 0; i < q; i++) {\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }\n System.out.println(ans);\n sc.close();\n\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 ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }",
"{\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }",
"int l = 0;",
"l",
"0",
"int r = n;",
"r",
"n",
"while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }",
"1 < r-l",
"1",
"r-l",
"r",
"l",
"{\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }",
"int mid = (r + l) / 2;",
"mid",
"(r + l) / 2",
"(r + l)",
"r",
"l",
"2",
"if(t[i] < s[mid]) r = mid;\n else l = mid;",
"t[i] < s[mid]",
"t[i]",
"t",
"i",
"s[mid]",
"s",
"mid",
"r = mid",
"r",
"mid",
"l = mid",
"l",
"mid",
"if(s[l] == t[i]) ans++;",
"s[l] == t[i]",
"s[l]",
"s",
"l",
"t[i]",
"t",
"i",
"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 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 ans = 0;\n for (int i = 0; i < q; i++) {\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }\n System.out.println(ans);\n sc.close();\n\n }\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 ans = 0;\n for (int i = 0; i < q; i++) {\n int l = 0;\n int r = n;\n while(1 < r-l){\n int mid = (r + l) / 2;\n if(t[i] < s[mid]) r = mid;\n else l = mid;\n }\n if(s[l] == t[i]) ans++;\n }\n System.out.println(ans);\n sc.close();\n\n }\n\n}",
"Main"
] | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = sc.nextInt();
}
int ans = 0;
for (int i = 0; i < q; i++) {
int l = 0;
int r = n;
while(1 < r-l){
int mid = (r + l) / 2;
if(t[i] < s[mid]) r = mid;
else l = mid;
}
if(s[l] == t[i]) ans++;
}
System.out.println(ans);
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
17,
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,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
17,
2,
13,
17,
13,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
29,
17,
29,
17,
30,
14,
2,
18,
13,
2,
2,
13,
13,
17,
13,
29,
17,
14,
2,
18,
13,
2,
2,
13,
13,
17,
13,
29,
4,
13,
13,
2,
2,
13,
13,
17,
13,
13,
29,
4,
13,
2,
2,
2,
13,
13,
17,
17,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
182,
5
],
[
182,
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,
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
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
8,
71
],
[
71,
72
],
[
71,
73
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
91,
92
],
[
91,
93
],
[
88,
94
],
[
88,
95
],
[
95,
96
],
[
95,
97
],
[
87,
98
],
[
98,
99
],
[
8,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
6,
106
],
[
106,
107
],
[
182,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
116,
122
],
[
122,
123
],
[
116,
124
],
[
124,
125
],
[
111,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
128,
136
],
[
127,
137
],
[
137,
138
],
[
127,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
140,
148
],
[
139,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
150,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
150,
158
],
[
150,
159
],
[
139,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
163,
169
],
[
161,
170
],
[
161,
171
],
[
161,
172
],
[
108,
173
],
[
173,
174
],
[
108,
175
],
[
175,
176
],
[
108,
177
],
[
177,
178
],
[
108,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args ){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int S[] = new int[100000];\n for(int i = 0; i < n; i++)\n S[i] = scanner.nextInt();\n int q = scanner.nextInt();\n int T[] = new int[50000];\n for(int i = 0; i < q; i++)\n T[i] = scanner.nextInt();\n scanner.close();\n\n int amount = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n - 1, S, T[i]))\n amount++;\n }\n System.out.println(amount);\n }\n\n public static boolean search(int s, int e, int[] A, int p){\n if(s == e){\n if(A[s] == p)\n return true;\n else\n return false;\n }\n else{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }\n }\n\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args ){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int S[] = new int[100000];\n for(int i = 0; i < n; i++)\n S[i] = scanner.nextInt();\n int q = scanner.nextInt();\n int T[] = new int[50000];\n for(int i = 0; i < q; i++)\n T[i] = scanner.nextInt();\n scanner.close();\n\n int amount = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n - 1, S, T[i]))\n amount++;\n }\n System.out.println(amount);\n }\n\n public static boolean search(int s, int e, int[] A, int p){\n if(s == e){\n if(A[s] == p)\n return true;\n else\n return false;\n }\n else{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }\n }\n\n}",
"Main",
"public static void main(String[] args ){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int S[] = new int[100000];\n for(int i = 0; i < n; i++)\n S[i] = scanner.nextInt();\n int q = scanner.nextInt();\n int T[] = new int[50000];\n for(int i = 0; i < q; i++)\n T[i] = scanner.nextInt();\n scanner.close();\n\n int amount = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n - 1, S, T[i]))\n amount++;\n }\n System.out.println(amount);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int S[] = new int[100000];\n for(int i = 0; i < n; i++)\n S[i] = scanner.nextInt();\n int q = scanner.nextInt();\n int T[] = new int[50000];\n for(int i = 0; i < q; i++)\n T[i] = scanner.nextInt();\n scanner.close();\n\n int amount = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n - 1, S, T[i]))\n amount++;\n }\n System.out.println(amount);\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[100000];",
"S",
"new int[100000]",
"100000",
"for(int i = 0; i < n; i++)\n S[i] = scanner.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = scanner.nextInt();",
"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[50000];",
"T",
"new int[50000]",
"50000",
"for(int i = 0; i < q; i++)\n T[i] = scanner.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"T[i] = scanner.nextInt();",
"T[i] = scanner.nextInt()",
"T[i]",
"T",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"scanner.close()",
"scanner.close",
"scanner",
"int amount = 0;",
"amount",
"0",
"for(int i = 0; i < q; i++){\n if(search(0, n - 1, S, T[i]))\n amount++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if(search(0, n - 1, S, T[i]))\n amount++;\n }",
"{\n if(search(0, n - 1, S, T[i]))\n amount++;\n }",
"if(search(0, n - 1, S, T[i]))\n amount++;",
"search(0, n - 1, S, T[i])",
"search",
"0",
"n - 1",
"n",
"1",
"S",
"T[i]",
"T",
"i",
"amount++",
"amount",
"System.out.println(amount)",
"System.out.println",
"System.out",
"System",
"System.out",
"amount",
"String[] args",
"args",
"public static boolean search(int s, int e, int[] A, int p){\n if(s == e){\n if(A[s] == p)\n return true;\n else\n return false;\n }\n else{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }\n }",
"search",
"{\n if(s == e){\n if(A[s] == p)\n return true;\n else\n return false;\n }\n else{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }\n }",
"if(s == e){\n if(A[s] == p)\n return true;\n else\n return false;\n }\n else{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }",
"s == e",
"s",
"e",
"{\n if(A[s] == p)\n return true;\n else\n return false;\n }",
"if(A[s] == p)\n return true;\n else\n return false;",
"A[s] == p",
"A[s]",
"A",
"s",
"p",
"return true;",
"true",
"return false;",
"false",
"{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }",
"if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);",
"A[(s + e)/2] == p",
"A[(s + e)/2]",
"A",
"(s + e)/2",
"(s + e)",
"s",
"e",
"2",
"p",
"return true;",
"true",
"if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);",
"A[(s + e)/2] > p",
"A[(s + e)/2]",
"A",
"(s + e)/2",
"(s + e)",
"s",
"e",
"2",
"p",
"return search(s, (s + e)/2, A, p);",
"search(s, (s + e)/2, A, p)",
"search",
"s",
"(s + e)/2",
"(s + e)",
"s",
"e",
"2",
"A",
"p",
"return search((s + e)/2 + 1, e, A, p);",
"search((s + e)/2 + 1, e, A, p)",
"search",
"(s + e)/2 + 1",
"(s + e)/2",
"(s + e)",
"s",
"e",
"2",
"1",
"e",
"A",
"p",
"int s",
"s",
"int e",
"e",
"int[] A",
"A",
"int p",
"p",
"public class Main {\n public static void main(String[] args ){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int S[] = new int[100000];\n for(int i = 0; i < n; i++)\n S[i] = scanner.nextInt();\n int q = scanner.nextInt();\n int T[] = new int[50000];\n for(int i = 0; i < q; i++)\n T[i] = scanner.nextInt();\n scanner.close();\n\n int amount = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n - 1, S, T[i]))\n amount++;\n }\n System.out.println(amount);\n }\n\n public static boolean search(int s, int e, int[] A, int p){\n if(s == e){\n if(A[s] == p)\n return true;\n else\n return false;\n }\n else{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }\n }\n\n}",
"public class Main {\n public static void main(String[] args ){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int S[] = new int[100000];\n for(int i = 0; i < n; i++)\n S[i] = scanner.nextInt();\n int q = scanner.nextInt();\n int T[] = new int[50000];\n for(int i = 0; i < q; i++)\n T[i] = scanner.nextInt();\n scanner.close();\n\n int amount = 0;\n for(int i = 0; i < q; i++){\n if(search(0, n - 1, S, T[i]))\n amount++;\n }\n System.out.println(amount);\n }\n\n public static boolean search(int s, int e, int[] A, int p){\n if(s == e){\n if(A[s] == p)\n return true;\n else\n return false;\n }\n else{\n if(A[(s + e)/2] == p)\n return true;\n else if(A[(s + e)/2] > p)\n return search(s, (s + e)/2, A, p);\n else\n return search((s + e)/2 + 1, e, A, p);\n }\n }\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args ){
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int S[] = new int[100000];
for(int i = 0; i < n; i++)
S[i] = scanner.nextInt();
int q = scanner.nextInt();
int T[] = new int[50000];
for(int i = 0; i < q; i++)
T[i] = scanner.nextInt();
scanner.close();
int amount = 0;
for(int i = 0; i < q; i++){
if(search(0, n - 1, S, T[i]))
amount++;
}
System.out.println(amount);
}
public static boolean search(int s, int e, int[] A, int p){
if(s == e){
if(A[s] == p)
return true;
else
return false;
}
else{
if(A[(s + e)/2] == p)
return true;
else if(A[(s + e)/2] > p)
return search(s, (s + e)/2, A, p);
else
return search((s + e)/2 + 1, e, A, p);
}
}
}
|
[
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,
4,
18,
13,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
0,
13,
4,
18,
4,
18,
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,
17,
28,
13,
13,
30,
30,
41,
13,
17,
41,
13,
2,
4,
18,
13,
17,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
4,
18,
13,
4,
18,
4,
18,
13,
13,
30,
40,
13,
3,
14,
2,
4,
18,
13,
4,
18,
4,
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,
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
],
[
26,
29
],
[
29,
30
],
[
30,
31
],
[
20,
32
],
[
32,
33
],
[
32,
34
],
[
20,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
20,
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
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
62,
64
],
[
20,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
71,
72
],
[
20,
73
],
[
73,
74
],
[
73,
75
],
[
20,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
78,
83
],
[
20,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
103,
104
],
[
103,
105
],
[
20,
106
],
[
106,
107
],
[
106,
108
],
[
20,
109
],
[
109,
110
],
[
109,
111
],
[
109,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
119,
123
],
[
113,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
113,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
137,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
136,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
136,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
152,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
158,
161
],
[
151,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
162,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
151,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
175,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
183,
187
],
[
20,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
188,
193
],
[
18,
194
],
[
194,
195
],
[
0,
196
],
[
196,
197
],
[
196,
198
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br =\n\t\t\tnew BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tList<Integer> s = new ArrayList<>();\n\t\tString[] str = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tList<Integer> t = new ArrayList<>();\n\t\tstr = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint count = 0;\n\t\tfor (Integer i : t) {\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\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.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br =\n\t\t\tnew BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tList<Integer> s = new ArrayList<>();\n\t\tString[] str = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tList<Integer> t = new ArrayList<>();\n\t\tstr = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint count = 0;\n\t\tfor (Integer i : t) {\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br =\n\t\t\tnew BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tList<Integer> s = new ArrayList<>();\n\t\tString[] str = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tList<Integer> t = new ArrayList<>();\n\t\tstr = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint count = 0;\n\t\tfor (Integer i : t) {\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br =\n\t\t\tnew BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tList<Integer> s = new ArrayList<>();\n\t\tString[] str = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tList<Integer> t = new ArrayList<>();\n\t\tstr = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint count = 0;\n\t\tfor (Integer i : t) {\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader br =\n\t\t\tnew 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",
"List<Integer> s = new ArrayList<>();",
"s",
"new ArrayList<>()",
"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.add(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.add(Integer.parseInt(str[i]));\n\t\t}",
"{\n\t\t\ts.add(Integer.parseInt(str[i]));\n\t\t}",
"s.add(Integer.parseInt(str[i]))",
"s.add",
"s",
"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",
"List<Integer> t = new ArrayList<>();",
"t",
"new ArrayList<>()",
"str = br.readLine().split(\" \")",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < q; i++) {\n\t\t\tt.add(Integer.parseInt(str[i]));\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(str[i]));\n\t\t}",
"{\n\t\t\tt.add(Integer.parseInt(str[i]));\n\t\t}",
"t.add(Integer.parseInt(str[i]))",
"t.add",
"t",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int count = 0;",
"count",
"0",
"for (Integer i : t) {\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"Integer i",
"t",
"{\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int left = 0;",
"left",
"0",
"int right = s.size() - 1;",
"right",
"s.size() - 1",
"s.size()",
"s.size",
"s",
"1",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"while(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}",
"if(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"i.intValue() == s.get(mid).intValue()",
"i.intValue()",
"i.intValue",
"i",
"s.get(mid).intValue()",
"s.get(mid).intValue",
"s.get(mid)",
"s.get",
"s",
"mid",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"i.intValue() < s.get(mid).intValue()",
"i.intValue()",
"i.intValue",
"i",
"s.get(mid).intValue()",
"s.get(mid).intValue",
"s.get(mid)",
"s.get",
"s",
"mid",
"{\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br =\n\t\t\tnew BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tList<Integer> s = new ArrayList<>();\n\t\tString[] str = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tList<Integer> t = new ArrayList<>();\n\t\tstr = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint count = 0;\n\t\tfor (Integer i : t) {\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br =\n\t\t\tnew BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tList<Integer> s = new ArrayList<>();\n\t\tString[] str = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tList<Integer> t = new ArrayList<>();\n\t\tstr = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt.add(Integer.parseInt(str[i]));\n\t\t}\n\t\tint count = 0;\n\t\tfor (Integer i : t) {\n\t\t\tint left = 0;\n\t\t\tint right = s.size() - 1;\n\t\t\tint mid = (left + right) / 2;\n\t\t\twhile(left <= right) {\n\t\t\t\tif(i.intValue() == s.get(mid).intValue()) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i.intValue() < s.get(mid).intValue()) {\n\t\t\t\t\tright = mid - 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t\tmid = (left + right) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
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());
List<Integer> s = new ArrayList<>();
String[] str = br.readLine().split(" ");
for (int i = 0; i < n; i++) {
s.add(Integer.parseInt(str[i]));
}
int q = Integer.parseInt(br.readLine());
List<Integer> t = new ArrayList<>();
str = br.readLine().split(" ");
for (int i = 0; i < q; i++) {
t.add(Integer.parseInt(str[i]));
}
int count = 0;
for (Integer i : t) {
int left = 0;
int right = s.size() - 1;
int mid = (left + right) / 2;
while(left <= right) {
if(i.intValue() == s.get(mid).intValue()) {
count++;
break;
} else if (i.intValue() < s.get(mid).intValue()) {
right = mid - 1;
mid = (left + right) / 2;
} else {
left = mid + 1;
mid = (left + right) / 2;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
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,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
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
],
[
169,
5
],
[
169,
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
],
[
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
],
[
38,
39
],
[
23,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
43,
45
],
[
40,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
49,
51
],
[
40,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
6,
60
],
[
60,
61
],
[
6,
62
],
[
62,
63
],
[
169,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
73,
74
],
[
73,
75
],
[
66,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
66,
81
],
[
81,
82
],
[
81,
83
],
[
66,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
85,
96
],
[
97,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
103,
104
],
[
66,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
66,
110
],
[
110,
111
],
[
110,
112
],
[
66,
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
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
132,
133
],
[
66,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
139,
141
],
[
134,
142
],
[
142,
143
],
[
143,
144
],
[
134,
145
],
[
146,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
149,
153
],
[
153,
154
],
[
153,
155
],
[
148,
156
],
[
147,
157
],
[
157,
158
],
[
158,
159
],
[
66,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
64,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic int search(int[] s, int value) {\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\twhile( left <= right) {\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t\n//\tpublic boolean prime(int x) {\n//\t\t\n//\t\tif(x < 2) {\n//\t\t\treturn false;\n//\t\t}\n//\t\tif(x == 2) {\n//\t\t\treturn true;\n//\t\t}\n//\t\tfor(int i = 2; i <= Math.sqrt(x); i++) {\n//\t\t\tif(x % i == 0) {\n//\t\t\t\treturn false;\n//\t\t\t}\n//\t\t}\n//\t\treturn true;\n//\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tMain program = new Main();\n\t\tint results = 0;\n\t\t//System.out.println(\"enter\");\n\t\t\n\t\tint ssize = in.nextInt();\n\t\tint[] s = new int[ssize];\n\t\tfor(int i= 0; i < ssize; i++) {\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint tsize = in.nextInt();\n\t\tint[] t = new int[tsize];\n\t\tfor(int i = 0; i < tsize; i++) {\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i =0; i < tsize; i++) {\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(results);\n\t\t\n//\t\tfor(int i = 0; i < size; i++) {\n//\t\t\tint value = in.nextInt();\n//\t\t\tif(program.prime(value) == true) {\n//\t\t\t\tresults++;\n//\t\t\t}\n//\t\t}\n//\t\tSystem.out.println(results);\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\tpublic int search(int[] s, int value) {\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\twhile( left <= right) {\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t\n//\tpublic boolean prime(int x) {\n//\t\t\n//\t\tif(x < 2) {\n//\t\t\treturn false;\n//\t\t}\n//\t\tif(x == 2) {\n//\t\t\treturn true;\n//\t\t}\n//\t\tfor(int i = 2; i <= Math.sqrt(x); i++) {\n//\t\t\tif(x % i == 0) {\n//\t\t\t\treturn false;\n//\t\t\t}\n//\t\t}\n//\t\treturn true;\n//\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tMain program = new Main();\n\t\tint results = 0;\n\t\t//System.out.println(\"enter\");\n\t\t\n\t\tint ssize = in.nextInt();\n\t\tint[] s = new int[ssize];\n\t\tfor(int i= 0; i < ssize; i++) {\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint tsize = in.nextInt();\n\t\tint[] t = new int[tsize];\n\t\tfor(int i = 0; i < tsize; i++) {\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i =0; i < tsize; i++) {\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(results);\n\t\t\n//\t\tfor(int i = 0; i < size; i++) {\n//\t\t\tint value = in.nextInt();\n//\t\t\tif(program.prime(value) == true) {\n//\t\t\t\tresults++;\n//\t\t\t}\n//\t\t}\n//\t\tSystem.out.println(results);\n\t}\n}",
"Main",
"public int search(int[] s, int value) {\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\twhile( left <= right) {\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"search",
"{\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\twhile( left <= right) {\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"int left = 0;",
"left",
"0",
"int right = s.length - 1;",
"right",
"s.length - 1",
"s.length",
"s",
"s.length",
"1",
"while( left <= right) {\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}",
"int med = (left+right) / 2;",
"med",
"(left+right) / 2",
"(left+right)",
"left",
"right",
"2",
"if(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}",
"value == s[med]",
"value",
"s[med]",
"s",
"med",
"{\n\t\t\t\treturn 1;\n\t\t\t}",
"return 1;",
"1",
"if(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}",
"value < s[med]",
"value",
"s[med]",
"s",
"med",
"{\n\t\t\t\tright = med - 1;\n\t\t\t}",
"right = med - 1",
"right",
"med - 1",
"med",
"1",
"{\n\t\t\t\tleft = med + 1;\n\t\t\t}",
"left = med + 1",
"left",
"med + 1",
"med",
"1",
"return 0;",
"0",
"int[] s",
"s",
"int value",
"value",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tMain program = new Main();\n\t\tint results = 0;\n\t\t//System.out.println(\"enter\");\n\t\t\n\t\tint ssize = in.nextInt();\n\t\tint[] s = new int[ssize];\n\t\tfor(int i= 0; i < ssize; i++) {\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint tsize = in.nextInt();\n\t\tint[] t = new int[tsize];\n\t\tfor(int i = 0; i < tsize; i++) {\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i =0; i < tsize; i++) {\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(results);\n\t\t\n//\t\tfor(int i = 0; i < size; i++) {\n//\t\t\tint value = in.nextInt();\n//\t\t\tif(program.prime(value) == true) {\n//\t\t\t\tresults++;\n//\t\t\t}\n//\t\t}\n//\t\tSystem.out.println(results);\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tMain program = new Main();\n\t\tint results = 0;\n\t\t//System.out.println(\"enter\");\n\t\t\n\t\tint ssize = in.nextInt();\n\t\tint[] s = new int[ssize];\n\t\tfor(int i= 0; i < ssize; i++) {\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint tsize = in.nextInt();\n\t\tint[] t = new int[tsize];\n\t\tfor(int i = 0; i < tsize; i++) {\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i =0; i < tsize; i++) {\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(results);\n\t\t\n//\t\tfor(int i = 0; i < size; i++) {\n//\t\t\tint value = in.nextInt();\n//\t\t\tif(program.prime(value) == true) {\n//\t\t\t\tresults++;\n//\t\t\t}\n//\t\t}\n//\t\tSystem.out.println(results);\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"Main program = new Main();",
"program",
"new Main()",
"int results = 0;",
"results",
"0",
"int ssize = in.nextInt();",
"ssize",
"in.nextInt()",
"in.nextInt",
"in",
"int[] s = new int[ssize];",
"s",
"new int[ssize]",
"ssize",
"for(int i= 0; i < ssize; i++) {\n\t\t\ts[i] = in.nextInt();\n\t\t}",
"int i= 0;",
"int i= 0;",
"i",
"0",
"i < ssize",
"i",
"ssize",
"i++",
"i++",
"i",
"{\n\t\t\ts[i] = in.nextInt();\n\t\t}",
"{\n\t\t\ts[i] = in.nextInt();\n\t\t}",
"s[i] = in.nextInt()",
"s[i]",
"s",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int tsize = in.nextInt();",
"tsize",
"in.nextInt()",
"in.nextInt",
"in",
"int[] t = new int[tsize];",
"t",
"new int[tsize]",
"tsize",
"for(int i = 0; i < tsize; i++) {\n\t\t\tt[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < tsize",
"i",
"tsize",
"i++",
"i++",
"i",
"{\n\t\t\tt[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tt[i] = in.nextInt();\n\t\t}",
"t[i] = in.nextInt()",
"t[i]",
"t",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"for(int i =0; i < tsize; i++) {\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}",
"int i =0;",
"int i =0;",
"i",
"0",
"i < tsize",
"i",
"tsize",
"i++",
"i++",
"i",
"{\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}",
"if((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}",
"(program.search(s, t[i])) == 1",
"(program.search(s, t[i]))",
"program.search",
"program",
"s",
"t[i]",
"t",
"i",
"1",
"{\n\t\t\t\tresults++;\n\t\t\t}",
"results++",
"results",
"System.out.println(results)",
"System.out.println",
"System.out",
"System",
"System.out",
"results",
"String[] args",
"args",
"public class Main {\n\t\n\tpublic int search(int[] s, int value) {\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\twhile( left <= right) {\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t\n//\tpublic boolean prime(int x) {\n//\t\t\n//\t\tif(x < 2) {\n//\t\t\treturn false;\n//\t\t}\n//\t\tif(x == 2) {\n//\t\t\treturn true;\n//\t\t}\n//\t\tfor(int i = 2; i <= Math.sqrt(x); i++) {\n//\t\t\tif(x % i == 0) {\n//\t\t\t\treturn false;\n//\t\t\t}\n//\t\t}\n//\t\treturn true;\n//\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tMain program = new Main();\n\t\tint results = 0;\n\t\t//System.out.println(\"enter\");\n\t\t\n\t\tint ssize = in.nextInt();\n\t\tint[] s = new int[ssize];\n\t\tfor(int i= 0; i < ssize; i++) {\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint tsize = in.nextInt();\n\t\tint[] t = new int[tsize];\n\t\tfor(int i = 0; i < tsize; i++) {\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i =0; i < tsize; i++) {\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(results);\n\t\t\n//\t\tfor(int i = 0; i < size; i++) {\n//\t\t\tint value = in.nextInt();\n//\t\t\tif(program.prime(value) == true) {\n//\t\t\t\tresults++;\n//\t\t\t}\n//\t\t}\n//\t\tSystem.out.println(results);\n\t}\n}",
"public class Main {\n\t\n\tpublic int search(int[] s, int value) {\n\t\tint left = 0;\n\t\tint right = s.length - 1;\n\t\twhile( left <= right) {\n\t\t\tint med = (left+right) / 2;\n\t\t\t\n\t\t\tif(value == s[med]) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(value < s[med]) {\n\t\t\t\tright = med - 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = med + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t\n//\tpublic boolean prime(int x) {\n//\t\t\n//\t\tif(x < 2) {\n//\t\t\treturn false;\n//\t\t}\n//\t\tif(x == 2) {\n//\t\t\treturn true;\n//\t\t}\n//\t\tfor(int i = 2; i <= Math.sqrt(x); i++) {\n//\t\t\tif(x % i == 0) {\n//\t\t\t\treturn false;\n//\t\t\t}\n//\t\t}\n//\t\treturn true;\n//\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tMain program = new Main();\n\t\tint results = 0;\n\t\t//System.out.println(\"enter\");\n\t\t\n\t\tint ssize = in.nextInt();\n\t\tint[] s = new int[ssize];\n\t\tfor(int i= 0; i < ssize; i++) {\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint tsize = in.nextInt();\n\t\tint[] t = new int[tsize];\n\t\tfor(int i = 0; i < tsize; i++) {\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i =0; i < tsize; i++) {\n\t\t\tif((program.search(s, t[i])) == 1){\n\t\t\t\tresults++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(results);\n\t\t\n//\t\tfor(int i = 0; i < size; i++) {\n//\t\t\tint value = in.nextInt();\n//\t\t\tif(program.prime(value) == true) {\n//\t\t\t\tresults++;\n//\t\t\t}\n//\t\t}\n//\t\tSystem.out.println(results);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public int search(int[] s, int value) {
int left = 0;
int right = s.length - 1;
while( left <= right) {
int med = (left+right) / 2;
if(value == s[med]) {
return 1;
}
if(value < s[med]) {
right = med - 1;
}
else {
left = med + 1;
}
}
return 0;
}
// public boolean prime(int x) {
//
// if(x < 2) {
// return false;
// }
// if(x == 2) {
// return true;
// }
// for(int i = 2; i <= Math.sqrt(x); i++) {
// if(x % i == 0) {
// return false;
// }
// }
// return true;
// }
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Main program = new Main();
int results = 0;
//System.out.println("enter");
int ssize = in.nextInt();
int[] s = new int[ssize];
for(int i= 0; i < ssize; i++) {
s[i] = in.nextInt();
}
int tsize = in.nextInt();
int[] t = new int[tsize];
for(int i = 0; i < tsize; i++) {
t[i] = in.nextInt();
}
for(int i =0; i < tsize; i++) {
if((program.search(s, t[i])) == 1){
results++;
}
}
System.out.println(results);
// for(int i = 0; i < size; i++) {
// int value = in.nextInt();
// if(program.prime(value) == true) {
// results++;
// }
// }
// System.out.println(results);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
17,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
41,
13,
17,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
4,
13,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
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
],
[
11,
13
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
75,
78
],
[
75,
79
],
[
74,
80
],
[
80,
81
],
[
8,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
6,
88
],
[
88,
89
],
[
146,
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
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
119,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
121,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
92,
137
],
[
137,
138
],
[
90,
139
],
[
139,
140
],
[
90,
141
],
[
141,
142
],
[
90,
143
],
[
143,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
]
] | [
"import java.util.Scanner;public class Main {\tpublic static void main(String[] args) {\t\tint n, sum = 0;\t\tScanner sc = new Scanner(System.in);\t\tn = sc.nextInt();\t\tint[] S = new int[100001];\t\tfor (int i = 0; i < n; i++) {\t\t\tS[i] = sc.nextInt();\t\t}\t\tint q, key = 0;\t\tq = sc.nextInt();\t\tfor (int i = 0; i < q; i++) {\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}\t\tSystem.out.println(sum);\t}\tprivate static boolean binarySearch(int[] S, int n, int key) {\t\tint left = 0;\t\tint right = n - 1;\t\twhile (left <= right) {\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}\t\treturn false;\t}}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\tpublic static void main(String[] args) {\t\tint n, sum = 0;\t\tScanner sc = new Scanner(System.in);\t\tn = sc.nextInt();\t\tint[] S = new int[100001];\t\tfor (int i = 0; i < n; i++) {\t\t\tS[i] = sc.nextInt();\t\t}\t\tint q, key = 0;\t\tq = sc.nextInt();\t\tfor (int i = 0; i < q; i++) {\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}\t\tSystem.out.println(sum);\t}\tprivate static boolean binarySearch(int[] S, int n, int key) {\t\tint left = 0;\t\tint right = n - 1;\t\twhile (left <= right) {\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}\t\treturn false;\t}}",
"Main",
"public static void main(String[] args) {\t\tint n, sum = 0;\t\tScanner sc = new Scanner(System.in);\t\tn = sc.nextInt();\t\tint[] S = new int[100001];\t\tfor (int i = 0; i < n; i++) {\t\t\tS[i] = sc.nextInt();\t\t}\t\tint q, key = 0;\t\tq = sc.nextInt();\t\tfor (int i = 0; i < q; i++) {\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}\t\tSystem.out.println(sum);\t}",
"main",
"{\t\tint n, sum = 0;\t\tScanner sc = new Scanner(System.in);\t\tn = sc.nextInt();\t\tint[] S = new int[100001];\t\tfor (int i = 0; i < n; i++) {\t\t\tS[i] = sc.nextInt();\t\t}\t\tint q, key = 0;\t\tq = sc.nextInt();\t\tfor (int i = 0; i < q; i++) {\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}\t\tSystem.out.println(sum);\t}",
"int n",
"n",
"sum = 0;",
"sum",
"0",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[100001];",
"S",
"new int[100001]",
"100001",
"for (int i = 0; i < n; i++) {\t\t\tS[i] = sc.nextInt();\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\t\t\tS[i] = sc.nextInt();\t\t}",
"{\t\t\tS[i] = sc.nextInt();\t\t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q",
"q",
"key = 0;",
"key",
"0",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < q; i++) {\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}",
"{\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}",
"key = sc.nextInt()",
"key",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (binarySearch(S, n, key))\t\t\t\tsum++;",
"binarySearch(S, n, key)",
"binarySearch",
"S",
"n",
"key",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"private static boolean binarySearch(int[] S, int n, int key) {\t\tint left = 0;\t\tint right = n - 1;\t\twhile (left <= right) {\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}\t\treturn false;\t}",
"binarySearch",
"{\t\tint left = 0;\t\tint right = n - 1;\t\twhile (left <= right) {\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}\t\treturn false;\t}",
"int left = 0;",
"left",
"0",
"int right = n - 1;",
"right",
"n - 1",
"n",
"1",
"while (left <= right) {\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}",
"left <= right",
"left",
"right",
"{\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;",
"key == S[mid]",
"key",
"S[mid]",
"S",
"mid",
"return true;",
"true",
"if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;",
"key > S[mid]",
"key",
"S[mid]",
"S",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"return false;",
"false",
"int[] S",
"S",
"int n",
"n",
"int key",
"key",
"public class Main {\tpublic static void main(String[] args) {\t\tint n, sum = 0;\t\tScanner sc = new Scanner(System.in);\t\tn = sc.nextInt();\t\tint[] S = new int[100001];\t\tfor (int i = 0; i < n; i++) {\t\t\tS[i] = sc.nextInt();\t\t}\t\tint q, key = 0;\t\tq = sc.nextInt();\t\tfor (int i = 0; i < q; i++) {\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}\t\tSystem.out.println(sum);\t}\tprivate static boolean binarySearch(int[] S, int n, int key) {\t\tint left = 0;\t\tint right = n - 1;\t\twhile (left <= right) {\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}\t\treturn false;\t}}",
"public class Main {\tpublic static void main(String[] args) {\t\tint n, sum = 0;\t\tScanner sc = new Scanner(System.in);\t\tn = sc.nextInt();\t\tint[] S = new int[100001];\t\tfor (int i = 0; i < n; i++) {\t\t\tS[i] = sc.nextInt();\t\t}\t\tint q, key = 0;\t\tq = sc.nextInt();\t\tfor (int i = 0; i < q; i++) {\t\t\tkey = sc.nextInt();\t\t\tif (binarySearch(S, n, key))\t\t\t\tsum++;\t\t}\t\tSystem.out.println(sum);\t}\tprivate static boolean binarySearch(int[] S, int n, int key) {\t\tint left = 0;\t\tint right = n - 1;\t\twhile (left <= right) {\t\t\tint mid = (left + right) / 2;\t\t\tif (key == S[mid])\t\t\t\treturn true;\t\t\telse if (key > S[mid])\t\t\t\tleft = mid + 1;\t\t\telse\t\t\t\tright = mid - 1;\t\t}\t\treturn false;\t}}",
"Main"
] | import java.util.Scanner;public class Main { public static void main(String[] args) { int n, sum = 0; Scanner sc = new Scanner(System.in); n = sc.nextInt(); int[] S = new int[100001]; for (int i = 0; i < n; i++) { S[i] = sc.nextInt(); } int q, key = 0; q = sc.nextInt(); for (int i = 0; i < q; i++) { key = sc.nextInt(); if (binarySearch(S, n, key)) sum++; } System.out.println(sum); } private static boolean binarySearch(int[] S, int n, int key) { int left = 0; int right = n - 1; while (left <= right) { int mid = (left + right) / 2; if (key == S[mid]) return true; else if (key > S[mid]) left = mid + 1; else right = mid - 1; } return false; }}
|
[
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,
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,
0,
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,
41,
13,
17,
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,
42,
2,
13,
18,
13,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
0,
13,
13,
3,
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
],
[
187,
20
],
[
187,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
23,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
23,
43
],
[
43,
44
],
[
43,
45
],
[
23,
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
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
67,
69
],
[
23,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
75,
76
],
[
76,
77
],
[
23,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
80,
85
],
[
23,
86
],
[
86,
87
],
[
86,
88
],
[
23,
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
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
23,
113
],
[
113,
114
],
[
23,
115
],
[
115,
116
],
[
115,
117
],
[
23,
118
],
[
118,
119
],
[
118,
120
],
[
23,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
23,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
23,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
129,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
144,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
156,
157
],
[
156,
158
],
[
151,
159
],
[
159,
160
],
[
151,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
166,
168
],
[
161,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
172,
173
],
[
172,
174
],
[
169,
175
],
[
150,
176
],
[
176,
177
],
[
23,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
178,
183
],
[
21,
184
],
[
184,
185
],
[
0,
186
],
[
186,
187
],
[
186,
188
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.HashSet;\nimport java.util.Arrays;\n\n/*Question\nn ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°???????????????????????????????????? \n*/\n\n/*Input\n???????????? n??????????????? S ?????¨??? n ????????´??°??????????????? q??????????????? T ?????¨??? q ????????´??°???????????????????????? \n*/\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\t//??\\???\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\t\tn = Integer.parseInt(br.readLine());\n\t\ttmp = br.readLine().split(\" \");\n\t\tint[] t = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\n\t\t//?¨??????¨\n\t\tint len; //??????????????????????¨????\n\t\tint b = 0;\n\n\t\t//????????¨ - ?????´?????????????????°????¨????\n\t\tint count = 0;\n\n\t\t//??´?????????\n\t\tArrays.sort(s);\n\t\tArrays.sort(t);\n\n\t\t/*????????????????????????\n\t\t/????????????????????´?????\\?????§??¢?´¢??????????????????????????¨??????????????????????????£???\n\t\t*/\n\t\tfor (int a = 0;a < t.length;a++){\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\n\t\t//??????\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\t//??\\???\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\t\tn = Integer.parseInt(br.readLine());\n\t\ttmp = br.readLine().split(\" \");\n\t\tint[] t = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\n\t\t//?¨??????¨\n\t\tint len; //??????????????????????¨????\n\t\tint b = 0;\n\n\t\t//????????¨ - ?????´?????????????????°????¨????\n\t\tint count = 0;\n\n\t\t//??´?????????\n\t\tArrays.sort(s);\n\t\tArrays.sort(t);\n\n\t\t/*????????????????????????\n\t\t/????????????????????´?????\\?????§??¢?´¢??????????????????????????¨??????????????????????????£???\n\t\t*/\n\t\tfor (int a = 0;a < t.length;a++){\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\n\t\t//??????\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\t//??\\???\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\t\tn = Integer.parseInt(br.readLine());\n\t\ttmp = br.readLine().split(\" \");\n\t\tint[] t = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\n\t\t//?¨??????¨\n\t\tint len; //??????????????????????¨????\n\t\tint b = 0;\n\n\t\t//????????¨ - ?????´?????????????????°????¨????\n\t\tint count = 0;\n\n\t\t//??´?????????\n\t\tArrays.sort(s);\n\t\tArrays.sort(t);\n\n\t\t/*????????????????????????\n\t\t/????????????????????´?????\\?????§??¢?´¢??????????????????????????¨??????????????????????????£???\n\t\t*/\n\t\tfor (int a = 0;a < t.length;a++){\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\n\t\t//??????\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\t//??\\???\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\t\tn = Integer.parseInt(br.readLine());\n\t\ttmp = br.readLine().split(\" \");\n\t\tint[] t = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\n\t\t//?¨??????¨\n\t\tint len; //??????????????????????¨????\n\t\tint b = 0;\n\n\t\t//????????¨ - ?????´?????????????????°????¨????\n\t\tint count = 0;\n\n\t\t//??´?????????\n\t\tArrays.sort(s);\n\t\tArrays.sort(t);\n\n\t\t/*????????????????????????\n\t\t/????????????????????´?????\\?????§??¢?´¢??????????????????????????¨??????????????????????????£???\n\t\t*/\n\t\tfor (int a = 0;a < t.length;a++){\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\n\t\t//??????\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",
"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 a = 0;a < n;a++){\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}",
"int a = 0;",
"int a = 0;",
"a",
"0",
"a < n",
"a",
"n",
"a++",
"a++",
"a",
"{\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}",
"{\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}",
"s[a] = Integer.parseInt(tmp[a])",
"s[a]",
"s",
"a",
"Integer.parseInt(tmp[a])",
"Integer.parseInt",
"Integer",
"tmp[a]",
"tmp",
"a",
"n = Integer.parseInt(br.readLine())",
"n",
"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[] t = new int[n];",
"t",
"new int[n]",
"n",
"for (int a = 0;a < n;a++){\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}",
"int a = 0;",
"int a = 0;",
"a",
"0",
"a < n",
"a",
"n",
"a++",
"a++",
"a",
"{\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}",
"{\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}",
"t[a] = Integer.parseInt(tmp[a])",
"t[a]",
"t",
"a",
"Integer.parseInt(tmp[a])",
"Integer.parseInt",
"Integer",
"tmp[a]",
"tmp",
"a",
"int len;",
"len",
"int b = 0;",
"b",
"0",
"int count = 0;",
"count",
"0",
"Arrays.sort(s)",
"Arrays.sort",
"Arrays",
"s",
"Arrays.sort(t)",
"Arrays.sort",
"Arrays",
"t",
"for (int a = 0;a < t.length;a++){\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}",
"int a = 0;",
"int a = 0;",
"a",
"0",
"a < t.length",
"a",
"t.length",
"t",
"t.length",
"a++",
"a++",
"a",
"{\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}",
"{\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}",
"while (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}",
"b < s.length",
"b",
"s.length",
"s",
"s.length",
"{\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}",
"if (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"t[a] < s[b]",
"t[a]",
"t",
"a",
"s[b]",
"s",
"b",
"{\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"break;",
"if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"t[a] == s[b]",
"t[a]",
"t",
"a",
"s[b]",
"s",
"b",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"len = b",
"len",
"b",
"break;",
"b++",
"b",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\t//??\\???\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\t\tn = Integer.parseInt(br.readLine());\n\t\ttmp = br.readLine().split(\" \");\n\t\tint[] t = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\n\t\t//?¨??????¨\n\t\tint len; //??????????????????????¨????\n\t\tint b = 0;\n\n\t\t//????????¨ - ?????´?????????????????°????¨????\n\t\tint count = 0;\n\n\t\t//??´?????????\n\t\tArrays.sort(s);\n\t\tArrays.sort(t);\n\n\t\t/*????????????????????????\n\t\t/????????????????????´?????\\?????§??¢?´¢??????????????????????????¨??????????????????????????£???\n\t\t*/\n\t\tfor (int a = 0;a < t.length;a++){\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\n\t\t//??????\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\t//??\\???\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\ts[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\t\tn = Integer.parseInt(br.readLine());\n\t\ttmp = br.readLine().split(\" \");\n\t\tint[] t = new int[n];\n\t\tfor (int a = 0;a < n;a++){\n\t\t\tt[a] = Integer.parseInt(tmp[a]);\n\t\t}\n\n\t\t//?¨??????¨\n\t\tint len; //??????????????????????¨????\n\t\tint b = 0;\n\n\t\t//????????¨ - ?????´?????????????????°????¨????\n\t\tint count = 0;\n\n\t\t//??´?????????\n\t\tArrays.sort(s);\n\t\tArrays.sort(t);\n\n\t\t/*????????????????????????\n\t\t/????????????????????´?????\\?????§??¢?´¢??????????????????????????¨??????????????????????????£???\n\t\t*/\n\t\tfor (int a = 0;a < t.length;a++){\n\t\t\twhile (b < s.length) {\n\t\t\t\tif (t[a] < s[b]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t[a] == s[b]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tlen = b;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t}\n\t\t}\n\n\t\t//??????\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.util.Arrays;
/*Question
n ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°????????????????????????????????????
*/
/*Input
???????????? n??????????????? S ?????¨??? n ????????´??°??????????????? q??????????????? T ?????¨??? q ????????´??°????????????????????????
*/
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[] tmp = br.readLine().split(" ");
int[] s = new int[n];
for (int a = 0;a < n;a++){
s[a] = Integer.parseInt(tmp[a]);
}
n = Integer.parseInt(br.readLine());
tmp = br.readLine().split(" ");
int[] t = new int[n];
for (int a = 0;a < n;a++){
t[a] = Integer.parseInt(tmp[a]);
}
//?¨??????¨
int len; //??????????????????????¨????
int b = 0;
//????????¨ - ?????´?????????????????°????¨????
int count = 0;
//??´?????????
Arrays.sort(s);
Arrays.sort(t);
/*????????????????????????
/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
*/
for (int a = 0;a < t.length;a++){
while (b < s.length) {
if (t[a] < s[b]) {
break;
} else if (t[a] == s[b]) {
count++;
len = b;
break;
}
b++;
}
}
//??????
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
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,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
0,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
18,
13,
13,
40,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
29,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
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
],
[
238,
11
],
[
238,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
32,
37
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
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
],
[
14,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
75,
80
],
[
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
],
[
114,
115
],
[
114,
116
],
[
107,
117
],
[
117,
118
],
[
118,
119
],
[
107,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
124,
127
],
[
127,
128
],
[
127,
129
],
[
123,
130
],
[
130,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
14,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
12,
141
],
[
141,
142
],
[
238,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
145,
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
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
165,
171
],
[
171,
172
],
[
172,
173
],
[
145,
174
],
[
174,
175
],
[
143,
176
],
[
176,
177
],
[
143,
178
],
[
178,
179
],
[
238,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
188,
190
],
[
182,
191
],
[
191,
192
],
[
182,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
193,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
197,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
206,
210
],
[
205,
211
],
[
211,
212
],
[
212,
213
],
[
205,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
217,
219
],
[
214,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
214,
224
],
[
224,
225
],
[
225,
226
],
[
225,
227
],
[
227,
228
],
[
227,
229
],
[
182,
230
],
[
230,
231
],
[
231,
232
],
[
180,
233
],
[
233,
234
],
[
180,
235
],
[
235,
236
],
[
0,
237
],
[
237,
238
],
[
237,
239
]
] | [
"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 NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n];\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tstrArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < T.length ; i++){\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tstatic int linearSearch (int[] array , int key){\n\t\tint result = -1;\n\t\t\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\t\n\tstatic int binarySearch(int[] array, int key){\n\t\tint left = 0;\n\t\tint right = array.length;\n\t\tint mid;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n];\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tstrArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < T.length ; i++){\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tstatic int linearSearch (int[] array , int key){\n\t\tint result = -1;\n\t\t\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\t\n\tstatic int binarySearch(int[] array, int key){\n\t\tint left = 0;\n\t\tint right = array.length;\n\t\tint mid;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n];\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tstrArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < T.length ; i++){\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n];\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tstrArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < T.length ; i++){\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\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",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"String[] strArray = br.readLine().split(\" \");",
"strArray",
"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(strArray[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(strArray[i]);\n\t\t}",
"{\n\t\t\tS[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"S[i] = Integer.parseInt(strArray[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(strArray[i])",
"Integer.parseInt",
"Integer",
"strArray[i]",
"strArray",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"strArray = br.readLine().split(\" \")",
"strArray",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"{\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"T[i] = Integer.parseInt(strArray[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(strArray[i])",
"Integer.parseInt",
"Integer",
"strArray[i]",
"strArray",
"i",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < T.length ; i++){\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\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\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"if(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}",
"binarySearch(S, T[i]) != -1",
"binarySearch(S, T[i])",
"binarySearch",
"S",
"T[i]",
"T",
"i",
"-1",
"1",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static int linearSearch (int[] array , int key){\n\t\tint result = -1;\n\t\t\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}",
"linearSearch",
"{\n\t\tint result = -1;\n\t\t\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}",
"int result = -1;",
"result",
"-1",
"1",
"for(int i = 0; i < array.length ;i++){\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}",
"if(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}",
"array[i] == key",
"array[i]",
"array",
"i",
"key",
"{\n\t\t\t\treturn i;\n\t\t\t}",
"return i;",
"i",
"return result;",
"result",
"int[] array",
"array",
"int key",
"key",
"static int binarySearch(int[] array, int key){\n\t\tint left = 0;\n\t\tint right = array.length;\n\t\tint mid;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = array.length;\n\t\tint mid;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}",
"int left = 0;",
"left",
"0",
"int right = array.length;",
"right",
"array.length",
"array",
"array.length",
"int mid;",
"mid",
"while(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"array[mid] == key",
"array[mid]",
"array",
"mid",
"key",
"{\n\t\t\t\treturn mid;\n\t\t\t}",
"return mid;",
"mid",
"if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"key < array[mid]",
"key",
"array[mid]",
"array",
"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[] array",
"array",
"int key",
"key",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n];\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tstrArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < T.length ; i++){\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tstatic int linearSearch (int[] array , int key){\n\t\tint result = -1;\n\t\t\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\t\n\tstatic int binarySearch(int[] array, int key){\n\t\tint left = 0;\n\t\tint right = array.length;\n\t\tint mid;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n];\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tstrArray = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(strArray[i]);\n\t\t}\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < T.length ; i++){\n\t\t\t//if(linearSearch(S, T[i]) != -1){\n\t\t\tif(binarySearch(S, T[i]) != -1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tstatic int linearSearch (int[] array , int key){\n\t\tint result = -1;\n\t\t\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tif(array[i] == key){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}\n\t\n\tstatic int binarySearch(int[] array, int key){\n\t\tint left = 0;\n\t\tint right = array.length;\n\t\tint mid;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(array[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(key < array[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\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) throws NumberFormatException, IOException {
// TODO ?????????????????????????????????????????????
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] S = new int[n];
String[] strArray = br.readLine().split(" ");
for(int i = 0; i < n; i++){
S[i] = Integer.parseInt(strArray[i]);
}
int q = Integer.parseInt(br.readLine());
int[] T = new int[q];
strArray = br.readLine().split(" ");
for(int i = 0; i < q; i++){
T[i] = Integer.parseInt(strArray[i]);
}
int count = 0;
for(int i = 0; i < T.length ; i++){
//if(linearSearch(S, T[i]) != -1){
if(binarySearch(S, T[i]) != -1){
count++;
}
}
System.out.println(count);
}
static int linearSearch (int[] array , int key){
int result = -1;
for(int i = 0; i < array.length ;i++){
if(array[i] == key){
return i;
}
}
return result;
}
static int binarySearch(int[] array, int key){
int left = 0;
int right = array.length;
int mid;
while(left < right){
mid = (left + right) / 2;
if(array[mid] == key){
return mid;
}
else if(key < array[mid]){
right = mid;
}
else {
left = mid + 1;
}
}
return -1;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
2,
2,
18,
13,
13,
17,
17,
41,
13,
18,
13,
13,
42,
2,
2,
13,
13,
17,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
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,
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
],
[
151,
5
],
[
151,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
69,
70
],
[
70,
71
],
[
63,
72
],
[
72,
73
],
[
72,
74
],
[
63,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
77,
83
],
[
63,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
63,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
95,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
106,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
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
],
[
123,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
8,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
6,
148
],
[
148,
149
],
[
0,
150
],
[
150,
151
],
[
150,
152
]
] | [
"import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),T[]=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());\n\t\t\n\t\tint q=cin.nextInt(),res=0;\n\t\tfor(int i=0;i<q;i++) {\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(res);\n\t}\n\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),T[]=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());\n\t\t\n\t\tint q=cin.nextInt(),res=0;\n\t\tfor(int i=0;i<q;i++) {\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(res);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),T[]=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());\n\t\t\n\t\tint q=cin.nextInt(),res=0;\n\t\tfor(int i=0;i<q;i++) {\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(res);\n\t}",
"main",
"{\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),T[]=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());\n\t\t\n\t\tint q=cin.nextInt(),res=0;\n\t\tfor(int i=0;i<q;i++) {\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(res);\n\t}",
"Scanner cin=new Scanner(System.in);",
"cin",
"new Scanner(System.in)",
"int n=cin.nextInt()",
"n",
"cin.nextInt()",
"cin.nextInt",
"cin",
"T[]=new int[n];",
"T",
"new int[n]",
"n",
"for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"T[i]=Integer.parseInt(cin.next());",
"T[i]=Integer.parseInt(cin.next())",
"T[i]",
"T",
"i",
"Integer.parseInt(cin.next())",
"Integer.parseInt",
"Integer",
"cin.next()",
"cin.next",
"cin",
"int q=cin.nextInt()",
"q",
"cin.nextInt()",
"cin.nextInt",
"cin",
"res=0;",
"res",
"0",
"for(int i=0;i<q;i++) {\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\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(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int t=Integer.parseInt(cin.next())",
"t",
"Integer.parseInt(cin.next())",
"Integer.parseInt",
"Integer",
"cin.next()",
"cin.next",
"cin",
"s=0",
"s",
"0",
"m=(T.length-1)/2",
"m",
"(T.length-1)/2",
"(T.length-1)",
"T.length",
"T",
"T.length",
"1",
"2",
"g=T.length;",
"g",
"T.length",
"T",
"T.length",
"while(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}",
"g-s>=1",
"g-s",
"g",
"s",
"1",
"{\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}",
"if(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"T[m]==t",
"T[m]",
"T",
"m",
"t",
"{\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"res++",
"res",
"break;",
"if(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}",
"T[m]>t",
"T[m]",
"T",
"m",
"t",
"{\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}",
"g=m",
"g",
"m",
"m=(s+g)/2",
"m",
"(s+g)/2",
"(s+g)",
"s",
"g",
"2",
"if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}",
"T[m]<t",
"T[m]",
"T",
"m",
"t",
"{\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}",
"s=m+1",
"s",
"m+1",
"m",
"1",
"m=(s+g)/2",
"m",
"(s+g)/2",
"(s+g)",
"s",
"g",
"2",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),T[]=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());\n\t\t\n\t\tint q=cin.nextInt(),res=0;\n\t\tfor(int i=0;i<q;i++) {\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(res);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),T[]=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());\n\t\t\n\t\tint q=cin.nextInt(),res=0;\n\t\tfor(int i=0;i<q;i++) {\n\t\t\tint t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;\n\t\t\twhile(g-s>=1) {\n\t\t\t\tif(T[m]==t) {\n\t\t\t\t\tres++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(T[m]>t) {\n\t\t\t\t\tg=m;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t\telse if(T[m]<t) {\n\t\t\t\t\ts=m+1;\n\t\t\t\t\tm=(s+g)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(res);\n\t}\n\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
int n=cin.nextInt(),T[]=new int[n];
for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
int q=cin.nextInt(),res=0;
for(int i=0;i<q;i++) {
int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
while(g-s>=1) {
if(T[m]==t) {
res++;
break;
}
if(T[m]>t) {
g=m;
m=(s+g)/2;
}
else if(T[m]<t) {
s=m+1;
m=(s+g)/2;
}
}
}
System.out.println(res);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
20,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
13,
4,
13,
12,
13,
30,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
13,
4,
13,
12,
13,
30,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
0,
13,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
12,
13,
30,
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
],
[
4,
8
],
[
8,
9
],
[
4,
10
],
[
10,
11
],
[
10,
12
],
[
4,
13
],
[
13,
14
],
[
4,
15
],
[
15,
16
],
[
4,
17
],
[
17,
18
],
[
4,
19
],
[
19,
20
],
[
4,
21
],
[
21,
22
],
[
4,
23
],
[
23,
24
],
[
4,
25
],
[
25,
26
],
[
25,
27
],
[
4,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
30,
36
],
[
36,
37
],
[
36,
38
],
[
30,
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
],
[
30,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
30,
64
],
[
64,
65
],
[
64,
66
],
[
30,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
30,
87
],
[
87,
88
],
[
30,
89
],
[
89,
90
],
[
4,
91
],
[
91,
92
],
[
91,
93
],
[
93,
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
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
106,
113
],
[
113,
114
],
[
4,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
122,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
135,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
141,
142
],
[
141,
143
],
[
130,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
150,
152
],
[
145,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
145,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
4,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
4,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
172,
178
],
[
178,
179
]
] | [
"import java.util.*;\n\nclass Main{\n\t\n\tint n, q;int count=0;int j, L, R, mid;\n\tint[] S ;int[] T;\n\tScanner sc = new Scanner(System.in);\n\t\n\tvoid input(){\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++)S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int j=0; j<q; j++)T[j] = sc.nextInt();\n\t\tsearch();\n\t\toutput();\n\t}\n\tvoid search(){\n\t\tfor(j=0; j<q; j++){\n\t\t\tL=0; R=n;\n\t\t\tmidd();\n\t\t}\n\t}\n\tvoid midd(){\n\t\twhile(L!=R){\n\t\t\tmid=(L+R)/2;\n\t\t\tif(S[mid]==T[j]){\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}else{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvoid output(){\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void main(String[] args){\n\t\tnew Main().input();\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\t\n\tint n, q;int count=0;int j, L, R, mid;\n\tint[] S ;int[] T;\n\tScanner sc = new Scanner(System.in);\n\t\n\tvoid input(){\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++)S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int j=0; j<q; j++)T[j] = sc.nextInt();\n\t\tsearch();\n\t\toutput();\n\t}\n\tvoid search(){\n\t\tfor(j=0; j<q; j++){\n\t\t\tL=0; R=n;\n\t\t\tmidd();\n\t\t}\n\t}\n\tvoid midd(){\n\t\twhile(L!=R){\n\t\t\tmid=(L+R)/2;\n\t\t\tif(S[mid]==T[j]){\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}else{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvoid output(){\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void main(String[] args){\n\t\tnew Main().input();\n\t}\n}",
"Main",
"int n",
"n",
"q;",
"q",
"int count=0;",
"count",
"0",
"int j",
"j",
"L",
"L",
"R",
"R",
"mid;",
"mid",
"int[] S ;",
"S",
"int[] T;",
"T",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"void input(){\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++)S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int j=0; j<q; j++)T[j] = sc.nextInt();\n\t\tsearch();\n\t\toutput();\n\t}",
"input",
"{\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++)S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int j=0; j<q; j++)T[j] = sc.nextInt();\n\t\tsearch();\n\t\toutput();\n\t}",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S = new int[n]",
"S",
"new int[n]",
"n",
"for(int i=0; i<n; i++)S[i] = sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = sc.nextInt();",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"T = new int[q]",
"T",
"new int[q]",
"q",
"for(int j=0; j<q; j++)T[j] = sc.nextInt();",
"int j=0;",
"int j=0;",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"T[j] = sc.nextInt();",
"T[j] = sc.nextInt()",
"T[j]",
"T",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"search()",
"search",
"output()",
"output",
"void search(){\n\t\tfor(j=0; j<q; j++){\n\t\t\tL=0; R=n;\n\t\t\tmidd();\n\t\t}\n\t}",
"search",
"{\n\t\tfor(j=0; j<q; j++){\n\t\t\tL=0; R=n;\n\t\t\tmidd();\n\t\t}\n\t}",
"for(j=0; j<q; j++){\n\t\t\tL=0; R=n;\n\t\t\tmidd();\n\t\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tL=0; R=n;\n\t\t\tmidd();\n\t\t}",
"{\n\t\t\tL=0; R=n;\n\t\t\tmidd();\n\t\t}",
"L=0",
"L",
"0",
"R=n",
"R",
"n",
"midd()",
"midd",
"void midd(){\n\t\twhile(L!=R){\n\t\t\tmid=(L+R)/2;\n\t\t\tif(S[mid]==T[j]){\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}else{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"midd",
"{\n\t\twhile(L!=R){\n\t\t\tmid=(L+R)/2;\n\t\t\tif(S[mid]==T[j]){\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}else{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"while(L!=R){\n\t\t\tmid=(L+R)/2;\n\t\t\tif(S[mid]==T[j]){\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}else{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"L!=R",
"L",
"R",
"{\n\t\t\tmid=(L+R)/2;\n\t\t\tif(S[mid]==T[j]){\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}else{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"mid=(L+R)/2",
"mid",
"(L+R)/2",
"(L+R)",
"L",
"R",
"2",
"if(S[mid]==T[j]){\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}else{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}",
"S[mid]==T[j]",
"S[mid]",
"S",
"mid",
"T[j]",
"T",
"j",
"{\n\t\t\t\tcount++;\n\t\t\t\tL=R;\n\t\t\t}",
"count++",
"count",
"L=R",
"L",
"R",
"{\n\t\t\t\tif(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}\n\t\t\t}",
"if(S[mid]>T[j]){\n\t\t\t\t\tR=mid;\n\t\t\t\t}else{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}",
"S[mid]>T[j]",
"S[mid]",
"S",
"mid",
"T[j]",
"T",
"j",
"{\n\t\t\t\t\tR=mid;\n\t\t\t\t}",
"R=mid",
"R",
"mid",
"{\n\t\t\t\t\tL=mid+1;\n\t\t\t\t}",
"L=mid+1",
"L",
"mid+1",
"mid",
"1",
"void output(){\n\t\tSystem.out.println(count);\n\t}",
"output",
"{\n\t\tSystem.out.println(count);\n\t}",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"public static void main(String[] args){\n\t\tnew Main().input();\n\t}",
"main",
"{\n\t\tnew Main().input();\n\t}",
"new Main().input()",
"new Main().input",
"new Main()",
"String[] args",
"args"
] | import java.util.*;
class Main{
int n, q;int count=0;int j, L, R, mid;
int[] S ;int[] T;
Scanner sc = new Scanner(System.in);
void input(){
n = sc.nextInt();
S = new int[n];
for(int i=0; i<n; i++)S[i] = sc.nextInt();
q = sc.nextInt();
T = new int[q];
for(int j=0; j<q; j++)T[j] = sc.nextInt();
search();
output();
}
void search(){
for(j=0; j<q; j++){
L=0; R=n;
midd();
}
}
void midd(){
while(L!=R){
mid=(L+R)/2;
if(S[mid]==T[j]){
count++;
L=R;
}else{
if(S[mid]>T[j]){
R=mid;
}else{
L=mid+1;
}
}
}
}
void output(){
System.out.println(count);
}
public static void main(String[] args){
new Main().input();
}
} |
[
7,
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,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
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,
4,
18,
13,
14,
2,
4,
13,
13,
13,
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,
40,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
40,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
163,
5
],
[
163,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
58,
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
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
80,
81
],
[
73,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
84,
87
],
[
83,
88
],
[
82,
89
],
[
89,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
6,
97
],
[
97,
98
],
[
163,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
101,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
101,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
120,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
137,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
101,
155
],
[
155,
156
],
[
156,
157
],
[
99,
158
],
[
158,
159
],
[
99,
160
],
[
160,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
] | [
"import java.util.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n \n int num = Integer.parseInt(sc.next());\n int[] s = new int[num];\n for(int i=0; i<num; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n \n int q = Integer.parseInt(sc.next());\n int count=0, wanted=0;\n for(int i=0; i<q; i++){\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }\n System.out.println(count);\n }\n public static int binarySearch(int[] dt, int target){\n int left=0, right=dt.length-1;\n int mid=-1;\n \n while(left<=right){\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }\n return -1;\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n \n int num = Integer.parseInt(sc.next());\n int[] s = new int[num];\n for(int i=0; i<num; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n \n int q = Integer.parseInt(sc.next());\n int count=0, wanted=0;\n for(int i=0; i<q; i++){\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }\n System.out.println(count);\n }\n public static int binarySearch(int[] dt, int target){\n int left=0, right=dt.length-1;\n int mid=-1;\n \n while(left<=right){\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }\n return -1;\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n \n int num = Integer.parseInt(sc.next());\n int[] s = new int[num];\n for(int i=0; i<num; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n \n int q = Integer.parseInt(sc.next());\n int count=0, wanted=0;\n for(int i=0; i<q; i++){\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n int num = Integer.parseInt(sc.next());\n int[] s = new int[num];\n for(int i=0; i<num; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n \n int q = Integer.parseInt(sc.next());\n int count=0, wanted=0;\n for(int i=0; i<q; i++){\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = Integer.parseInt(sc.next());",
"num",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int[] s = new int[num];",
"s",
"new int[num]",
"num",
"for(int i=0; i<num; i++){\n s[i] = Integer.parseInt(sc.next());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num",
"i",
"num",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(sc.next());\n }",
"{\n s[i] = Integer.parseInt(sc.next());\n }",
"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 count=0",
"count",
"0",
"wanted=0;",
"wanted",
"0",
"for(int i=0; i<q; i++){\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }",
"{\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }",
"wanted = Integer.parseInt(sc.next())",
"wanted",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"if(binarySearch(s, wanted)>=0) count++;",
"binarySearch(s, wanted)>=0",
"binarySearch(s, wanted)",
"binarySearch",
"s",
"wanted",
"0",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int binarySearch(int[] dt, int target){\n int left=0, right=dt.length-1;\n int mid=-1;\n \n while(left<=right){\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }\n return -1;\n }",
"binarySearch",
"{\n int left=0, right=dt.length-1;\n int mid=-1;\n \n while(left<=right){\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }\n return -1;\n }",
"int left=0",
"left",
"0",
"right=dt.length-1;",
"right",
"dt.length-1",
"dt.length",
"dt",
"dt.length",
"1",
"int mid=-1;",
"mid",
"-1",
"1",
"while(left<=right){\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }",
"left<=right",
"left",
"right",
"{\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }",
"mid = (right+left)/2",
"mid",
"(right+left)/2",
"(right+left)",
"right",
"left",
"2",
"if(dt[mid] == target){\n return mid;\n }",
"dt[mid] == target",
"dt[mid]",
"dt",
"mid",
"target",
"{\n return mid;\n }",
"return mid;",
"mid",
"if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }",
"dt[mid] < target",
"dt[mid]",
"dt",
"mid",
"target",
"{\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",
"return -1;",
"-1",
"1",
"int[] dt",
"dt",
"int target",
"target",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n \n int num = Integer.parseInt(sc.next());\n int[] s = new int[num];\n for(int i=0; i<num; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n \n int q = Integer.parseInt(sc.next());\n int count=0, wanted=0;\n for(int i=0; i<q; i++){\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }\n System.out.println(count);\n }\n public static int binarySearch(int[] dt, int target){\n int left=0, right=dt.length-1;\n int mid=-1;\n \n while(left<=right){\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }\n return -1;\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n \n int num = Integer.parseInt(sc.next());\n int[] s = new int[num];\n for(int i=0; i<num; i++){\n s[i] = Integer.parseInt(sc.next());\n }\n \n int q = Integer.parseInt(sc.next());\n int count=0, wanted=0;\n for(int i=0; i<q; i++){\n wanted = Integer.parseInt(sc.next());\n if(binarySearch(s, wanted)>=0) count++;\n }\n System.out.println(count);\n }\n public static int binarySearch(int[] dt, int target){\n int left=0, right=dt.length-1;\n int mid=-1;\n \n while(left<=right){\n mid = (right+left)/2;\n if(dt[mid] == target){\n return mid;\n }\n if(dt[mid] < target){\n left=mid+1;\n }else{\n right=mid-1;\n }\n }\n return -1;\n }\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int num = Integer.parseInt(sc.next());
int[] s = new int[num];
for(int i=0; i<num; i++){
s[i] = Integer.parseInt(sc.next());
}
int q = Integer.parseInt(sc.next());
int count=0, wanted=0;
for(int i=0; i<q; i++){
wanted = Integer.parseInt(sc.next());
if(binarySearch(s, wanted)>=0) count++;
}
System.out.println(count);
}
public static int binarySearch(int[] dt, int target){
int left=0, right=dt.length-1;
int mid=-1;
while(left<=right){
mid = (right+left)/2;
if(dt[mid] == target){
return mid;
}
if(dt[mid] < target){
left=mid+1;
}else{
right=mid-1;
}
}
return -1;
}
}
|
[
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,
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,
4,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
88,
11
],
[
88,
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,
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
],
[
39,
42
],
[
42,
43
],
[
43,
44
],
[
14,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
14,
50
],
[
50,
51
],
[
50,
52
],
[
14,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
71,
76
],
[
76,
77
],
[
77,
78
],
[
14,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
12,
85
],
[
85,
86
],
[
0,
87
],
[
87,
88
],
[
87,
89
]
] | [
"import java.util.Scanner;\nimport java.util.Set;\nimport java.util.TreeSet;\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\t\n\t\tfor(int i=0;i<n;i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint cnt=0;\n\t\tfor(int i=0;i<p;i++){\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"import java.util.TreeSet;",
"TreeSet",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\t\n\t\tfor(int i=0;i<n;i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint cnt=0;\n\t\tfor(int i=0;i<p;i++){\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\t\n\t\tfor(int i=0;i<n;i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint cnt=0;\n\t\tfor(int i=0;i<p;i++){\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\t\n\t\tfor(int i=0;i<n;i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint cnt=0;\n\t\tfor(int i=0;i<p;i++){\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Set<Integer> T = new TreeSet<Integer>();",
"T",
"new TreeSet<Integer>()",
"for(int i=0;i<n;i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tT.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tT.add(sc.nextInt());\n\t\t}",
"T.add(sc.nextInt())",
"T.add",
"T",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int cnt=0;",
"cnt",
"0",
"for(int i=0;i<p;i++){\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\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\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"int t= sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}",
"T.contains(t)",
"T.contains",
"T",
"t",
"{\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 class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\t\n\t\tfor(int i=0;i<n;i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint cnt=0;\n\t\tfor(int i=0;i<p;i++){\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> T = new TreeSet<Integer>();\n\t\t\n\t\tfor(int i=0;i<n;i++){\n\t\t\tT.add(sc.nextInt());\n\t\t}\n\t\tint p = sc.nextInt();\n\t\tint cnt=0;\n\t\tfor(int i=0;i<p;i++){\n\t\t\tint t= sc.nextInt();\n\t\t\tif(T.contains(t)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t\n\t}\n}",
"Main"
] | import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Set<Integer> T = new TreeSet<Integer>();
for(int i=0;i<n;i++){
T.add(sc.nextInt());
}
int p = sc.nextInt();
int cnt=0;
for(int i=0;i<p;i++){
int t= sc.nextInt();
if(T.contains(t)){
cnt++;
}
}
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
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,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
4,
18,
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,
17,
41,
13,
41,
13,
17,
41,
13,
17,
41,
13,
40,
17,
41,
13,
17,
12,
13,
30,
4,
13,
18,
13,
13,
13,
12,
13,
30,
4,
13,
13,
4,
13,
13,
23,
13,
23,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
0,
13,
20,
13,
23,
13,
12,
13,
30,
40,
13,
4,
13,
12,
13,
30,
14,
2,
2,
13,
13,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
0,
13,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
29,
2,
13,
17,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
42,
2,
40,
4,
13,
0,
13,
18,
13,
13,
40,
4,
13,
13,
4,
13,
14,
4,
13,
18,
13,
13,
30,
0,
13,
40,
17,
4,
13,
42,
4,
13,
0,
13,
18,
13,
13,
30,
0,
13,
17,
0,
13,
2,
13,
17,
4,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
4,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
14,
40,
4,
18,
18,
36,
13,
18,
13,
13,
4,
18,
18,
36,
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
],
[
370,
17
],
[
370,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
18,
24
],
[
24,
25
],
[
370,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
32,
34
],
[
28,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
28,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
28,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
28,
52
],
[
52,
53
],
[
52,
54
],
[
28,
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
],
[
70,
72
],
[
70,
73
],
[
73,
74
],
[
74,
75
],
[
70,
76
],
[
70,
77
],
[
28,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
28,
82
],
[
82,
83
],
[
83,
84
],
[
370,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
87,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
87,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
108,
111
],
[
108,
112
],
[
108,
113
],
[
87,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
114,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
121,
124
],
[
121,
125
],
[
125,
126
],
[
125,
127
],
[
121,
128
],
[
87,
129
],
[
129,
130
],
[
85,
131
],
[
131,
132
],
[
85,
133
],
[
133,
134
],
[
85,
135
],
[
135,
136
],
[
85,
137
],
[
137,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
139,
146
],
[
146,
147
],
[
146,
148
],
[
139,
149
],
[
149,
150
],
[
149,
151
],
[
139,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
139,
156
],
[
156,
157
],
[
156,
158
],
[
139,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
139,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
174,
176
],
[
168,
177
],
[
177,
178
],
[
168,
179
],
[
179,
180
],
[
139,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
181,
187
],
[
187,
188
],
[
139,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
189,
196
],
[
196,
197
],
[
139,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
200,
203
],
[
203,
204
],
[
139,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
209,
213
],
[
213,
214
],
[
214,
215
],
[
208,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
216,
223
],
[
223,
224
],
[
223,
225
],
[
139,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
231,
233
],
[
230,
234
],
[
234,
235
],
[
234,
236
],
[
226,
237
],
[
237,
238
],
[
139,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
239,
246
],
[
246,
247
],
[
139,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
250,
254
],
[
254,
255
],
[
254,
256
],
[
250,
257
],
[
257,
258
],
[
250,
259
],
[
259,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
264,
266
],
[
266,
267
],
[
266,
268
],
[
260,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
259,
273
],
[
273,
274
],
[
250,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
278,
280
],
[
275,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
284,
285
],
[
281,
286
],
[
286,
287
],
[
250,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
291,
292
],
[
291,
293
],
[
293,
294
],
[
293,
295
],
[
288,
296
],
[
296,
297
],
[
297,
298
],
[
297,
299
],
[
296,
300
],
[
300,
301
],
[
300,
302
],
[
302,
303
],
[
302,
304
],
[
296,
305
],
[
305,
306
],
[
250,
307
],
[
307,
308
],
[
250,
309
],
[
309,
310
],
[
310,
311
],
[
310,
312
],
[
139,
313
],
[
313,
314
],
[
313,
315
],
[
315,
316
],
[
316,
317
],
[
315,
318
],
[
318,
319
],
[
319,
320
],
[
139,
321
],
[
321,
322
],
[
321,
323
],
[
323,
324
],
[
324,
325
],
[
323,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
326,
331
],
[
331,
332
],
[
331,
333
],
[
333,
334
],
[
333,
335
],
[
326,
336
],
[
336,
337
],
[
337,
338
],
[
326,
339
],
[
340,
340
],
[
340,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
341,
345
],
[
345,
346
],
[
323,
347
],
[
347,
348
],
[
321,
349
],
[
349,
350
],
[
139,
351
],
[
351,
352
],
[
351,
353
],
[
353,
354
],
[
354,
355
],
[
355,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
358,
360
],
[
356,
361
],
[
361,
362
],
[
361,
363
],
[
354,
364
],
[
364,
365
],
[
365,
366
],
[
366,
367
],
[
366,
368
],
[
0,
369
],
[
369,
370
],
[
369,
371
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n \npublic class Main {\n \n public static void main(String[] args) throws IOException {\n// \tlong l = System.currentTimeMillis();\n new Main().exec();\n// \tlong l2 = System.currentTimeMillis();\n// \tSystem.out.println(l2 - l);\n }\n \n public void exec() throws IOException {\n InputUtil in = new InputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int[] S = in.nextInt(new int[n]);\n int q = in.nextInt();\n int C = 0;\n for(int i=0; i<q; i++) {\n C += binarySearch(S, in.nextInt(), 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 if(from == to) return 0;\n int mid = (from + to) /2;\n if (key < S[mid]) \n return binarySearch(S,key,from,mid);\n if (S[mid] < key)\n return binarySearch(S,key,mid+1,to);\n return 1;\n }\n}\n\nclass InputUtil {\n\t//Static Fields\n\tprivate static final int BUFSIZ = 50000;\n\t\n\t//Fields\n\tprotected InputStream in;\n\tprivate char[] buf = null;\n\tprivate int ptr = 0;\n\tprivate int max = -1;\n\tprivate BufferedReader br = null;\n\t\n\t//Constructors\n\tpublic InputUtil() {this(System.in,BUFSIZ);}\n\tpublic InputUtil(InputStream in, int bufsiz) {\n\t\tinitBuf(bufsiz);\n\t\tinitIn(in);\n\t}\n\t\n\t//Methods\n\t//Initializer\n\tprotected void initIn(InputStream in) {br = new BufferedReader(new InputStreamReader(this.in = in));}\n\tprotected void initBuf(int bufsiz) {buf = new char[bufsiz];}\n\t\n\t//buffer operation\n\tprivate void next() throws IOException {ptr++; readBuf();}\n\tprivate void readBuf() throws IOException {\n\t\tif(ptr >= max && br.ready()) {\n\t\t\tmax = br.read(buf);\n\t\t\tptr = 0;\n\t\t}\n\t}\n\t//Number Input Reader/Parser\n\tprivate boolean isNum(char b) {return '0' <= b && b <= '9'; }\n\tprivate boolean isMinus(char b) {return b=='-'; }\n\n\tprivate int _nextInt() throws IOException {\n\t\tint sign = 1;\n\t\tint res = 0;\n\t\tchar c;\n\t\twhile (!isNum(c=buf[ptr]) && !isMinus(c)) \n\t\t\tnext();\n\t\tif (isMinus(buf[ptr])) {\n\t\t\tsign = -1;\n\t\t\tnext();\n\t\t}\n\t\twhile (isNum(c=buf[ptr])) {\n\t\t\tres *= 10;\n\t\t\tres += c - '0' ;\n\t\t\tnext();\n\t\t}\n\t\tnext();\n\t\treturn sign * res;\n\t}\n\t\n\tpublic int nextInt() throws IOException {\n\t\treadBuf();\n\t\treturn _nextInt();\n\t}\n\n\tpublic int[] nextInt(int[] result) throws IOException {\n\t\treadBuf();\n\t\tfor(int i=0; i<result.length; i++) {\n\t\t\tresult[i] = _nextInt();\n\t\t}\n\t\treturn result;\n\t}\n\t\n\t//Close \n\tpublic void close() throws IOException {\n\t\tif(!this.in.equals(System.in)) \n\t\t\tthis.in.close();\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.io.PrintWriter;",
"PrintWriter",
"java.io",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n// \tlong l = System.currentTimeMillis();\n new Main().exec();\n// \tlong l2 = System.currentTimeMillis();\n// \tSystem.out.println(l2 - l);\n }\n \n public void exec() throws IOException {\n InputUtil in = new InputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int[] S = in.nextInt(new int[n]);\n int q = in.nextInt();\n int C = 0;\n for(int i=0; i<q; i++) {\n C += binarySearch(S, in.nextInt(), 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 if(from == to) return 0;\n int mid = (from + to) /2;\n if (key < S[mid]) \n return binarySearch(S,key,from,mid);\n if (S[mid] < key)\n return binarySearch(S,key,mid+1,to);\n return 1;\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n// \tlong l = System.currentTimeMillis();\n new Main().exec();\n// \tlong l2 = System.currentTimeMillis();\n// \tSystem.out.println(l2 - l);\n }",
"main",
"{\n// \tlong l = System.currentTimeMillis();\n new Main().exec();\n// \tlong l2 = System.currentTimeMillis();\n// \tSystem.out.println(l2 - l);\n }",
"new Main().exec()",
"new Main().exec",
"new Main()",
"String[] args",
"args",
"public void exec() throws IOException {\n InputUtil in = new InputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int[] S = in.nextInt(new int[n]);\n int q = in.nextInt();\n int C = 0;\n for(int i=0; i<q; i++) {\n C += binarySearch(S, in.nextInt(), 0, n);\n }\n out.println(C);\n out.flush();\n }",
"exec",
"{\n InputUtil in = new InputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int[] S = in.nextInt(new int[n]);\n int q = in.nextInt();\n int C = 0;\n for(int i=0; i<q; i++) {\n C += binarySearch(S, in.nextInt(), 0, n);\n }\n out.println(C);\n out.flush();\n }",
"InputUtil in = new InputUtil();",
"in",
"new InputUtil()",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] S = in.nextInt(new int[n]);",
"S",
"in.nextInt(new int[n])",
"in.nextInt",
"in",
"new int[n]",
"n",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"int C = 0;",
"C",
"0",
"for(int i=0; i<q; i++) {\n C += binarySearch(S, in.nextInt(), 0, n);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n C += binarySearch(S, in.nextInt(), 0, n);\n }",
"{\n C += binarySearch(S, in.nextInt(), 0, n);\n }",
"C += binarySearch(S, in.nextInt(), 0, n)",
"C",
"binarySearch(S, in.nextInt(), 0, n)",
"binarySearch",
"S",
"in.nextInt()",
"in.nextInt",
"in",
"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 if(from == to) return 0;\n int mid = (from + to) /2;\n if (key < S[mid]) \n return binarySearch(S,key,from,mid);\n if (S[mid] < key)\n return binarySearch(S,key,mid+1,to);\n return 1;\n }",
"binarySearch",
"{\n if(from == to) return 0;\n int mid = (from + to) /2;\n if (key < S[mid]) \n return binarySearch(S,key,from,mid);\n if (S[mid] < key)\n return binarySearch(S,key,mid+1,to);\n return 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 return 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 return 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 InputUtil {\n\t//Static Fields\n\tprivate static final int BUFSIZ = 50000;\n\t\n\t//Fields\n\tprotected InputStream in;\n\tprivate char[] buf = null;\n\tprivate int ptr = 0;\n\tprivate int max = -1;\n\tprivate BufferedReader br = null;\n\t\n\t//Constructors\n\tpublic InputUtil() {this(System.in,BUFSIZ);}\n\tpublic InputUtil(InputStream in, int bufsiz) {\n\t\tinitBuf(bufsiz);\n\t\tinitIn(in);\n\t}\n\t\n\t//Methods\n\t//Initializer\n\tprotected void initIn(InputStream in) {br = new BufferedReader(new InputStreamReader(this.in = in));}\n\tprotected void initBuf(int bufsiz) {buf = new char[bufsiz];}\n\t\n\t//buffer operation\n\tprivate void next() throws IOException {ptr++; readBuf();}\n\tprivate void readBuf() throws IOException {\n\t\tif(ptr >= max && br.ready()) {\n\t\t\tmax = br.read(buf);\n\t\t\tptr = 0;\n\t\t}\n\t}\n\t//Number Input Reader/Parser\n\tprivate boolean isNum(char b) {return '0' <= b && b <= '9'; }\n\tprivate boolean isMinus(char b) {return b=='-'; }\n\n\tprivate int _nextInt() throws IOException {\n\t\tint sign = 1;\n\t\tint res = 0;\n\t\tchar c;\n\t\twhile (!isNum(c=buf[ptr]) && !isMinus(c)) \n\t\t\tnext();\n\t\tif (isMinus(buf[ptr])) {\n\t\t\tsign = -1;\n\t\t\tnext();\n\t\t}\n\t\twhile (isNum(c=buf[ptr])) {\n\t\t\tres *= 10;\n\t\t\tres += c - '0' ;\n\t\t\tnext();\n\t\t}\n\t\tnext();\n\t\treturn sign * res;\n\t}\n\t\n\tpublic int nextInt() throws IOException {\n\t\treadBuf();\n\t\treturn _nextInt();\n\t}\n\n\tpublic int[] nextInt(int[] result) throws IOException {\n\t\treadBuf();\n\t\tfor(int i=0; i<result.length; i++) {\n\t\t\tresult[i] = _nextInt();\n\t\t}\n\t\treturn result;\n\t}\n\t\n\t//Close \n\tpublic void close() throws IOException {\n\t\tif(!this.in.equals(System.in)) \n\t\t\tthis.in.close();\n\t}\n\n}",
"InputUtil",
"//Static Fields\n\tprivate static final int BUFSIZ = 50000;",
"BUFSIZ",
"50000",
"//Fields\n\tprotected InputStream in;",
"in",
"private char[] buf = null;",
"buf",
"null",
"private int ptr = 0;",
"ptr",
"0",
"private int max = -1;",
"max",
"-1",
"1",
"private BufferedReader br = null;",
"br",
"null",
"//Constructors\n\tpublic InputUtil() {this(System.in,BUFSIZ);}",
"InputUtil",
"{this(System.in,BUFSIZ);}",
"this(System.in,BUFSIZ)",
"this",
"System.in",
"System",
"System.in",
"BUFSIZ",
"public InputUtil(InputStream in, int bufsiz) {\n\t\tinitBuf(bufsiz);\n\t\tinitIn(in);\n\t}",
"InputUtil",
"{\n\t\tinitBuf(bufsiz);\n\t\tinitIn(in);\n\t}",
"initBuf(bufsiz)",
"initBuf",
"bufsiz",
"initIn(in)",
"initIn",
"in",
"InputStream in",
"in",
"int bufsiz",
"bufsiz",
"//Methods\n\t//Initializer\n\tprotected void initIn(InputStream in) {br = new BufferedReader(new InputStreamReader(this.in = in));}",
"initIn",
"{br = new BufferedReader(new InputStreamReader(this.in = in));}",
"br = new BufferedReader(new InputStreamReader(this.in = in))",
"br",
"new BufferedReader(new InputStreamReader(this.in = in))",
"InputStream in",
"in",
"protected void initBuf(int bufsiz) {buf = new char[bufsiz];}",
"initBuf",
"{buf = new char[bufsiz];}",
"buf = new char[bufsiz]",
"buf",
"new char[bufsiz]",
"bufsiz",
"int bufsiz",
"bufsiz",
"//buffer operation\n\tprivate void next() throws IOException {ptr++; readBuf();}",
"next",
"{ptr++; readBuf();}",
"ptr++",
"ptr",
"readBuf()",
"readBuf",
"private void readBuf() throws IOException {\n\t\tif(ptr >= max && br.ready()) {\n\t\t\tmax = br.read(buf);\n\t\t\tptr = 0;\n\t\t}\n\t}",
"readBuf",
"{\n\t\tif(ptr >= max && br.ready()) {\n\t\t\tmax = br.read(buf);\n\t\t\tptr = 0;\n\t\t}\n\t}",
"if(ptr >= max && br.ready()) {\n\t\t\tmax = br.read(buf);\n\t\t\tptr = 0;\n\t\t}",
"ptr >= max && br.ready()",
"ptr >= max",
"ptr",
"max",
"br.ready()",
"br.ready",
"br",
"{\n\t\t\tmax = br.read(buf);\n\t\t\tptr = 0;\n\t\t}",
"max = br.read(buf)",
"max",
"br.read(buf)",
"br.read",
"br",
"buf",
"ptr = 0",
"ptr",
"0",
"//Number Input Reader/Parser\n\tprivate boolean isNum(char b) {return '0' <= b && b <= '9'; }",
"isNum",
"{return '0' <= b && b <= '9'; }",
"return '0' <= b && b <= '9';",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"char b",
"b",
"private boolean isMinus(char b) {return b=='-'; }",
"isMinus",
"{return b=='-'; }",
"return b=='-';",
"b=='-'",
"b",
"'-'",
"char b",
"b",
"private int _nextInt() throws IOException {\n\t\tint sign = 1;\n\t\tint res = 0;\n\t\tchar c;\n\t\twhile (!isNum(c=buf[ptr]) && !isMinus(c)) \n\t\t\tnext();\n\t\tif (isMinus(buf[ptr])) {\n\t\t\tsign = -1;\n\t\t\tnext();\n\t\t}\n\t\twhile (isNum(c=buf[ptr])) {\n\t\t\tres *= 10;\n\t\t\tres += c - '0' ;\n\t\t\tnext();\n\t\t}\n\t\tnext();\n\t\treturn sign * res;\n\t}",
"_nextInt",
"{\n\t\tint sign = 1;\n\t\tint res = 0;\n\t\tchar c;\n\t\twhile (!isNum(c=buf[ptr]) && !isMinus(c)) \n\t\t\tnext();\n\t\tif (isMinus(buf[ptr])) {\n\t\t\tsign = -1;\n\t\t\tnext();\n\t\t}\n\t\twhile (isNum(c=buf[ptr])) {\n\t\t\tres *= 10;\n\t\t\tres += c - '0' ;\n\t\t\tnext();\n\t\t}\n\t\tnext();\n\t\treturn sign * res;\n\t}",
"int sign = 1;",
"sign",
"1",
"int res = 0;",
"res",
"0",
"char c;",
"c",
"while (!isNum(c=buf[ptr]) && !isMinus(c)) \n\t\t\tnext();",
"!isNum(c=buf[ptr]) && !isMinus(c)",
"!isNum(c=buf[ptr])",
"isNum(c=buf[ptr])",
"isNum",
"c=buf[ptr]",
"c",
"buf[ptr]",
"buf",
"ptr",
"!isMinus(c)",
"isMinus(c)",
"isMinus",
"c",
"next()",
"next",
"if (isMinus(buf[ptr])) {\n\t\t\tsign = -1;\n\t\t\tnext();\n\t\t}",
"isMinus(buf[ptr])",
"isMinus",
"buf[ptr]",
"buf",
"ptr",
"{\n\t\t\tsign = -1;\n\t\t\tnext();\n\t\t}",
"sign = -1",
"sign",
"-1",
"1",
"next()",
"next",
"while (isNum(c=buf[ptr])) {\n\t\t\tres *= 10;\n\t\t\tres += c - '0' ;\n\t\t\tnext();\n\t\t}",
"isNum(c=buf[ptr])",
"isNum",
"c=buf[ptr]",
"c",
"buf[ptr]",
"buf",
"ptr",
"{\n\t\t\tres *= 10;\n\t\t\tres += c - '0' ;\n\t\t\tnext();\n\t\t}",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"next()",
"next",
"next()",
"next",
"return sign * res;",
"sign * res",
"sign",
"res",
"public int nextInt() throws IOException {\n\t\treadBuf();\n\t\treturn _nextInt();\n\t}",
"nextInt",
"{\n\t\treadBuf();\n\t\treturn _nextInt();\n\t}",
"readBuf()",
"readBuf",
"return _nextInt();",
"_nextInt()",
"_nextInt",
"public int[] nextInt(int[] result) throws IOException {\n\t\treadBuf();\n\t\tfor(int i=0; i<result.length; i++) {\n\t\t\tresult[i] = _nextInt();\n\t\t}\n\t\treturn result;\n\t}",
"nextInt",
"{\n\t\treadBuf();\n\t\tfor(int i=0; i<result.length; i++) {\n\t\t\tresult[i] = _nextInt();\n\t\t}\n\t\treturn result;\n\t}",
"readBuf()",
"readBuf",
"for(int i=0; i<result.length; i++) {\n\t\t\tresult[i] = _nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<result.length",
"i",
"result.length",
"result",
"result.length",
"i++",
"i++",
"i",
"{\n\t\t\tresult[i] = _nextInt();\n\t\t}",
"{\n\t\t\tresult[i] = _nextInt();\n\t\t}",
"result[i] = _nextInt()",
"result[i]",
"result",
"i",
"_nextInt()",
"_nextInt",
"return result;",
"result",
"int[] result",
"result",
"//Close \n\tpublic void close() throws IOException {\n\t\tif(!this.in.equals(System.in)) \n\t\t\tthis.in.close();\n\t}",
"close",
"{\n\t\tif(!this.in.equals(System.in)) \n\t\t\tthis.in.close();\n\t}",
"if(!this.in.equals(System.in)) \n\t\t\tthis.in.close();",
"!this.in.equals(System.in)",
"this.in.equals(System.in)",
"this.in.equals",
"this.in",
"this",
"this.in",
"System.in",
"System",
"System.in",
"this.in.close()",
"this.in.close",
"this.in",
"this",
"this.in",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n// \tlong l = System.currentTimeMillis();\n new Main().exec();\n// \tlong l2 = System.currentTimeMillis();\n// \tSystem.out.println(l2 - l);\n }\n \n public void exec() throws IOException {\n InputUtil in = new InputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int[] S = in.nextInt(new int[n]);\n int q = in.nextInt();\n int C = 0;\n for(int i=0; i<q; i++) {\n C += binarySearch(S, in.nextInt(), 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 if(from == to) return 0;\n int mid = (from + to) /2;\n if (key < S[mid]) \n return binarySearch(S,key,from,mid);\n if (S[mid] < key)\n return binarySearch(S,key,mid+1,to);\n return 1;\n }\n}",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n// \tlong l = System.currentTimeMillis();\n new Main().exec();\n// \tlong l2 = System.currentTimeMillis();\n// \tSystem.out.println(l2 - l);\n }\n \n public void exec() throws IOException {\n InputUtil in = new InputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int[] S = in.nextInt(new int[n]);\n int q = in.nextInt();\n int C = 0;\n for(int i=0; i<q; i++) {\n C += binarySearch(S, in.nextInt(), 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 if(from == to) return 0;\n int mid = (from + to) /2;\n if (key < S[mid]) \n return binarySearch(S,key,from,mid);\n if (S[mid] < key)\n return binarySearch(S,key,mid+1,to);\n return 1;\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException {
// long l = System.currentTimeMillis();
new Main().exec();
// long l2 = System.currentTimeMillis();
// System.out.println(l2 - l);
}
public void exec() throws IOException {
InputUtil in = new InputUtil();
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int[] S = in.nextInt(new int[n]);
int q = in.nextInt();
int C = 0;
for(int i=0; i<q; i++) {
C += binarySearch(S, in.nextInt(), 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 InputUtil {
//Static Fields
private static final int BUFSIZ = 50000;
//Fields
protected InputStream in;
private char[] buf = null;
private int ptr = 0;
private int max = -1;
private BufferedReader br = null;
//Constructors
public InputUtil() {this(System.in,BUFSIZ);}
public InputUtil(InputStream in, int bufsiz) {
initBuf(bufsiz);
initIn(in);
}
//Methods
//Initializer
protected void initIn(InputStream in) {br = new BufferedReader(new InputStreamReader(this.in = in));}
protected void initBuf(int bufsiz) {buf = new char[bufsiz];}
//buffer operation
private void next() throws IOException {ptr++; readBuf();}
private void readBuf() throws IOException {
if(ptr >= max && br.ready()) {
max = br.read(buf);
ptr = 0;
}
}
//Number Input Reader/Parser
private boolean isNum(char b) {return '0' <= b && b <= '9'; }
private boolean isMinus(char b) {return b=='-'; }
private int _nextInt() throws IOException {
int sign = 1;
int res = 0;
char c;
while (!isNum(c=buf[ptr]) && !isMinus(c))
next();
if (isMinus(buf[ptr])) {
sign = -1;
next();
}
while (isNum(c=buf[ptr])) {
res *= 10;
res += c - '0' ;
next();
}
next();
return sign * res;
}
public int nextInt() throws IOException {
readBuf();
return _nextInt();
}
public int[] nextInt(int[] result) throws IOException {
readBuf();
for(int i=0; i<result.length; i++) {
result[i] = _nextInt();
}
return result;
}
//Close
public void close() throws IOException {
if(!this.in.equals(System.in))
this.in.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
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,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
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,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
4,
13,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
13,
30,
0,
13,
20,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
14,
4,
13,
30,
29,
4,
18,
13,
30,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
4,
13,
30,
29,
4,
18,
13,
4,
18,
13,
30,
4,
13,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
14,
4,
13,
30,
29,
4,
18,
13,
4,
18,
13,
30,
4,
13,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
14,
4,
13,
30,
29,
4,
18,
13,
4,
18,
13,
30,
4,
13,
29,
4,
18,
13,
4,
18,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
270,
8
],
[
270,
9
],
[
9,
10
],
[
9,
11
],
[
270,
12
],
[
12,
13
],
[
12,
14
],
[
270,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
17,
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
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
17,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
17,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
57,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
69,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
76,
79
],
[
75,
80
],
[
80,
81
],
[
17,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
15,
88
],
[
88,
89
],
[
270,
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
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
113,
119
],
[
119,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
127,
128
],
[
127,
129
],
[
121,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
92,
135
],
[
135,
136
],
[
90,
137
],
[
137,
138
],
[
90,
139
],
[
139,
140
],
[
0,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
141,
145
],
[
145,
146
],
[
141,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
147,
155
],
[
155,
156
],
[
141,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
166,
167
],
[
160,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
141,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
141,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
182,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
182,
190
],
[
190,
191
],
[
191,
192
],
[
190,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
141,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
200,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
205,
208
],
[
208,
209
],
[
209,
210
],
[
200,
211
],
[
211,
212
],
[
212,
213
],
[
211,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
215,
218
],
[
218,
219
],
[
219,
220
],
[
141,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
224,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
229,
232
],
[
232,
233
],
[
233,
234
],
[
224,
235
],
[
235,
236
],
[
236,
237
],
[
235,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
239,
242
],
[
242,
243
],
[
243,
244
],
[
141,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
248,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
253,
256
],
[
256,
257
],
[
257,
258
],
[
248,
259
],
[
259,
260
],
[
260,
261
],
[
259,
262
],
[
262,
263
],
[
263,
264
],
[
264,
265
],
[
263,
266
],
[
266,
267
],
[
267,
268
],
[
0,
269
],
[
269,
270
],
[
269,
271
]
] | [
"import java.util.*;\nimport java.io.*;\n\npublic class Main{\n\tfinal static int MOD = 1000000007;\n\tfinal static int INF = 1000000000;\n\n\tpublic static void main(String[] args) throws IOException{\n\t\tNScanner sc = new NScanner(System.in);\n\t\tint n = sc.nextInt(), cnt = 0;\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tS[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tfor(int i = 0; i < q; ++i){\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean BinarySearch(int[] v, int key){\n\t\tint lt = 0, rt = v.length;\n\t\twhile(lt < rt){\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n}\n\n\nclass NScanner{\n\n\tprivate BufferedReader br;\n\tprivate StringTokenizer tok;\n\n\tpublic NScanner(InputStream is) throws IOException{\n\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\tgetLine();\n\t}\n\n\tprivate void getLine() throws IOException{\n\t\twhile(tok == null || !hasNext()){\n\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t}\n\t}\n\n\tpublic boolean hasNext(){\n\t\treturn tok.hasMoreTokens();\n\t}\n\n\tpublic String next() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn tok.nextToken();\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n\t}\n\n\tpublic int nextInt() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}\n\t}\n\n\tpublic long nextLong() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}\n\t}\n\n\tpublic double nextDouble() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n\tfinal static int MOD = 1000000007;\n\tfinal static int INF = 1000000000;\n\n\tpublic static void main(String[] args) throws IOException{\n\t\tNScanner sc = new NScanner(System.in);\n\t\tint n = sc.nextInt(), cnt = 0;\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tS[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tfor(int i = 0; i < q; ++i){\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean BinarySearch(int[] v, int key){\n\t\tint lt = 0, rt = v.length;\n\t\twhile(lt < rt){\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main",
"final static int MOD = 1000000007;",
"MOD",
"1000000007",
"final static int INF = 1000000000;",
"INF",
"1000000000",
"public static void main(String[] args) throws IOException{\n\t\tNScanner sc = new NScanner(System.in);\n\t\tint n = sc.nextInt(), cnt = 0;\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tS[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tfor(int i = 0; i < q; ++i){\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\t\tNScanner sc = new NScanner(System.in);\n\t\tint n = sc.nextInt(), cnt = 0;\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tS[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tfor(int i = 0; i < q; ++i){\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"NScanner sc = new NScanner(System.in);",
"sc",
"new NScanner(System.in)",
"int n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"cnt = 0;",
"cnt",
"0",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0; i < n; ++i)\n\t\t\tS[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",
"for(int i = 0; i < q; ++i){\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"++i",
"++i",
"i",
"{\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}",
"{\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}",
"int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(BinarySearch(S, t)) ++cnt;",
"BinarySearch(S, t)",
"BinarySearch",
"S",
"t",
"++cnt",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"static boolean BinarySearch(int[] v, int key){\n\t\tint lt = 0, rt = v.length;\n\t\twhile(lt < rt){\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"BinarySearch",
"{\n\t\tint lt = 0, rt = v.length;\n\t\twhile(lt < rt){\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"int lt = 0",
"lt",
"0",
"rt = v.length;",
"rt",
"v.length",
"v",
"v.length",
"while(lt < rt){\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}",
"lt < rt",
"lt",
"rt",
"{\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}",
"int mid = (lt+rt) / 2;",
"mid",
"(lt+rt) / 2",
"(lt+rt)",
"lt",
"rt",
"2",
"if(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;",
"v[mid] == key",
"v[mid]",
"v",
"mid",
"key",
"return true;",
"true",
"if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;",
"key < v[mid]",
"key",
"v[mid]",
"v",
"mid",
"rt = mid",
"rt",
"mid",
"lt = mid + 1",
"lt",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] v",
"v",
"int key",
"key",
"class NScanner{\n\n\tprivate BufferedReader br;\n\tprivate StringTokenizer tok;\n\n\tpublic NScanner(InputStream is) throws IOException{\n\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\tgetLine();\n\t}\n\n\tprivate void getLine() throws IOException{\n\t\twhile(tok == null || !hasNext()){\n\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t}\n\t}\n\n\tpublic boolean hasNext(){\n\t\treturn tok.hasMoreTokens();\n\t}\n\n\tpublic String next() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn tok.nextToken();\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n\t}\n\n\tpublic int nextInt() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}\n\t}\n\n\tpublic long nextLong() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}\n\t}\n\n\tpublic double nextDouble() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}\n\t}\n}",
"NScanner",
"private BufferedReader br;",
"br",
"private StringTokenizer tok;",
"tok",
"public NScanner(InputStream is) throws IOException{\n\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\tgetLine();\n\t}",
"NScanner",
"{\n\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\tgetLine();\n\t}",
"br = new BufferedReader(new InputStreamReader(is))",
"br",
"new BufferedReader(new InputStreamReader(is))",
"getLine()",
"getLine",
"InputStream is",
"is",
"private void getLine() throws IOException{\n\t\twhile(tok == null || !hasNext()){\n\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t}\n\t}",
"getLine",
"{\n\t\twhile(tok == null || !hasNext()){\n\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t}\n\t}",
"while(tok == null || !hasNext()){\n\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t}",
"tok == null || !hasNext()",
"tok == null",
"tok",
"null",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t}",
"tok = new StringTokenizer(br.readLine())",
"tok",
"new StringTokenizer(br.readLine())",
"public boolean hasNext(){\n\t\treturn tok.hasMoreTokens();\n\t}",
"hasNext",
"{\n\t\treturn tok.hasMoreTokens();\n\t}",
"return tok.hasMoreTokens();",
"tok.hasMoreTokens()",
"tok.hasMoreTokens",
"tok",
"public String next() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn tok.nextToken();\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n\t}",
"next",
"{\n\t\tif(hasNext()){\n\t\t\treturn tok.nextToken();\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n\t}",
"if(hasNext()){\n\t\t\treturn tok.nextToken();\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}",
"hasNext()",
"hasNext",
"{\n\t\t\treturn tok.nextToken();\n\t\t}",
"return tok.nextToken();",
"tok.nextToken()",
"tok.nextToken",
"tok",
"{\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}",
"getLine()",
"getLine",
"return tok.nextToken();",
"tok.nextToken()",
"tok.nextToken",
"tok",
"public int nextInt() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}\n\t}",
"nextInt",
"{\n\t\tif(hasNext()){\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}\n\t}",
"if(hasNext()){\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}",
"hasNext()",
"hasNext",
"{\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}",
"return Integer.parseInt(tok.nextToken());",
"Integer.parseInt(tok.nextToken())",
"Integer.parseInt",
"Integer",
"tok.nextToken()",
"tok.nextToken",
"tok",
"{\n\t\t\tgetLine();\n\t\t\treturn Integer.parseInt(tok.nextToken());\n\t\t}",
"getLine()",
"getLine",
"return Integer.parseInt(tok.nextToken());",
"Integer.parseInt(tok.nextToken())",
"Integer.parseInt",
"Integer",
"tok.nextToken()",
"tok.nextToken",
"tok",
"public long nextLong() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}\n\t}",
"nextLong",
"{\n\t\tif(hasNext()){\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}\n\t}",
"if(hasNext()){\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}",
"hasNext()",
"hasNext",
"{\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}",
"return Long.parseLong(tok.nextToken());",
"Long.parseLong(tok.nextToken())",
"Long.parseLong",
"Long",
"tok.nextToken()",
"tok.nextToken",
"tok",
"{\n\t\t\tgetLine();\n\t\t\treturn Long.parseLong(tok.nextToken());\n\t\t}",
"getLine()",
"getLine",
"return Long.parseLong(tok.nextToken());",
"Long.parseLong(tok.nextToken())",
"Long.parseLong",
"Long",
"tok.nextToken()",
"tok.nextToken",
"tok",
"public double nextDouble() throws IOException{\n\t\tif(hasNext()){\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}\n\t}",
"nextDouble",
"{\n\t\tif(hasNext()){\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}\n\t}",
"if(hasNext()){\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}else{\n\t\t\tgetLine();\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}",
"hasNext()",
"hasNext",
"{\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}",
"return Double.parseDouble(tok.nextToken());",
"Double.parseDouble(tok.nextToken())",
"Double.parseDouble",
"Double",
"tok.nextToken()",
"tok.nextToken",
"tok",
"{\n\t\t\tgetLine();\n\t\t\treturn Double.parseDouble(tok.nextToken());\n\t\t}",
"getLine()",
"getLine",
"return Double.parseDouble(tok.nextToken());",
"Double.parseDouble(tok.nextToken())",
"Double.parseDouble",
"Double",
"tok.nextToken()",
"tok.nextToken",
"tok",
"public class Main{\n\tfinal static int MOD = 1000000007;\n\tfinal static int INF = 1000000000;\n\n\tpublic static void main(String[] args) throws IOException{\n\t\tNScanner sc = new NScanner(System.in);\n\t\tint n = sc.nextInt(), cnt = 0;\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tS[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tfor(int i = 0; i < q; ++i){\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean BinarySearch(int[] v, int key){\n\t\tint lt = 0, rt = v.length;\n\t\twhile(lt < rt){\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"public class Main{\n\tfinal static int MOD = 1000000007;\n\tfinal static int INF = 1000000000;\n\n\tpublic static void main(String[] args) throws IOException{\n\t\tNScanner sc = new NScanner(System.in);\n\t\tint n = sc.nextInt(), cnt = 0;\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tS[i] = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\tfor(int i = 0; i < q; ++i){\n\t\t\tint t = sc.nextInt();\n\t\t\tif(BinarySearch(S, t)) ++cnt;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean BinarySearch(int[] v, int key){\n\t\tint lt = 0, rt = v.length;\n\t\twhile(lt < rt){\n\t\t\tint mid = (lt+rt) / 2;\n\t\t\tif(v[mid] == key) return true;\n\t\t\telse if(key < v[mid])\n\t\t\t\trt = mid;\n\t\t\telse lt = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main"
] | import java.util.*;
import java.io.*;
public class Main{
final static int MOD = 1000000007;
final static int INF = 1000000000;
public static void main(String[] args) throws IOException{
NScanner sc = new NScanner(System.in);
int n = sc.nextInt(), cnt = 0;
int[] S = new int[n];
for(int i = 0; i < n; ++i)
S[i] = sc.nextInt();
int q = sc.nextInt();
for(int i = 0; i < q; ++i){
int t = sc.nextInt();
if(BinarySearch(S, t)) ++cnt;
}
System.out.println(cnt);
}
static boolean BinarySearch(int[] v, int key){
int lt = 0, rt = v.length;
while(lt < rt){
int mid = (lt+rt) / 2;
if(v[mid] == key) return true;
else if(key < v[mid])
rt = mid;
else lt = mid + 1;
}
return false;
}
}
class NScanner{
private BufferedReader br;
private StringTokenizer tok;
public NScanner(InputStream is) throws IOException{
br = new BufferedReader(new InputStreamReader(is));
getLine();
}
private void getLine() throws IOException{
while(tok == null || !hasNext()){
tok = new StringTokenizer(br.readLine());
}
}
public boolean hasNext(){
return tok.hasMoreTokens();
}
public String next() throws IOException{
if(hasNext()){
return tok.nextToken();
}else{
getLine();
return tok.nextToken();
}
}
public int nextInt() throws IOException{
if(hasNext()){
return Integer.parseInt(tok.nextToken());
}else{
getLine();
return Integer.parseInt(tok.nextToken());
}
}
public long nextLong() throws IOException{
if(hasNext()){
return Long.parseLong(tok.nextToken());
}else{
getLine();
return Long.parseLong(tok.nextToken());
}
}
public double nextDouble() throws IOException{
if(hasNext()){
return Double.parseDouble(tok.nextToken());
}else{
getLine();
return Double.parseDouble(tok.nextToken());
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
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,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
14,
2,
18,
13,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
148,
14
],
[
148,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
17,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
17,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
17,
55
],
[
55,
56
],
[
55,
57
],
[
17,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
77,
80
],
[
76,
81
],
[
81,
82
],
[
82,
83
],
[
17,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
15,
90
],
[
90,
91
],
[
148,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
94,
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
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
117,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
94,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
133,
139
],
[
139,
140
],
[
133,
141
],
[
141,
142
],
[
92,
143
],
[
143,
144
],
[
92,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
] | [
"import java.io.*;\nimport java.util.Scanner;\nimport java.util.HashMap;\nimport java.util.Map;\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){a[i]=scan.nextLong();}\n\n int q=scan.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n private static boolean check(long[]a,long t){\n int l=0,r=a.length-1;\n while(l<r){\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }\n if(a[r]==t)return true;\n else return false;\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){a[i]=scan.nextLong();}\n\n int q=scan.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n private static boolean check(long[]a,long t){\n int l=0,r=a.length-1;\n while(l<r){\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }\n if(a[r]==t)return true;\n else return false;\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){a[i]=scan.nextLong();}\n\n int q=scan.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){a[i]=scan.nextLong();}\n\n int q=scan.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }\n System.out.println(ans);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n=scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i=0;i<n;i++){a[i]=scan.nextLong();}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{a[i]=scan.nextLong();}",
"{a[i]=scan.nextLong();}",
"a[i]=scan.nextLong()",
"a[i]",
"a",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"int q=scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int ans=0;",
"ans",
"0",
"for(int i=0;i<q;i++){\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }",
"{\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }",
"long t=scan.nextLong();",
"t",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if(check(a,t)){\n ans++;\n }",
"check(a,t)",
"check",
"a",
"t",
"{\n ans++;\n }",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"private static boolean check(long[]a,long t){\n int l=0,r=a.length-1;\n while(l<r){\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }\n if(a[r]==t)return true;\n else return false;\n }",
"check",
"{\n int l=0,r=a.length-1;\n while(l<r){\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }\n if(a[r]==t)return true;\n else return false;\n }",
"int l=0",
"l",
"0",
"r=a.length-1;",
"r",
"a.length-1",
"a.length",
"a",
"a.length",
"1",
"while(l<r){\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }",
"l<r",
"l",
"r",
"{\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }",
"int mid=(l+r)/2;",
"mid",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }",
"a[mid]<t",
"a[mid]",
"a",
"mid",
"t",
"{\n l=mid+1;\n }",
"l=mid+1",
"l",
"mid+1",
"mid",
"1",
"{\n r=mid;\n }",
"r=mid",
"r",
"mid",
"if(a[r]==t)return true;\n else return false;",
"a[r]==t",
"a[r]",
"a",
"r",
"t",
"return true;",
"true",
"return false;",
"false",
"long[]a",
"a",
"long t",
"t",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){a[i]=scan.nextLong();}\n\n int q=scan.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n private static boolean check(long[]a,long t){\n int l=0,r=a.length-1;\n while(l<r){\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }\n if(a[r]==t)return true;\n else return false;\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n long[] a = new long[n];\n for(int i=0;i<n;i++){a[i]=scan.nextLong();}\n\n int q=scan.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n long t=scan.nextLong();\n if(check(a,t)){\n ans++;\n }\n }\n System.out.println(ans);\n }\n private static boolean check(long[]a,long t){\n int l=0,r=a.length-1;\n while(l<r){\n int mid=(l+r)/2;\n if(a[mid]<t){\n l=mid+1;\n }\n else{\n r=mid;\n }\n }\n if(a[r]==t)return true;\n else return false;\n }\n}",
"Main"
] | import java.io.*;
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n=scan.nextInt();
long[] a = new long[n];
for(int i=0;i<n;i++){a[i]=scan.nextLong();}
int q=scan.nextInt();
int ans=0;
for(int i=0;i<q;i++){
long t=scan.nextLong();
if(check(a,t)){
ans++;
}
}
System.out.println(ans);
}
private static boolean check(long[]a,long t){
int l=0,r=a.length-1;
while(l<r){
int mid=(l+r)/2;
if(a[mid]<t){
l=mid+1;
}
else{
r=mid;
}
}
if(a[r]==t)return true;
else return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
29,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
153,
5
],
[
153,
6
],
[
6,
7
],
[
6,
8
],
[
153,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
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
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
35,
41
],
[
41,
42
],
[
27,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
43,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
55,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
11,
65
],
[
65,
66
],
[
9,
67
],
[
67,
68
],
[
9,
69
],
[
69,
70
],
[
153,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
83,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
73,
103
],
[
103,
104
],
[
153,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
107,
116
],
[
116,
117
],
[
116,
118
],
[
107,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
119,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
134,
141
],
[
141,
142
],
[
142,
143
],
[
107,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
105,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n static Scanner sc = new Scanner(System.in);\n \n private static boolean binarySearch(int[] array, int key){\n int left = 0;\n int right = array.length;\n int mid = 0;\n while(left < right){\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }\n return false;\n }\n \n private static int[] inputArray(){\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n return array;\n } \n \n public static void main(String[] args){\n int[] s = inputArray();\n int[] t = inputArray();\n int count = 0;\n \n for(int i = 0; i < t.length; i++){\n if(binarySearch(s, t[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n static Scanner sc = new Scanner(System.in);\n \n private static boolean binarySearch(int[] array, int key){\n int left = 0;\n int right = array.length;\n int mid = 0;\n while(left < right){\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }\n return false;\n }\n \n private static int[] inputArray(){\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n return array;\n } \n \n public static void main(String[] args){\n int[] s = inputArray();\n int[] t = inputArray();\n int count = 0;\n \n for(int i = 0; i < t.length; i++){\n if(binarySearch(s, t[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"private static boolean binarySearch(int[] array, int key){\n int left = 0;\n int right = array.length;\n int mid = 0;\n while(left < right){\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = array.length;\n int mid = 0;\n while(left < right){\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = array.length;",
"right",
"array.length",
"array",
"array.length",
"int mid = 0;",
"mid",
"0",
"while(left < right){\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(array[mid] == key) return true;",
"array[mid] == key",
"array[mid]",
"array",
"mid",
"key",
"return true;",
"true",
"if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }",
"array[mid] < key",
"array[mid]",
"array",
"mid",
"key",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if(array[mid] > key){\n right = mid;\n }",
"array[mid] > key",
"array[mid]",
"array",
"mid",
"key",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"return false;",
"false",
"int[] array",
"array",
"int key",
"key",
"private static int[] inputArray(){\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n return array;\n }",
"inputArray",
"{\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n return array;\n }",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] array = new int[num];",
"array",
"new int[num]",
"num",
"for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n array[i] = sc.nextInt();\n }",
"{\n array[i] = sc.nextInt();\n }",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"return array;",
"array",
"public static void main(String[] args){\n int[] s = inputArray();\n int[] t = inputArray();\n int count = 0;\n \n for(int i = 0; i < t.length; i++){\n if(binarySearch(s, t[i])){\n count++;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n int[] s = inputArray();\n int[] t = inputArray();\n int count = 0;\n \n for(int i = 0; i < t.length; i++){\n if(binarySearch(s, t[i])){\n count++;\n }\n }\n System.out.println(count);\n }",
"int[] s = inputArray();",
"s",
"inputArray()",
"inputArray",
"int[] t = inputArray();",
"t",
"inputArray()",
"inputArray",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < t.length; i++){\n if(binarySearch(s, t[i])){\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < t.length",
"i",
"t.length",
"t",
"t.length",
"i++",
"i++",
"i",
"{\n if(binarySearch(s, t[i])){\n count++;\n }\n }",
"{\n if(binarySearch(s, t[i])){\n count++;\n }\n }",
"if(binarySearch(s, t[i])){\n count++;\n }",
"binarySearch(s, t[i])",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n static Scanner sc = new Scanner(System.in);\n \n private static boolean binarySearch(int[] array, int key){\n int left = 0;\n int right = array.length;\n int mid = 0;\n while(left < right){\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }\n return false;\n }\n \n private static int[] inputArray(){\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n return array;\n } \n \n public static void main(String[] args){\n int[] s = inputArray();\n int[] t = inputArray();\n int count = 0;\n \n for(int i = 0; i < t.length; i++){\n if(binarySearch(s, t[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n}",
"public class Main{\n static Scanner sc = new Scanner(System.in);\n \n private static boolean binarySearch(int[] array, int key){\n int left = 0;\n int right = array.length;\n int mid = 0;\n while(left < right){\n mid = (left + right) / 2;\n if(array[mid] == key) return true;\n if(array[mid] < key){\n left = mid + 1;\n }else if(array[mid] > key){\n right = mid;\n }\n }\n return false;\n }\n \n private static int[] inputArray(){\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n return array;\n } \n \n public static void main(String[] args){\n int[] s = inputArray();\n int[] t = inputArray();\n int count = 0;\n \n for(int i = 0; i < t.length; i++){\n if(binarySearch(s, t[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
static Scanner sc = new Scanner(System.in);
private static boolean binarySearch(int[] array, int key){
int left = 0;
int right = array.length;
int mid = 0;
while(left < right){
mid = (left + right) / 2;
if(array[mid] == key) return true;
if(array[mid] < key){
left = mid + 1;
}else if(array[mid] > key){
right = mid;
}
}
return false;
}
private static int[] inputArray(){
int num = sc.nextInt();
int[] array = new int[num];
for(int i = 0; i < num; i++){
array[i] = sc.nextInt();
}
return array;
}
public static void main(String[] args){
int[] s = inputArray();
int[] t = inputArray();
int count = 0;
for(int i = 0; i < t.length; i++){
if(binarySearch(s, t[i])){
count++;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
20,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
9,
14,
2,
13,
13,
30,
0,
13,
2,
13,
17,
9,
29,
17,
29,
17,
23,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
20,
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,
4,
18,
13,
17,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
4,
13,
12,
13,
30,
29,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
506,
20
],
[
506,
21
],
[
21,
22
],
[
21,
23
],
[
506,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
31,
32
],
[
24,
33
],
[
33,
34
],
[
506,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
37,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
37,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
37,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
37,
60
],
[
60,
61
],
[
60,
62
],
[
37,
63
],
[
63,
64
],
[
63,
65
],
[
63,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
69,
72
],
[
68,
73
],
[
73,
74
],
[
37,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
506,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
83,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
96,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
96,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
96,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
122,
128
],
[
96,
129
],
[
129,
130
],
[
83,
131
],
[
131,
132
],
[
81,
133
],
[
133,
134
],
[
81,
135
],
[
135,
136
],
[
0,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
137,
144
],
[
144,
145
],
[
144,
146
],
[
137,
148
],
[
148,
149
],
[
137,
150
],
[
150,
151
],
[
137,
152
],
[
152,
153
],
[
152,
154
],
[
137,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
158,
163
],
[
163,
164
],
[
157,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
173,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
182,
185
],
[
169,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
191,
192
],
[
157,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
137,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
200,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
200,
214
],
[
214,
215
],
[
215,
216
],
[
214,
217
],
[
200,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
218,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
224,
227
],
[
223,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
200,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
137,
236
],
[
236,
237
],
[
236,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
137,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
137,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
257,
262
],
[
262,
263
],
[
262,
264
],
[
257,
265
],
[
265,
266
],
[
266,
267
],
[
257,
268
],
[
268,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
269,
273
],
[
273,
274
],
[
252,
275
],
[
275,
276
],
[
250,
277
],
[
277,
278
],
[
137,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
281,
286
],
[
286,
287
],
[
287,
288
],
[
288,
289
],
[
288,
290
],
[
286,
291
],
[
291,
292
],
[
291,
293
],
[
286,
294
],
[
294,
295
],
[
295,
296
],
[
286,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
299,
301
],
[
298,
302
],
[
302,
303
],
[
281,
304
],
[
304,
305
],
[
305,
306
],
[
306,
307
],
[
305,
308
],
[
279,
309
],
[
309,
310
],
[
137,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
313,
319
],
[
319,
320
],
[
320,
321
],
[
321,
322
],
[
321,
323
],
[
319,
324
],
[
324,
325
],
[
324,
326
],
[
319,
327
],
[
327,
328
],
[
328,
329
],
[
319,
330
],
[
330,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
331,
335
],
[
335,
336
],
[
335,
337
],
[
313,
338
],
[
338,
339
],
[
311,
340
],
[
340,
341
],
[
311,
342
],
[
342,
343
],
[
137,
344
],
[
344,
345
],
[
344,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
346,
350
],
[
350,
351
],
[
351,
352
],
[
352,
353
],
[
352,
354
],
[
350,
355
],
[
355,
356
],
[
355,
357
],
[
350,
358
],
[
358,
359
],
[
359,
360
],
[
350,
361
],
[
361,
362
],
[
362,
363
],
[
363,
364
],
[
362,
365
],
[
365,
366
],
[
365,
367
],
[
346,
368
],
[
368,
369
],
[
344,
370
],
[
370,
371
],
[
344,
372
],
[
372,
373
],
[
137,
374
],
[
374,
375
],
[
374,
376
],
[
376,
377
],
[
377,
378
],
[
377,
379
],
[
379,
380
],
[
376,
381
],
[
381,
382
],
[
382,
383
],
[
382,
384
],
[
381,
385
],
[
385,
386
],
[
386,
387
],
[
386,
388
],
[
388,
389
],
[
376,
390
],
[
390,
391
],
[
390,
392
],
[
376,
393
],
[
393,
394
],
[
394,
395
],
[
394,
396
],
[
393,
397
],
[
397,
398
],
[
398,
399
],
[
398,
400
],
[
400,
401
],
[
397,
402
],
[
402,
403
],
[
402,
404
],
[
404,
405
],
[
376,
406
],
[
406,
407
],
[
406,
408
],
[
376,
409
],
[
409,
410
],
[
410,
411
],
[
411,
412
],
[
411,
413
],
[
409,
414
],
[
414,
415
],
[
415,
416
],
[
416,
417
],
[
417,
418
],
[
417,
419
],
[
416,
420
],
[
420,
421
],
[
420,
422
],
[
415,
423
],
[
423,
424
],
[
414,
425
],
[
425,
426
],
[
425,
427
],
[
414,
428
],
[
428,
429
],
[
428,
430
],
[
430,
431
],
[
430,
432
],
[
414,
433
],
[
433,
434
],
[
433,
435
],
[
435,
436
],
[
376,
437
],
[
437,
438
],
[
438,
439
],
[
438,
440
],
[
137,
441
],
[
441,
442
],
[
441,
443
],
[
443,
444
],
[
444,
445
],
[
445,
446
],
[
446,
447
],
[
445,
448
],
[
448,
449
],
[
137,
450
],
[
450,
451
],
[
450,
452
],
[
452,
453
],
[
453,
454
],
[
453,
455
],
[
452,
457
],
[
457,
458
],
[
458,
459
],
[
459,
460
],
[
459,
461
],
[
457,
462
],
[
462,
463
],
[
462,
464
],
[
457,
465
],
[
465,
466
],
[
466,
467
],
[
457,
468
],
[
468,
469
],
[
469,
470
],
[
470,
471
],
[
470,
472
],
[
469,
473
],
[
473,
474
],
[
452,
475
],
[
475,
476
],
[
450,
477
],
[
477,
478
],
[
137,
479
],
[
479,
480
],
[
479,
481
],
[
481,
482
],
[
482,
483
],
[
486,
484
],
[
496,
485
],
[
493,
486
],
[
486,
487
],
[
487,
488
],
[
487,
489
],
[
486,
490
],
[
490,
491
],
[
490,
492
],
[
493,
493
],
[
493,
494
],
[
493,
495
],
[
496,
496
],
[
496,
497
],
[
496,
498
],
[
486,
499
],
[
499,
500
],
[
499,
501
],
[
501,
502
],
[
479,
503
],
[
503,
504
],
[
0,
505
],
[
505,
506
],
[
505,
507
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.List;\n\n/**\n * @see <a href='http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?lang=jp&id='>??????</a>\n */\npublic class Main {\n private static FastReader in = new FastReader();\n\n public static void main(String[] args) throws Exception {\n Main main = new Main();\n main.run();\n }\n\n private void run() {\n int n = in.nextInt();\n int[] s = in.nextIntArray(n);\n int q = in.nextInt();\n int[] t = in.nextIntArray(q);\n\n int count = 0;\n for (int target : t) {\n if (binarySearch(s, target)) count++;\n }\n System.out.println(count);\n }\n\n private boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}\n\nclass FastReader {\n private InputStream in = System.in;\n private byte[] buf = new byte[1024];\n private int charNum;\n private int charLen;\n private StringBuilder sb = new StringBuilder();\n\n public int read() {\n if (charLen == -1)\n throw new InputMismatchException();\n if (charNum >= charLen) {\n charNum = 0;\n try {\n charLen = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (charLen <= 0)\n return -1;\n }\n return buf[charNum++];\n }\n\n public String next() {\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n sb.setLength(0);\n do {\n sb.appendCodePoint(c);\n c = read();\n } while (!isWhitespace(c));\n return sb.toString();\n }\n\n public char[] nextCharArray() {\n return next().toCharArray();\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n\n public int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return array;\n }\n\n public List<Integer> nextIntList(int n) {\n Integer[] array = new Integer[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return Arrays.asList(array);\n }\n\n public int[][] nextIntArray2D(int n, int m) {\n int[][] array = new int[n][m];\n for (int i = 0; i < n; i++)\n array[i] = nextIntArray(m);\n return array;\n }\n\n public List<int[]> nextIntsList(int n, int m) {\n List<int[]> list = new ArrayList<int[]>(n);\n for (int i = 0; i < n; i++)\n list.add(nextIntArray(m));\n return list;\n }\n\n public long nextLong() {\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isWhitespace(c));\n return res * sgn;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n return array;\n }\n\n public boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.List;",
"List",
"java.util",
"public class Main {\n private static FastReader in = new FastReader();\n\n public static void main(String[] args) throws Exception {\n Main main = new Main();\n main.run();\n }\n\n private void run() {\n int n = in.nextInt();\n int[] s = in.nextIntArray(n);\n int q = in.nextInt();\n int[] t = in.nextIntArray(q);\n\n int count = 0;\n for (int target : t) {\n if (binarySearch(s, target)) count++;\n }\n System.out.println(count);\n }\n\n private boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}",
"Main",
"private static FastReader in = new FastReader();",
"in",
"new FastReader()",
"public static void main(String[] args) throws Exception {\n Main main = new Main();\n main.run();\n }",
"main",
"{\n Main main = new Main();\n main.run();\n }",
"Main main = new Main();",
"main",
"new Main()",
"main.run()",
"main.run",
"main",
"String[] args",
"args",
"private void run() {\n int n = in.nextInt();\n int[] s = in.nextIntArray(n);\n int q = in.nextInt();\n int[] t = in.nextIntArray(q);\n\n int count = 0;\n for (int target : t) {\n if (binarySearch(s, target)) count++;\n }\n System.out.println(count);\n }",
"run",
"{\n int n = in.nextInt();\n int[] s = in.nextIntArray(n);\n int q = in.nextInt();\n int[] t = in.nextIntArray(q);\n\n int count = 0;\n for (int target : t) {\n if (binarySearch(s, target)) count++;\n }\n System.out.println(count);\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] s = in.nextIntArray(n);",
"s",
"in.nextIntArray(n)",
"in.nextIntArray",
"in",
"n",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"int[] t = in.nextIntArray(q);",
"t",
"in.nextIntArray(q)",
"in.nextIntArray",
"in",
"q",
"int count = 0;",
"count",
"0",
"for (int target : t) {\n if (binarySearch(s, target)) count++;\n }",
"int target",
"t",
"{\n if (binarySearch(s, target)) count++;\n }",
"{\n if (binarySearch(s, target)) count++;\n }",
"if (binarySearch(s, target)) count++;",
"binarySearch(s, target)",
"binarySearch",
"s",
"target",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"private boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = array.length;",
"right",
"array.length",
"array",
"array.length",
"while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"int temp = array[mid];",
"temp",
"array[mid]",
"array",
"mid",
"if (target < temp) {\n right = mid;\n continue;\n }",
"target < temp",
"target",
"temp",
"{\n right = mid;\n continue;\n }",
"right = mid",
"right",
"mid",
"continue;",
"if (temp < target) {\n left = mid + 1;\n continue;\n }",
"temp < target",
"temp",
"target",
"{\n left = mid + 1;\n continue;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"continue;",
"return true;",
"true",
"return false;",
"false",
"int[] array",
"array",
"int target",
"target",
"class FastReader {\n private InputStream in = System.in;\n private byte[] buf = new byte[1024];\n private int charNum;\n private int charLen;\n private StringBuilder sb = new StringBuilder();\n\n public int read() {\n if (charLen == -1)\n throw new InputMismatchException();\n if (charNum >= charLen) {\n charNum = 0;\n try {\n charLen = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (charLen <= 0)\n return -1;\n }\n return buf[charNum++];\n }\n\n public String next() {\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n sb.setLength(0);\n do {\n sb.appendCodePoint(c);\n c = read();\n } while (!isWhitespace(c));\n return sb.toString();\n }\n\n public char[] nextCharArray() {\n return next().toCharArray();\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n\n public int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return array;\n }\n\n public List<Integer> nextIntList(int n) {\n Integer[] array = new Integer[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return Arrays.asList(array);\n }\n\n public int[][] nextIntArray2D(int n, int m) {\n int[][] array = new int[n][m];\n for (int i = 0; i < n; i++)\n array[i] = nextIntArray(m);\n return array;\n }\n\n public List<int[]> nextIntsList(int n, int m) {\n List<int[]> list = new ArrayList<int[]>(n);\n for (int i = 0; i < n; i++)\n list.add(nextIntArray(m));\n return list;\n }\n\n public long nextLong() {\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isWhitespace(c));\n return res * sgn;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n return array;\n }\n\n public boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n}",
"FastReader",
"private InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int charNum;",
"charNum",
"private int charLen;",
"charLen",
"private StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"public int read() {\n if (charLen == -1)\n throw new InputMismatchException();\n if (charNum >= charLen) {\n charNum = 0;\n try {\n charLen = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (charLen <= 0)\n return -1;\n }\n return buf[charNum++];\n }",
"read",
"{\n if (charLen == -1)\n throw new InputMismatchException();\n if (charNum >= charLen) {\n charNum = 0;\n try {\n charLen = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (charLen <= 0)\n return -1;\n }\n return buf[charNum++];\n }",
"if (charLen == -1)\n throw new InputMismatchException();",
"charLen == -1",
"charLen",
"-1",
"1",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (charNum >= charLen) {\n charNum = 0;\n try {\n charLen = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (charLen <= 0)\n return -1;\n }",
"charNum >= charLen",
"charNum",
"charLen",
"{\n charNum = 0;\n try {\n charLen = in.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (charLen <= 0)\n return -1;\n }",
"charNum = 0",
"charNum",
"0",
"try {\n charLen = in.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 charLen = in.read(buf);\n }",
"charLen = in.read(buf)",
"charLen",
"in.read(buf)",
"in.read",
"in",
"buf",
"if (charLen <= 0)\n return -1;",
"charLen <= 0",
"charLen",
"0",
"return -1;",
"-1",
"1",
"return buf[charNum++];",
"buf[charNum++]",
"buf",
"charNum++",
"charNum",
"public String next() {\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n sb.setLength(0);\n do {\n sb.appendCodePoint(c);\n c = read();\n } while (!isWhitespace(c));\n return sb.toString();\n }",
"next",
"{\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n sb.setLength(0);\n do {\n sb.appendCodePoint(c);\n c = read();\n } while (!isWhitespace(c));\n return sb.toString();\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isWhitespace(c)) {\n c = read();\n }",
"isWhitespace(c)",
"isWhitespace",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"sb.setLength(0)",
"sb.setLength",
"sb",
"0",
"do {\n sb.appendCodePoint(c);\n c = read();\n } while (!isWhitespace(c));",
"!isWhitespace(c)",
"isWhitespace(c)",
"isWhitespace",
"c",
"{\n sb.appendCodePoint(c);\n c = read();\n }",
"sb.appendCodePoint(c)",
"sb.appendCodePoint",
"sb",
"c",
"c = read()",
"c",
"read()",
"read",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public char[] nextCharArray() {\n return next().toCharArray();\n }",
"nextCharArray",
"{\n return next().toCharArray();\n }",
"return next().toCharArray();",
"next().toCharArray()",
"next().toCharArray",
"next()",
"next",
"public int nextInt() {\n return (int) nextLong();\n }",
"nextInt",
"{\n return (int) nextLong();\n }",
"return (int) nextLong();",
"(int) nextLong()",
"nextLong",
"public int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return array;\n }",
"nextIntArray",
"{\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return array;\n }",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n array[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"array[i] = nextInt();",
"array[i] = nextInt()",
"array[i]",
"array",
"i",
"nextInt()",
"nextInt",
"return array;",
"array",
"int n",
"n",
"public List<Integer> nextIntList(int n) {\n Integer[] array = new Integer[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return Arrays.asList(array);\n }",
"nextIntList",
"{\n Integer[] array = new Integer[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n return Arrays.asList(array);\n }",
"Integer[] array = new Integer[n];",
"array",
"new Integer[n]",
"n",
"for (int i = 0; i < n; i++)\n array[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"array[i] = nextInt();",
"array[i] = nextInt()",
"array[i]",
"array",
"i",
"nextInt()",
"nextInt",
"return Arrays.asList(array);",
"Arrays.asList(array)",
"Arrays.asList",
"Arrays",
"array",
"int n",
"n",
"public int[][] nextIntArray2D(int n, int m) {\n int[][] array = new int[n][m];\n for (int i = 0; i < n; i++)\n array[i] = nextIntArray(m);\n return array;\n }",
"nextIntArray2D",
"{\n int[][] array = new int[n][m];\n for (int i = 0; i < n; i++)\n array[i] = nextIntArray(m);\n return array;\n }",
"int[][] array = new int[n][m];",
"array",
"new int[n][m]",
"n",
"m",
"for (int i = 0; i < n; i++)\n array[i] = nextIntArray(m);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"array[i] = nextIntArray(m);",
"array[i] = nextIntArray(m)",
"array[i]",
"array",
"i",
"nextIntArray(m)",
"nextIntArray",
"m",
"return array;",
"array",
"int n",
"n",
"int m",
"m",
"public List<int[]> nextIntsList(int n, int m) {\n List<int[]> list = new ArrayList<int[]>(n);\n for (int i = 0; i < n; i++)\n list.add(nextIntArray(m));\n return list;\n }",
"nextIntsList",
"{\n List<int[]> list = new ArrayList<int[]>(n);\n for (int i = 0; i < n; i++)\n list.add(nextIntArray(m));\n return list;\n }",
"List<int[]> list = new ArrayList<int[]>(n);",
"list",
"new ArrayList<int[]>(n)",
"for (int i = 0; i < n; i++)\n list.add(nextIntArray(m));",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"list.add(nextIntArray(m));",
"list.add(nextIntArray(m))",
"list.add",
"list",
"nextIntArray(m)",
"nextIntArray",
"m",
"return list;",
"list",
"int n",
"n",
"int m",
"m",
"public long nextLong() {\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isWhitespace(c));\n return res * sgn;\n }",
"nextLong",
"{\n int c = read();\n while (isWhitespace(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isWhitespace(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isWhitespace(c)) {\n c = read();\n }",
"isWhitespace(c)",
"isWhitespace",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"long res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isWhitespace(c));",
"!isWhitespace(c)",
"isWhitespace(c)",
"isWhitespace",
"c",
"{\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\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 = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public double nextDouble() {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n return array;\n }",
"nextDoubleArray",
"{\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n return array;\n }",
"double[] array = new double[n];",
"array",
"new double[n]",
"n",
"for (int i = 0; i < n; i++)\n array[i] = nextDouble();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"array[i] = nextDouble();",
"array[i] = nextDouble()",
"array[i]",
"array",
"i",
"nextDouble()",
"nextDouble",
"return array;",
"array",
"int n",
"n",
"public boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isWhitespace",
"{\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public class Main {\n private static FastReader in = new FastReader();\n\n public static void main(String[] args) throws Exception {\n Main main = new Main();\n main.run();\n }\n\n private void run() {\n int n = in.nextInt();\n int[] s = in.nextIntArray(n);\n int q = in.nextInt();\n int[] t = in.nextIntArray(q);\n\n int count = 0;\n for (int target : t) {\n if (binarySearch(s, target)) count++;\n }\n System.out.println(count);\n }\n\n private boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}",
"public class Main {\n private static FastReader in = new FastReader();\n\n public static void main(String[] args) throws Exception {\n Main main = new Main();\n main.run();\n }\n\n private void run() {\n int n = in.nextInt();\n int[] s = in.nextIntArray(n);\n int q = in.nextInt();\n int[] t = in.nextIntArray(q);\n\n int count = 0;\n for (int target : t) {\n if (binarySearch(s, target)) count++;\n }\n System.out.println(count);\n }\n\n private boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
/**
* @see <a href='http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?lang=jp&id='>??????</a>
*/
public class Main {
private static FastReader in = new FastReader();
public static void main(String[] args) throws Exception {
Main main = new Main();
main.run();
}
private void run() {
int n = in.nextInt();
int[] s = in.nextIntArray(n);
int q = in.nextInt();
int[] t = in.nextIntArray(q);
int count = 0;
for (int target : t) {
if (binarySearch(s, target)) count++;
}
System.out.println(count);
}
private boolean binarySearch(int[] array, int target) {
int left = 0;
int right = array.length;
while (left < right) {
int mid = (left + right) / 2;
int temp = array[mid];
if (target < temp) {
right = mid;
continue;
}
if (temp < target) {
left = mid + 1;
continue;
}
return true;
}
return false;
}
}
class FastReader {
private InputStream in = System.in;
private byte[] buf = new byte[1024];
private int charNum;
private int charLen;
private StringBuilder sb = new StringBuilder();
public int read() {
if (charLen == -1)
throw new InputMismatchException();
if (charNum >= charLen) {
charNum = 0;
try {
charLen = in.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (charLen <= 0)
return -1;
}
return buf[charNum++];
}
public String next() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
sb.setLength(0);
do {
sb.appendCodePoint(c);
c = read();
} while (!isWhitespace(c));
return sb.toString();
}
public char[] nextCharArray() {
return next().toCharArray();
}
public int nextInt() {
return (int) nextLong();
}
public int[] nextIntArray(int n) {
int[] array = new int[n];
for (int i = 0; i < n; i++)
array[i] = nextInt();
return array;
}
public List<Integer> nextIntList(int n) {
Integer[] array = new Integer[n];
for (int i = 0; i < n; i++)
array[i] = nextInt();
return Arrays.asList(array);
}
public int[][] nextIntArray2D(int n, int m) {
int[][] array = new int[n][m];
for (int i = 0; i < n; i++)
array[i] = nextIntArray(m);
return array;
}
public List<int[]> nextIntsList(int n, int m) {
List<int[]> list = new ArrayList<int[]>(n);
for (int i = 0; i < n; i++)
list.add(nextIntArray(m));
return list;
}
public long nextLong() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isWhitespace(c));
return res * sgn;
}
public double nextDouble() {
return Double.parseDouble(next());
}
public double[] nextDoubleArray(int n) {
double[] array = new double[n];
for (int i = 0; i < n; i++)
array[i] = nextDouble();
return array;
}
public boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
} |
[
7,
15,
13,
17,
6,
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,
0,
13,
13,
29,
17,
23,
13,
23,
13,
23,
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,
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,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
143,
5
],
[
143,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
29,
35
],
[
35,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
37,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
37,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
6,
53
],
[
53,
54
],
[
6,
55
],
[
55,
56
],
[
6,
57
],
[
57,
58
],
[
143,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
61,
70
],
[
70,
71
],
[
70,
72
],
[
73,
74
],
[
73,
75
],
[
61,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
61,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
61,
101
],
[
101,
102
],
[
101,
103
],
[
61,
104
],
[
104,
105
],
[
104,
106
],
[
61,
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
],
[
127,
128
],
[
126,
129
],
[
126,
130
],
[
126,
131
],
[
125,
132
],
[
132,
133
],
[
61,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
59,
140
],
[
140,
141
],
[
0,
142
],
[
142,
143
],
[
142,
144
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public boolean binarySearch(int[] s, int n, int key) {\n int left = 0;\n int right = n;\n int mid;\n while (left < right) { // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }\n return false;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n\n int q = in.nextInt();\n\n Main test = new Main();\n int sum = 0;\n\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }\n System.out.println(sum);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public boolean binarySearch(int[] s, int n, int key) {\n int left = 0;\n int right = n;\n int mid;\n while (left < right) { // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }\n return false;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n\n int q = in.nextInt();\n\n Main test = new Main();\n int sum = 0;\n\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }\n System.out.println(sum);\n }\n}",
"Main",
"public boolean binarySearch(int[] s, int n, int key) {\n int left = 0;\n int right = n;\n int mid;\n while (left < right) { // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n int mid;\n while (left < right) { // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while (left < right) { // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }",
"left < right",
"left",
"right",
"{ // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分",
"key == s[mid]",
"key",
"s[mid]",
"s",
"mid",
"return true; // 发现 key",
"true",
"if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分",
"key > s[mid]",
"key",
"s[mid]",
"s",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"right = mid",
"right",
"mid",
"return false;",
"false",
"int[] s",
"s",
"int n",
"n",
"int key",
"key",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n\n int q = in.nextInt();\n\n Main test = new Main();\n int sum = 0;\n\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n\n int q = in.nextInt();\n\n Main test = new Main();\n int sum = 0;\n\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }\n System.out.println(sum);\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 + 1];",
"s",
"new int[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = in.nextInt();\n }",
"{\n s[i] = in.nextInt();\n }",
"s[i] = in.nextInt()",
"s[i]",
"s",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"Main test = new Main();",
"test",
"new Main()",
"int sum = 0;",
"sum",
"0",
"for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }",
"{\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }",
"int key = in.nextInt();",
"key",
"in.nextInt()",
"in.nextInt",
"in",
"if (test.binarySearch(s, n, key)) sum++;",
"test.binarySearch(s, n, key)",
"test.binarySearch",
"test",
"s",
"n",
"key",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n public boolean binarySearch(int[] s, int n, int key) {\n int left = 0;\n int right = n;\n int mid;\n while (left < right) { // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }\n return false;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n\n int q = in.nextInt();\n\n Main test = new Main();\n int sum = 0;\n\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }\n System.out.println(sum);\n }\n}",
"public class Main {\n public boolean binarySearch(int[] s, int n, int key) {\n int left = 0;\n int right = n;\n int mid;\n while (left < right) { // 表示搜索范围不为空\n mid = (left + right) / 2;\n if(key == s[mid]) return true; // 发现 key\n else if(key > s[mid]) left = mid + 1; // 搜索后半部分\n else right = mid; // 搜索前半部分\n }\n return false;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = in.nextInt();\n }\n\n int q = in.nextInt();\n\n Main test = new Main();\n int sum = 0;\n\n for (int i = 0; i < q; i++) {\n int key = in.nextInt();\n if (test.binarySearch(s, n, key)) sum++;\n }\n System.out.println(sum);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public boolean binarySearch(int[] s, int n, int key) {
int left = 0;
int right = n;
int mid;
while (left < right) { // 表示搜索范围不为空
mid = (left + right) / 2;
if(key == s[mid]) return true; // 发现 key
else if(key > s[mid]) left = mid + 1; // 搜索后半部分
else right = mid; // 搜索前半部分
}
return false;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] s = new int[n + 1];
for (int i = 0; i < n; i++) {
s[i] = in.nextInt();
}
int q = in.nextInt();
Main test = new Main();
int sum = 0;
for (int i = 0; i < q; i++) {
int key = in.nextInt();
if (test.binarySearch(s, n, key)) sum++;
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
12,
13,
30,
41,
13,
17,
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,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
163,
5
],
[
163,
6
],
[
6,
7
],
[
163,
8
],
[
8,
9
],
[
163,
10
],
[
10,
11
],
[
163,
12
],
[
12,
13
],
[
163,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
163,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
24,
33
],
[
33,
34
],
[
33,
35
],
[
24,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
24,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
24,
62
],
[
62,
63
],
[
62,
64
],
[
24,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
24,
86
],
[
86,
87
],
[
87,
88
],
[
163,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
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
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
107,
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
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
118,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
138,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
91,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tint n;\n\tint s[];\n\tint q;\n\tint t[];\n\tpublic static void main(String args[]) {\n\t\tnew Main().run();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t}\n\t\tq = scan.nextInt();\n\t\tt = new int[n];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\t}\n\tpublic void run() {\n\t\tint cnt = 0;\n\t\tfor (int j = 0; j < q; j++) {\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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\tSystem.out.println(cnt);\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tint n;\n\tint s[];\n\tint q;\n\tint t[];\n\tpublic static void main(String args[]) {\n\t\tnew Main().run();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t}\n\t\tq = scan.nextInt();\n\t\tt = new int[n];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\t}\n\tpublic void run() {\n\t\tint cnt = 0;\n\t\tfor (int j = 0; j < q; j++) {\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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\tSystem.out.println(cnt);\n\t}\n}",
"Main",
"int n;",
"n",
"int s[];",
"s",
"int q;",
"q",
"int t[];",
"t",
"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",
"Main() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t}\n\t\tq = scan.nextInt();\n\t\tt = new int[n];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\t}",
"Main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t}\n\t\tq = scan.nextInt();\n\t\tt = new int[n];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"s = new int[n]",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ts[i] = scan.nextInt();\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",
"q = scan.nextInt()",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"t = new int[n]",
"t",
"new int[n]",
"n",
"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",
"scan.close()",
"scan.close",
"scan",
"public void run() {\n\t\tint cnt = 0;\n\t\tfor (int j = 0; j < q; j++) {\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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\tSystem.out.println(cnt);\n\t}",
"run",
"{\n\t\tint cnt = 0;\n\t\tfor (int j = 0; j < q; j++) {\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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\tSystem.out.println(cnt);\n\t}",
"int cnt = 0;",
"cnt",
"0",
"for (int j = 0; j < q; j++) {\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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 j = 0;",
"int j = 0;",
"j",
"0",
"j < q",
"j",
"q",
"j++",
"j++",
"j",
"{\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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 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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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 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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\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[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\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[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"s[mid] == t[j]",
"s[mid]",
"s",
"mid",
"t[j]",
"t",
"j",
"{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"cnt++",
"cnt",
"break;",
"if (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"s[mid] <= t[j]",
"s[mid]",
"s",
"mid",
"t[j]",
"t",
"j",
"{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"{\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"right = mid",
"right",
"mid",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"public class Main {\n\tint n;\n\tint s[];\n\tint q;\n\tint t[];\n\tpublic static void main(String args[]) {\n\t\tnew Main().run();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t}\n\t\tq = scan.nextInt();\n\t\tt = new int[n];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\t}\n\tpublic void run() {\n\t\tint cnt = 0;\n\t\tfor (int j = 0; j < q; j++) {\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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\tSystem.out.println(cnt);\n\t}\n}",
"public class Main {\n\tint n;\n\tint s[];\n\tint q;\n\tint t[];\n\tpublic static void main(String args[]) {\n\t\tnew Main().run();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t}\n\t\tq = scan.nextInt();\n\t\tt = new int[n];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\t}\n\tpublic void run() {\n\t\tint cnt = 0;\n\t\tfor (int j = 0; j < q; j++) {\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 (s[mid] == t[j]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (s[mid] <= t[j]) {\n\t\t\t\t\tleft = mid + 1;\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\tSystem.out.println(cnt);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
int n;
int s[];
int q;
int t[];
public static void main(String args[]) {
new Main().run();
}
Main() {
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = scan.nextInt();
}
q = scan.nextInt();
t = new int[n];
for (int i = 0; i < q; i++) {
t[i] = scan.nextInt();
}
scan.close();
}
public void run() {
int cnt = 0;
for (int j = 0; j < q; j++) {
int left = 0;
int right = n;
while (left < right) {
int mid = (left + right) / 2;
if (s[mid] == t[j]) {
cnt++;
break;
}
if (s[mid] <= t[j]) {
left = mid + 1;
} else {
right = mid;
}
}
}
System.out.println(cnt);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
40,
17,
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,
0,
13,
13,
40,
13,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
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
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
40,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
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
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
65,
75
],
[
75,
76
],
[
75,
77
],
[
65,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
65,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
95,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
101,
107
],
[
95,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
108,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
108,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
8,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
6,
132
],
[
132,
133
]
] | [
"import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n\n\tint n, q;\n\tint c = 0;\n\n\tScanner sc = new Scanner(System.in);\n \n n = sc.nextInt();\n\n\tint[] s = new int[n];\n\n for(int i = 0; i < n; i++){\n\t s[i] = sc.nextInt();\n\t}\n\n\tq = sc.nextInt();\n\n\tfor(int i = 0; i < q; i++){\n\t int t = sc.nextInt(); \t\n\t int pos = -1;\n\t int lower = 0; \n\t int upper = n - 1;\n\t while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(c);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n public static void main(String[] args){\n\n\tint n, q;\n\tint c = 0;\n\n\tScanner sc = new Scanner(System.in);\n \n n = sc.nextInt();\n\n\tint[] s = new int[n];\n\n for(int i = 0; i < n; i++){\n\t s[i] = sc.nextInt();\n\t}\n\n\tq = sc.nextInt();\n\n\tfor(int i = 0; i < q; i++){\n\t int t = sc.nextInt(); \t\n\t int pos = -1;\n\t int lower = 0; \n\t int upper = n - 1;\n\t while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(c);\n }\n}",
"Main",
"public static void main(String[] args){\n\n\tint n, q;\n\tint c = 0;\n\n\tScanner sc = new Scanner(System.in);\n \n n = sc.nextInt();\n\n\tint[] s = new int[n];\n\n for(int i = 0; i < n; i++){\n\t s[i] = sc.nextInt();\n\t}\n\n\tq = sc.nextInt();\n\n\tfor(int i = 0; i < q; i++){\n\t int t = sc.nextInt(); \t\n\t int pos = -1;\n\t int lower = 0; \n\t int upper = n - 1;\n\t while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(c);\n }",
"main",
"{\n\n\tint n, q;\n\tint c = 0;\n\n\tScanner sc = new Scanner(System.in);\n \n n = sc.nextInt();\n\n\tint[] s = new int[n];\n\n for(int i = 0; i < n; i++){\n\t s[i] = sc.nextInt();\n\t}\n\n\tq = sc.nextInt();\n\n\tfor(int i = 0; i < q; i++){\n\t int t = sc.nextInt(); \t\n\t int pos = -1;\n\t int lower = 0; \n\t int upper = n - 1;\n\t while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(c);\n }",
"int n",
"n",
"q;",
"q",
"int c = 0;",
"c",
"0",
"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++){\n\t s[i] = sc.nextInt();\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t s[i] = sc.nextInt();\n\t}",
"{\n\t s[i] = sc.nextInt();\n\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 int t = sc.nextInt(); \t\n\t int pos = -1;\n\t int lower = 0; \n\t int upper = n - 1;\n\t while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t int t = sc.nextInt(); \t\n\t int pos = -1;\n\t int lower = 0; \n\t int upper = n - 1;\n\t while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }\n\t}",
"{\n\t int t = sc.nextInt(); \t\n\t int pos = -1;\n\t int lower = 0; \n\t int upper = n - 1;\n\t while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }\n\t}",
"int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int pos = -1;",
"pos",
"-1",
"1",
"int lower = 0;",
"lower",
"0",
"int upper = n - 1;",
"upper",
"n - 1",
"n",
"1",
"while (lower <= upper) {\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }",
"lower <= upper",
"lower",
"upper",
"{\n\t\tint mid = (lower + upper) / 2;\n\t\tif (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}\n\t }",
"int mid = (lower + upper) / 2;",
"mid",
"(lower + upper) / 2",
"(lower + upper)",
"lower",
"upper",
"2",
"if (s[mid] == t) {\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t} else if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}",
"s[mid] == t",
"s[mid]",
"s",
"mid",
"t",
"{\n\t\t pos = mid;\n\t\t c++;\n\t\t break;\n\t\t}",
"pos = mid",
"pos",
"mid",
"c++",
"c",
"break;",
"if (s[mid] < t) {\n\t\t lower = mid + 1;\n\t\t} else {\n\t\t upper = mid - 1;\n\t\t}",
"s[mid] < t",
"s[mid]",
"s",
"mid",
"t",
"{\n\t\t lower = mid + 1;\n\t\t}",
"lower = mid + 1",
"lower",
"mid + 1",
"mid",
"1",
"{\n\t\t upper = mid - 1;\n\t\t}",
"upper = mid - 1",
"upper",
"mid - 1",
"mid",
"1",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static void main(String[] args){
int n, q;
int c = 0;
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();
for(int i = 0; i < q; i++){
int t = sc.nextInt();
int pos = -1;
int lower = 0;
int upper = n - 1;
while (lower <= upper) {
int mid = (lower + upper) / 2;
if (s[mid] == t) {
pos = mid;
c++;
break;
} else if (s[mid] < t) {
lower = mid + 1;
} else {
upper = mid - 1;
}
}
}
System.out.println(c);
}
}
|
[
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,
4,
18,
13,
13,
41,
13,
17,
14,
2,
13,
13,
30,
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,
13,
13,
30,
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
],
[
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
],
[
78,
79
],
[
77,
80
],
[
11,
81
],
[
81,
82
],
[
81,
83
],
[
11,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
107,
108
],
[
107,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
102,
113
],
[
114,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
11,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
137,
138
],
[
137,
139
],
[
132,
140
],
[
140,
141
],
[
141,
142
],
[
132,
143
],
[
144,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
150,
151
],
[
150,
152
],
[
145,
153
],
[
153,
154
],
[
154,
155
],
[
145,
156
],
[
157,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
163,
165
],
[
158,
166
],
[
166,
167
],
[
167,
168
],
[
166,
169
],
[
11,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
9,
176
],
[
176,
177
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\nclass Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\t//一行目をインプット\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\t//二行目をインプット\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\t\tint count =0;\n\n\t\tif(n < q){\n\n\t\t\tfor(int i = 0; i < n;i++){\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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\n\t\tif(q < n){\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(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\n\t\tSystem.out.println(count);\n\t}\n}\n",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\t//一行目をインプット\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\t//二行目をインプット\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\t\tint count =0;\n\n\t\tif(n < q){\n\n\t\t\tfor(int i = 0; i < n;i++){\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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\n\t\tif(q < n){\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(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\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\t//一行目をインプット\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\t//二行目をインプット\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\t\tint count =0;\n\n\t\tif(n < q){\n\n\t\t\tfor(int i = 0; i < n;i++){\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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\n\t\tif(q < n){\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(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\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\n\t\t//一行目をインプット\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\t//二行目をインプット\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\t\tint count =0;\n\n\t\tif(n < q){\n\n\t\t\tfor(int i = 0; i < n;i++){\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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\n\t\tif(q < n){\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(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\n\t\tSystem.out.println(count);\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",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int count =0;",
"count",
"0",
"if(n < q){\n\n\t\t\tfor(int i = 0; i < n;i++){\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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 < q",
"n",
"q",
"{\n\n\t\t\tfor(int i = 0; i < n;i++){\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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}",
"for(int i = 0; i < n;i++){\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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\t\tfor(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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(int j = 0;j < q;j++){\n\t\t\t\t\tif(S[i] == T[j]){\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}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\t\t\tif(S[i] == T[j]){\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\tif(S[i] == T[j]){\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[i] == T[j]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"S[i] == T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"count++",
"count",
"break;",
"if(q < n){\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(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}",
"q < n",
"q",
"n",
"{\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(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}",
"for(int i = 0; i < q;i++){\n\t\t\t\tfor(int j = 0;j < n;j++){\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}",
"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(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\t\tfor(int j = 0;j < n;j++){\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(int j = 0;j < n;j++){\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}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\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\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"
] | import java.util.Arrays;
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();
}
Arrays.sort(S);
Arrays.sort(T);
int count =0;
if(n < q){
for(int i = 0; i < n;i++){
for(int j = 0;j < q;j++){
if(S[i] == T[j]){
count++;
break;
}
}
}
}
if(q < n){
for(int i = 0; i < q;i++){
for(int j = 0;j < n;j++){
if(S[j] == T[i]){
count++;
break;
}
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
0,
13,
20,
2,
13,
17,
0,
13,
20,
13,
41,
13,
4,
18,
20,
17,
41,
13,
4,
18,
20,
17,
42,
4,
18,
13,
30,
0,
18,
13,
13,
4,
18,
13,
40,
13,
42,
4,
18,
13,
30,
0,
18,
13,
13,
4,
18,
13,
40,
13,
0,
13,
4,
13,
13,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
13,
41,
13,
18,
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,
0,
13,
13,
0,
13,
2,
13,
17,
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
],
[
11,
14
],
[
14,
15
],
[
11,
16
],
[
16,
17
],
[
16,
18
],
[
11,
19
],
[
19,
20
],
[
19,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
11,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
11,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
11,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
11,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
11,
60
],
[
60,
61
],
[
60,
62
],
[
63,
64
],
[
63,
65
],
[
11,
66
],
[
66,
67
],
[
66,
68
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
11,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
11,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
92,
93
],
[
86,
94
],
[
94,
95
],
[
11,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
100,
108
],
[
108,
109
],
[
11,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
112,
115
],
[
112,
116
],
[
112,
117
],
[
11,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
11,
124
],
[
124,
125
],
[
125,
126
],
[
11,
127
],
[
127,
128
],
[
128,
129
],
[
9,
130
],
[
130,
131
],
[
7,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
138,
148
],
[
148,
149
],
[
149,
150
],
[
138,
151
],
[
152,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
156,
157
],
[
156,
158
],
[
152,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
152,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
168,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
176,
182
],
[
182,
183
],
[
183,
184
],
[
182,
185
],
[
176,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
189,
191
],
[
186,
192
],
[
192,
193
],
[
192,
194
],
[
186,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
197,
199
],
[
134,
200
],
[
200,
201
],
[
132,
202
],
[
202,
203
],
[
132,
204
],
[
204,
205
],
[
132,
206
],
[
206,
207
],
[
132,
208
],
[
208,
209
]
] | [
"import java.io.*;\nimport java.util.*;\n\nclass Main{\n public static void main(String[] args) throws Exception{\n\tint[] S;\n\tint[] T;\n\tint i = 0;\n\tint j = 0;\n\tint FOUND = 0;\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString str_n = br.readLine();\n\tString str_S = br.readLine();//data_and_key\n\tString str_q = br.readLine();\n\tString str_T = br.readLine();//key_stack\n\n\tint n = Integer.parseInt(str_n);\n\tint q = Integer.parseInt(str_q);\n\tS = new int[n+1];//S[n] = key\n\tT = new int[q];\n\n\tScanner sc_S = new Scanner(str_S).useDelimiter(\"\\\\s* \\\\s*\");\n\tScanner sc_T = new Scanner(str_T).useDelimiter(\"\\\\s* \\\\s*\");\n\n\twhile(sc_S.hasNext()){\n\t S[i] = sc_S.nextInt();\n\t i++;\n\t}\n\n\twhile(sc_T.hasNext()){\n\t T[j] = sc_T.nextInt();\n\t j++;\n\t}\n\n\tFOUND = binarySearch(n,S,q,T);\n\n\tSystem.out.println(FOUND);\n\n\tsc_S.close();\n\tsc_T.close();\n\t\n }\n\n private static int binarySearch(int n,int S[], int q, int T[]){\n\tint FOUND_COUNT = 0;\n\t\n\tfor(int j=0;j<T.length;j++){\n\t int left = 0;\n\t int right = n;\n\t int key = T[j];\n\t \n\t while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }\n\t}\n\treturn FOUND_COUNT;\n }\n}\n",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args) throws Exception{\n\tint[] S;\n\tint[] T;\n\tint i = 0;\n\tint j = 0;\n\tint FOUND = 0;\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString str_n = br.readLine();\n\tString str_S = br.readLine();//data_and_key\n\tString str_q = br.readLine();\n\tString str_T = br.readLine();//key_stack\n\n\tint n = Integer.parseInt(str_n);\n\tint q = Integer.parseInt(str_q);\n\tS = new int[n+1];//S[n] = key\n\tT = new int[q];\n\n\tScanner sc_S = new Scanner(str_S).useDelimiter(\"\\\\s* \\\\s*\");\n\tScanner sc_T = new Scanner(str_T).useDelimiter(\"\\\\s* \\\\s*\");\n\n\twhile(sc_S.hasNext()){\n\t S[i] = sc_S.nextInt();\n\t i++;\n\t}\n\n\twhile(sc_T.hasNext()){\n\t T[j] = sc_T.nextInt();\n\t j++;\n\t}\n\n\tFOUND = binarySearch(n,S,q,T);\n\n\tSystem.out.println(FOUND);\n\n\tsc_S.close();\n\tsc_T.close();\n\t\n }\n\n private static int binarySearch(int n,int S[], int q, int T[]){\n\tint FOUND_COUNT = 0;\n\t\n\tfor(int j=0;j<T.length;j++){\n\t int left = 0;\n\t int right = n;\n\t int key = T[j];\n\t \n\t while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }\n\t}\n\treturn FOUND_COUNT;\n }\n}",
"Main",
"public static void main(String[] args) throws Exception{\n\tint[] S;\n\tint[] T;\n\tint i = 0;\n\tint j = 0;\n\tint FOUND = 0;\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString str_n = br.readLine();\n\tString str_S = br.readLine();//data_and_key\n\tString str_q = br.readLine();\n\tString str_T = br.readLine();//key_stack\n\n\tint n = Integer.parseInt(str_n);\n\tint q = Integer.parseInt(str_q);\n\tS = new int[n+1];//S[n] = key\n\tT = new int[q];\n\n\tScanner sc_S = new Scanner(str_S).useDelimiter(\"\\\\s* \\\\s*\");\n\tScanner sc_T = new Scanner(str_T).useDelimiter(\"\\\\s* \\\\s*\");\n\n\twhile(sc_S.hasNext()){\n\t S[i] = sc_S.nextInt();\n\t i++;\n\t}\n\n\twhile(sc_T.hasNext()){\n\t T[j] = sc_T.nextInt();\n\t j++;\n\t}\n\n\tFOUND = binarySearch(n,S,q,T);\n\n\tSystem.out.println(FOUND);\n\n\tsc_S.close();\n\tsc_T.close();\n\t\n }",
"main",
"{\n\tint[] S;\n\tint[] T;\n\tint i = 0;\n\tint j = 0;\n\tint FOUND = 0;\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString str_n = br.readLine();\n\tString str_S = br.readLine();//data_and_key\n\tString str_q = br.readLine();\n\tString str_T = br.readLine();//key_stack\n\n\tint n = Integer.parseInt(str_n);\n\tint q = Integer.parseInt(str_q);\n\tS = new int[n+1];//S[n] = key\n\tT = new int[q];\n\n\tScanner sc_S = new Scanner(str_S).useDelimiter(\"\\\\s* \\\\s*\");\n\tScanner sc_T = new Scanner(str_T).useDelimiter(\"\\\\s* \\\\s*\");\n\n\twhile(sc_S.hasNext()){\n\t S[i] = sc_S.nextInt();\n\t i++;\n\t}\n\n\twhile(sc_T.hasNext()){\n\t T[j] = sc_T.nextInt();\n\t j++;\n\t}\n\n\tFOUND = binarySearch(n,S,q,T);\n\n\tSystem.out.println(FOUND);\n\n\tsc_S.close();\n\tsc_T.close();\n\t\n }",
"int[] S;",
"S",
"int[] T;",
"T",
"int i = 0;",
"i",
"0",
"int j = 0;",
"j",
"0",
"int FOUND = 0;",
"FOUND",
"0",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String str_n = br.readLine();",
"str_n",
"br.readLine()",
"br.readLine",
"br",
"String str_S = br.readLine();",
"str_S",
"br.readLine()",
"br.readLine",
"br",
"String str_q = br.readLine();",
"str_q",
"br.readLine()",
"br.readLine",
"br",
"String str_T = br.readLine();",
"str_T",
"br.readLine()",
"br.readLine",
"br",
"int n = Integer.parseInt(str_n);",
"n",
"Integer.parseInt(str_n)",
"Integer.parseInt",
"Integer",
"str_n",
"int q = Integer.parseInt(str_q);",
"q",
"Integer.parseInt(str_q)",
"Integer.parseInt",
"Integer",
"str_q",
"S = new int[n+1]",
"S",
"new int[n+1]",
"n+1",
"n",
"1",
"T = new int[q]",
"T",
"new int[q]",
"q",
"Scanner sc_S = new Scanner(str_S).useDelimiter(\"\\\\s* \\\\s*\");",
"sc_S",
"new Scanner(str_S).useDelimiter(\"\\\\s* \\\\s*\")",
"new Scanner(str_S).useDelimiter",
"new Scanner(str_S)",
"\"\\\\s* \\\\s*\"",
"Scanner sc_T = new Scanner(str_T).useDelimiter(\"\\\\s* \\\\s*\");",
"sc_T",
"new Scanner(str_T).useDelimiter(\"\\\\s* \\\\s*\")",
"new Scanner(str_T).useDelimiter",
"new Scanner(str_T)",
"\"\\\\s* \\\\s*\"",
"while(sc_S.hasNext()){\n\t S[i] = sc_S.nextInt();\n\t i++;\n\t}",
"sc_S.hasNext()",
"sc_S.hasNext",
"sc_S",
"{\n\t S[i] = sc_S.nextInt();\n\t i++;\n\t}",
"S[i] = sc_S.nextInt()",
"S[i]",
"S",
"i",
"sc_S.nextInt()",
"sc_S.nextInt",
"sc_S",
"i++",
"i",
"while(sc_T.hasNext()){\n\t T[j] = sc_T.nextInt();\n\t j++;\n\t}",
"sc_T.hasNext()",
"sc_T.hasNext",
"sc_T",
"{\n\t T[j] = sc_T.nextInt();\n\t j++;\n\t}",
"T[j] = sc_T.nextInt()",
"T[j]",
"T",
"j",
"sc_T.nextInt()",
"sc_T.nextInt",
"sc_T",
"j++",
"j",
"FOUND = binarySearch(n,S,q,T)",
"FOUND",
"binarySearch(n,S,q,T)",
"binarySearch",
"n",
"S",
"q",
"T",
"System.out.println(FOUND)",
"System.out.println",
"System.out",
"System",
"System.out",
"FOUND",
"sc_S.close()",
"sc_S.close",
"sc_S",
"sc_T.close()",
"sc_T.close",
"sc_T",
"String[] args",
"args",
"private static int binarySearch(int n,int S[], int q, int T[]){\n\tint FOUND_COUNT = 0;\n\t\n\tfor(int j=0;j<T.length;j++){\n\t int left = 0;\n\t int right = n;\n\t int key = T[j];\n\t \n\t while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }\n\t}\n\treturn FOUND_COUNT;\n }",
"binarySearch",
"{\n\tint FOUND_COUNT = 0;\n\t\n\tfor(int j=0;j<T.length;j++){\n\t int left = 0;\n\t int right = n;\n\t int key = T[j];\n\t \n\t while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }\n\t}\n\treturn FOUND_COUNT;\n }",
"int FOUND_COUNT = 0;",
"FOUND_COUNT",
"0",
"for(int j=0;j<T.length;j++){\n\t int left = 0;\n\t int right = n;\n\t int key = T[j];\n\t \n\t while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }\n\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<T.length",
"j",
"T.length",
"T",
"T.length",
"j++",
"j++",
"j",
"{\n\t int left = 0;\n\t int right = n;\n\t int key = T[j];\n\t \n\t while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }\n\t}",
"{\n\t int left = 0;\n\t int right = n;\n\t int key = T[j];\n\t \n\t while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }\n\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int key = T[j];",
"key",
"T[j]",
"T",
"j",
"while(left<right){\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }",
"left<right",
"left",
"right",
"{\n\t\tint mid = (left + right)/2;\n\t\tif(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;\n\t }",
"int mid = (left + right)/2;",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(S[mid] == key){\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}\n\t\telse if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;",
"S[mid] == key",
"S[mid]",
"S",
"mid",
"key",
"{\n\t\t FOUND_COUNT++;\n\t\t break;\n\t\t}",
"FOUND_COUNT++",
"FOUND_COUNT",
"break;",
"if(key < S[mid]) right = mid;\n\t\telse left = mid + 1;",
"key < S[mid]",
"key",
"S[mid]",
"S",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return FOUND_COUNT;",
"FOUND_COUNT",
"int n",
"n",
"int S[]",
"S",
"int q",
"q",
"int T[]",
"T"
] | import java.io.*;
import java.util.*;
class Main{
public static void main(String[] args) throws Exception{
int[] S;
int[] T;
int i = 0;
int j = 0;
int FOUND = 0;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str_n = br.readLine();
String str_S = br.readLine();//data_and_key
String str_q = br.readLine();
String str_T = br.readLine();//key_stack
int n = Integer.parseInt(str_n);
int q = Integer.parseInt(str_q);
S = new int[n+1];//S[n] = key
T = new int[q];
Scanner sc_S = new Scanner(str_S).useDelimiter("\\s* \\s*");
Scanner sc_T = new Scanner(str_T).useDelimiter("\\s* \\s*");
while(sc_S.hasNext()){
S[i] = sc_S.nextInt();
i++;
}
while(sc_T.hasNext()){
T[j] = sc_T.nextInt();
j++;
}
FOUND = binarySearch(n,S,q,T);
System.out.println(FOUND);
sc_S.close();
sc_T.close();
}
private static int binarySearch(int n,int S[], int q, int T[]){
int FOUND_COUNT = 0;
for(int j=0;j<T.length;j++){
int left = 0;
int right = n;
int key = T[j];
while(left<right){
int mid = (left + right)/2;
if(S[mid] == key){
FOUND_COUNT++;
break;
}
else if(key < S[mid]) right = mid;
else left = mid + 1;
}
}
return FOUND_COUNT;
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
18,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
172,
5
],
[
172,
6
],
[
6,
7
],
[
6,
8
],
[
172,
9
],
[
9,
10
],
[
172,
11
],
[
11,
12
],
[
172,
13
],
[
13,
14
],
[
13,
15
],
[
172,
16
],
[
16,
17
],
[
172,
18
],
[
18,
19
],
[
172,
20
],
[
20,
21
],
[
172,
22
],
[
22,
23
],
[
172,
24
],
[
24,
25
],
[
172,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
28,
34
],
[
34,
35
],
[
34,
36
],
[
28,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
28,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
28,
62
],
[
62,
63
],
[
62,
64
],
[
28,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
172,
85
],
[
85,
86
],
[
85,
87
],
[
87,
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
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
100,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
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
],
[
126,
127
],
[
126,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
121,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
133,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
87,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
172,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
164,
165
],
[
159,
166
],
[
166,
167
],
[
167,
168
],
[
157,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
] | [
"import java.util.*;\npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tint n,q;\n\tint C=0;\n\tint[] S,T;\n\tint left,mid,right;\n\t\n\tpublic void input() {\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t}\n\t\n\tpublic void search() {\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tSystem.out.println(C);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.search();\n\t}\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tint n,q;\n\tint C=0;\n\tint[] S,T;\n\tint left,mid,right;\n\t\n\tpublic void input() {\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t}\n\t\n\tpublic void search() {\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tSystem.out.println(C);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.search();\n\t}\n}",
"Main",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n",
"n",
"q;",
"q",
"int C=0;",
"C",
"0",
"int[] S",
"S",
"T;",
"T",
"int left",
"left",
"mid",
"mid",
"right;",
"right",
"public void input() {\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t}",
"input",
"{\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t}",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S = new int[n]",
"S",
"new int[n]",
"n",
"for(int i=0; i<n; i++) S[i] = sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = sc.nextInt();",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"T = new int[q]",
"T",
"new int[q]",
"q",
"for(int i=0; i<q; i++) T[i] = sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"T[i] = sc.nextInt();",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"public void search() {\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tSystem.out.println(C);\n\t}",
"search",
"{\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tSystem.out.println(C);\n\t}",
"for(int i=0; i<q; i++) {\n\t\t\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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}",
"left = 0",
"left",
"0",
"right = S.length",
"right",
"S.length",
"S",
"S.length",
"while(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\n\t\t\t\t}else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\n\t\t\t\t}else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\n\t\t\t\t}else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"T[i] == S[mid]",
"T[i]",
"T",
"i",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"C++",
"C",
"break;",
"if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\n\t\t\t\t}else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"T[i] > S[mid]",
"T[i]",
"T",
"i",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tleft = mid +1;\n\t\t\t\t}",
"left = mid +1",
"left",
"mid +1",
"mid",
"1",
"{\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"right = mid",
"right",
"mid",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"public static void main(String[] args) {\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.search();\n\t}",
"main",
"{\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.search();\n\t}",
"Main obj = new Main();",
"obj",
"new Main()",
"obj.input()",
"obj.input",
"obj",
"obj.search()",
"obj.search",
"obj",
"String[] args",
"args",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tint n,q;\n\tint C=0;\n\tint[] S,T;\n\tint left,mid,right;\n\t\n\tpublic void input() {\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t}\n\t\n\tpublic void search() {\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tSystem.out.println(C);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.search();\n\t}\n}",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tint n,q;\n\tint C=0;\n\tint[] S,T;\n\tint left,mid,right;\n\t\n\tpublic void input() {\n\t\tn = sc.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i=0; i<n; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tT = new int[q];\n\t\tfor(int i=0; i<q; i++) T[i] = sc.nextInt();\n\t}\n\t\n\tpublic void search() {\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tleft = 0;\n\t\t\tright = S.length;\n\t\t\twhile(left < right) {\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[i] > S[mid]) {\n\t\t\t\t\tleft = mid +1;\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\tSystem.out.println(C);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.search();\n\t}\n}",
"Main"
] | import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
int n,q;
int C=0;
int[] S,T;
int left,mid,right;
public void input() {
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();
}
public void search() {
for(int i=0; i<q; i++) {
left = 0;
right = S.length;
while(left < right) {
mid = (left + right) / 2;
if(T[i] == S[mid]) {
C++;
break;
}else if(T[i] > S[mid]) {
left = mid +1;
}else {
right = mid;
}
}
}
System.out.println(C);
}
public static void main(String[] args) {
Main obj = new Main();
obj.input();
obj.search();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
18,
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,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
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
],
[
167,
5
],
[
167,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
73,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
88,
98
],
[
98,
99
],
[
99,
100
],
[
8,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
6,
107
],
[
107,
108
],
[
167,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
111,
120
],
[
120,
121
],
[
111,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
126,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
134,
140
],
[
140,
141
],
[
141,
142
],
[
134,
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
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
111,
159
],
[
159,
160
],
[
160,
161
],
[
109,
162
],
[
162,
163
],
[
109,
164
],
[
164,
165
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
] | [
"import 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 for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) != -1) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static int binarySearch(int[] /*sorted*/ array, int target) {\n int left = 0;\n int right = array.length;\n int mid;\n while (left < right) {\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\n }\n}",
"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 for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) != -1) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static int binarySearch(int[] /*sorted*/ array, int target) {\n int left = 0;\n int right = array.length;\n int mid;\n while (left < right) {\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\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 for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) != -1) {\n count++;\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 for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) != -1) {\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",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextInt();\n }",
"{\n S[i] = sc.nextInt();\n }",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = sc.nextInt();\n }",
"{\n T[i] = sc.nextInt();\n }",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) != -1) {\n count++;\n }\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]) != -1) {\n count++;\n }\n }",
"{\n if (binarySearch(S, T[i]) != -1) {\n count++;\n }\n }",
"if (binarySearch(S, T[i]) != -1) {\n count++;\n }",
"binarySearch(S, T[i]) != -1",
"binarySearch(S, T[i])",
"binarySearch",
"S",
"T[i]",
"T",
"i",
"-1",
"1",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"private static int binarySearch(int[] /*sorted*/ array, int target) {\n int left = 0;\n int right = array.length;\n int mid;\n while (left < right) {\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\n }",
"binarySearch",
"{\n int left = 0;\n int right = array.length;\n int mid;\n while (left < right) {\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\n }",
"int left = 0;",
"left",
"0",
"int right = array.length;",
"right",
"array.length",
"array",
"array.length",
"int mid;",
"mid",
"while (left < right) {\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"array[mid] == target",
"array[mid]",
"array",
"mid",
"target",
"{\n return mid;\n }",
"return mid;",
"mid",
"if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"array[mid] > target",
"array[mid]",
"array",
"mid",
"target",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return -1;",
"-1",
"1",
"int[] /*sorted*/ array",
"array",
"int target",
"target",
"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 for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) != -1) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static int binarySearch(int[] /*sorted*/ array, int target) {\n int left = 0;\n int right = array.length;\n int mid;\n while (left < right) {\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\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 for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) != -1) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static int binarySearch(int[] /*sorted*/ array, int target) {\n int left = 0;\n int right = array.length;\n int mid;\n while (left < right) {\n mid = (left + right) / 2;\n if (array[mid] == target) {\n return mid;\n } else if (array[mid] > target) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\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[] T = new int[q];
for (int i = 0; i < q; i++) {
T[i] = sc.nextInt();
}
int count = 0;
for (int i = 0; i < T.length; i++) {
if (binarySearch(S, T[i]) != -1) {
count++;
}
}
System.out.println(count);
}
private static int binarySearch(int[] /*sorted*/ array, int target) {
int left = 0;
int right = array.length;
int mid;
while (left < right) {
mid = (left + right) / 2;
if (array[mid] == target) {
return mid;
} else if (array[mid] > target) {
right = mid;
} else {
left = mid + 1;
}
}
return -1;
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
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,
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,
28,
13,
13,
30,
30,
14,
2,
4,
18,
13,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
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
],
[
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
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
54,
55
],
[
55,
56
],
[
11,
57
],
[
57,
58
],
[
57,
59
],
[
11,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
81,
82
],
[
11,
83
],
[
83,
84
],
[
83,
85
],
[
11,
86
],
[
86,
87
],
[
86,
88
],
[
86,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
93,
97
],
[
92,
98
],
[
91,
99
],
[
99,
100
],
[
11,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
11,
107
],
[
107,
108
],
[
108,
109
],
[
9,
110
],
[
110,
111
]
] | [
"import java.util.Arrays;\n\nclass Main {\n\n private static final int CONST= 1000000007;\n public static void main(String args[]) {\n\t\tjava.util.Scanner sc = new java.util.Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int[] S = new int[n];\n for(int i=0; i<n; i++) S[i] = Integer.parseInt(sc.next());\n\n int q = Integer.parseInt(sc.next());\n int[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = Integer.parseInt(sc.next());\n\n int count = 0;\n for(int element : T){\n if(Arrays.binarySearch(S, element) >= 0) count++;\n }\n System.out.println(count);\n sc.close();\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"class Main {\n\n private static final int CONST= 1000000007;\n public static void main(String args[]) {\n\t\tjava.util.Scanner sc = new java.util.Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int[] S = new int[n];\n for(int i=0; i<n; i++) S[i] = Integer.parseInt(sc.next());\n\n int q = Integer.parseInt(sc.next());\n int[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = Integer.parseInt(sc.next());\n\n int count = 0;\n for(int element : T){\n if(Arrays.binarySearch(S, element) >= 0) count++;\n }\n System.out.println(count);\n sc.close();\n }\n}",
"Main",
"private static final int CONST= 1000000007;",
"CONST",
"1000000007",
"public static void main(String args[]) {\n\t\tjava.util.Scanner sc = new java.util.Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int[] S = new int[n];\n for(int i=0; i<n; i++) S[i] = Integer.parseInt(sc.next());\n\n int q = Integer.parseInt(sc.next());\n int[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = Integer.parseInt(sc.next());\n\n int count = 0;\n for(int element : T){\n if(Arrays.binarySearch(S, element) >= 0) count++;\n }\n System.out.println(count);\n sc.close();\n }",
"main",
"{\n\t\tjava.util.Scanner sc = new java.util.Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int[] S = new int[n];\n for(int i=0; i<n; i++) S[i] = Integer.parseInt(sc.next());\n\n int q = Integer.parseInt(sc.next());\n int[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = Integer.parseInt(sc.next());\n\n int count = 0;\n for(int element : T){\n if(Arrays.binarySearch(S, element) >= 0) count++;\n }\n System.out.println(count);\n sc.close();\n }",
"java.util.Scanner sc = new java.util.Scanner(System.in);",
"sc",
"new java.util.Scanner(System.in)",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0; i<n; i++) S[i] = Integer.parseInt(sc.next());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = Integer.parseInt(sc.next());",
"S[i] = Integer.parseInt(sc.next())",
"S[i]",
"S",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int q = Integer.parseInt(sc.next());",
"q",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i=0; i<q; i++) T[i] = Integer.parseInt(sc.next());",
"int i=0;",
"int 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 count = 0;",
"count",
"0",
"for(int element : T){\n if(Arrays.binarySearch(S, element) >= 0) count++;\n }",
"int element",
"T",
"{\n if(Arrays.binarySearch(S, element) >= 0) count++;\n }",
"{\n if(Arrays.binarySearch(S, element) >= 0) count++;\n }",
"if(Arrays.binarySearch(S, element) >= 0) count++;",
"Arrays.binarySearch(S, element) >= 0",
"Arrays.binarySearch(S, element)",
"Arrays.binarySearch",
"Arrays",
"S",
"element",
"0",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"sc.close()",
"sc.close",
"sc",
"String args[]",
"args"
] | import java.util.Arrays;
class Main {
private static final int CONST= 1000000007;
public static void main(String args[]) {
java.util.Scanner sc = new java.util.Scanner(System.in);
int n = Integer.parseInt(sc.next());
int[] S = new int[n];
for(int i=0; i<n; i++) S[i] = Integer.parseInt(sc.next());
int q = Integer.parseInt(sc.next());
int[] T = new int[q];
for(int i=0; i<q; i++) T[i] = Integer.parseInt(sc.next());
int count = 0;
for(int element : T){
if(Arrays.binarySearch(S, element) >= 0) count++;
}
System.out.println(count);
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
4,
18,
13,
4,
18,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
40,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
4,
18,
13,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
14,
2,
13,
17,
30,
4,
18,
13,
0,
13,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
136,
17
],
[
136,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
20,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
29,
34
],
[
20,
35
],
[
35,
36
],
[
35,
37
],
[
20,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
44,
45
],
[
44,
46
],
[
20,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
47,
57
],
[
57,
58
],
[
58,
59
],
[
47,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
62,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
80,
82
],
[
20,
83
],
[
83,
84
],
[
84,
85
],
[
20,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
88,
93
],
[
20,
94
],
[
94,
95
],
[
94,
96
],
[
20,
97
],
[
97,
98
],
[
97,
99
],
[
97,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
104,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
103,
112
],
[
102,
113
],
[
113,
114
],
[
114,
115
],
[
20,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
20,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
126,
130
],
[
130,
131
],
[
130,
132
],
[
18,
133
],
[
133,
134
],
[
0,
135
],
[
135,
136
],
[
135,
137
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tbr.readLine();\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\tS.add(Integer.parseInt(tmp[0]));\n\t\tfor (int i = 1; i < tmp.length; i++) {\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}\n\t\tbr.readLine();\n\t\tString[] T = br.readLine().split(\" \");\n\n\t\tint cnt = 0;\n\t\tfor (String s : T) {\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\n\t\tif (br != null) {\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.List;",
"List",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tbr.readLine();\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\tS.add(Integer.parseInt(tmp[0]));\n\t\tfor (int i = 1; i < tmp.length; i++) {\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}\n\t\tbr.readLine();\n\t\tString[] T = br.readLine().split(\" \");\n\n\t\tint cnt = 0;\n\t\tfor (String s : T) {\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\n\t\tif (br != null) {\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tbr.readLine();\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\tS.add(Integer.parseInt(tmp[0]));\n\t\tfor (int i = 1; i < tmp.length; i++) {\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}\n\t\tbr.readLine();\n\t\tString[] T = br.readLine().split(\" \");\n\n\t\tint cnt = 0;\n\t\tfor (String s : T) {\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\n\t\tif (br != null) {\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tbr.readLine();\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\tS.add(Integer.parseInt(tmp[0]));\n\t\tfor (int i = 1; i < tmp.length; i++) {\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}\n\t\tbr.readLine();\n\t\tString[] T = br.readLine().split(\" \");\n\n\t\tint cnt = 0;\n\t\tfor (String s : T) {\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\n\t\tif (br != null) {\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"br.readLine()",
"br.readLine",
"br",
"String[] tmp = br.readLine().split(\" \");",
"tmp",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"List<Integer> S = new ArrayList<Integer>();",
"S",
"new ArrayList<Integer>()",
"S.add(Integer.parseInt(tmp[0]))",
"S.add",
"S",
"Integer.parseInt(tmp[0])",
"Integer.parseInt",
"Integer",
"tmp[0]",
"tmp",
"0",
"for (int i = 1; i < tmp.length; i++) {\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < tmp.length",
"i",
"tmp.length",
"tmp",
"tmp.length",
"i++",
"i++",
"i",
"{\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}",
"{\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}",
"if (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));",
"!tmp[i].equals(tmp[i - 1])",
"tmp[i].equals(tmp[i - 1])",
"tmp[i].equals",
"tmp[i]",
"tmp",
"i",
"tmp[i - 1]",
"tmp",
"i - 1",
"i",
"1",
"S.add(Integer.parseInt(tmp[i]))",
"S.add",
"S",
"Integer.parseInt(tmp[i])",
"Integer.parseInt",
"Integer",
"tmp[i]",
"tmp",
"i",
"br.readLine()",
"br.readLine",
"br",
"String[] T = br.readLine().split(\" \");",
"T",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int cnt = 0;",
"cnt",
"0",
"for (String s : T) {\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"String s",
"T",
"{\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}",
"Collections.binarySearch(S, Integer.parseInt(s)) >= 0",
"Collections.binarySearch(S, Integer.parseInt(s))",
"Collections.binarySearch",
"Collections",
"S",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"0",
"{\n\t\t\t\tcnt++;\n\t\t\t}",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"if (br != null) {\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}",
"br != null",
"br",
"null",
"{\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}",
"br.close()",
"br.close",
"br",
"br = null",
"br",
"null",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tbr.readLine();\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\tS.add(Integer.parseInt(tmp[0]));\n\t\tfor (int i = 1; i < tmp.length; i++) {\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}\n\t\tbr.readLine();\n\t\tString[] T = br.readLine().split(\" \");\n\n\t\tint cnt = 0;\n\t\tfor (String s : T) {\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\n\t\tif (br != null) {\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tbr.readLine();\n\t\tString[] tmp = br.readLine().split(\" \");\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\tS.add(Integer.parseInt(tmp[0]));\n\t\tfor (int i = 1; i < tmp.length; i++) {\n\t\t\tif (!tmp[i].equals(tmp[i - 1]))\n\t\t\t\tS.add(Integer.parseInt(tmp[i]));\n\t\t}\n\t\tbr.readLine();\n\t\tString[] T = br.readLine().split(\" \");\n\n\t\tint cnt = 0;\n\t\tfor (String s : T) {\n\t\t\tif (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\n\t\tif (br != null) {\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t}\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.readLine();
String[] tmp = br.readLine().split(" ");
List<Integer> S = new ArrayList<Integer>();
S.add(Integer.parseInt(tmp[0]));
for (int i = 1; i < tmp.length; i++) {
if (!tmp[i].equals(tmp[i - 1]))
S.add(Integer.parseInt(tmp[i]));
}
br.readLine();
String[] T = br.readLine().split(" ");
int cnt = 0;
for (String s : T) {
if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
cnt++;
}
}
System.out.println(cnt);
if (br != null) {
br.close();
br = null;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
0,
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,
0,
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,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
17,
2,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
29,
17,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
4,
13,
13,
13,
2,
13,
17,
13,
14,
2,
18,
13,
13,
13,
29,
4,
13,
13,
13,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
18,
21
],
[
21,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
26,
31
],
[
8,
32
],
[
32,
33
],
[
32,
34
],
[
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
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
8,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
69,
74
],
[
8,
75
],
[
75,
76
],
[
75,
77
],
[
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
],
[
96,
99
],
[
99,
100
],
[
99,
101
],
[
8,
102
],
[
102,
103
],
[
102,
104
],
[
8,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
105,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
119,
122
],
[
122,
123
],
[
122,
124
],
[
119,
125
],
[
119,
126
],
[
126,
127
],
[
126,
128
],
[
118,
129
],
[
129,
130
],
[
8,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
6,
137
],
[
137,
138
],
[
4,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
141,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
141,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
155,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
162,
165
],
[
162,
166
],
[
166,
167
],
[
166,
168
],
[
162,
169
],
[
155,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
170,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
177,
180
],
[
177,
181
],
[
177,
182
],
[
182,
183
],
[
182,
184
],
[
170,
185
],
[
185,
186
],
[
139,
187
],
[
187,
188
],
[
139,
189
],
[
189,
190
],
[
139,
191
],
[
191,
192
],
[
139,
193
],
[
193,
194
]
] | [
"import java.io.*;\n\nclass Main {\n public static void main (String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n String[] input;\n int i;\n\n int n = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] s = new int[n];\n for (i = 0; i < n; i++) {\n s[i] = Integer.parseInt(input[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] t = new int[q];\n for (i = 0; i < q; i++) {\n t[i] = Integer.parseInt(input[i]);\n }\n\n int count = 0;\n for (i = 0; i < q; i++) {\n if (binarySearch(s, t[i], 0, n - 1)) count++;\n }\n\n System.out.println(count);\n }\n\n public static boolean binarySearch(int[] arr, int target, int left, int right) {\n if (left > right) return false;\n\n int m = (left + right) / 2;\n if (arr[m] < target) return binarySearch(arr, target, m + 1, right);\n else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);\n else return true;\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main {\n public static void main (String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n String[] input;\n int i;\n\n int n = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] s = new int[n];\n for (i = 0; i < n; i++) {\n s[i] = Integer.parseInt(input[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] t = new int[q];\n for (i = 0; i < q; i++) {\n t[i] = Integer.parseInt(input[i]);\n }\n\n int count = 0;\n for (i = 0; i < q; i++) {\n if (binarySearch(s, t[i], 0, n - 1)) count++;\n }\n\n System.out.println(count);\n }\n\n public static boolean binarySearch(int[] arr, int target, int left, int right) {\n if (left > right) return false;\n\n int m = (left + right) / 2;\n if (arr[m] < target) return binarySearch(arr, target, m + 1, right);\n else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);\n else return true;\n }\n}",
"Main",
"public static void main (String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n String[] input;\n int i;\n\n int n = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] s = new int[n];\n for (i = 0; i < n; i++) {\n s[i] = Integer.parseInt(input[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] t = new int[q];\n for (i = 0; i < q; i++) {\n t[i] = Integer.parseInt(input[i]);\n }\n\n int count = 0;\n for (i = 0; i < q; i++) {\n if (binarySearch(s, t[i], 0, n - 1)) count++;\n }\n\n System.out.println(count);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n String[] input;\n int i;\n\n int n = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] s = new int[n];\n for (i = 0; i < n; i++) {\n s[i] = Integer.parseInt(input[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n input = br.readLine().split(\" \");\n int[] t = new int[q];\n for (i = 0; i < q; i++) {\n t[i] = Integer.parseInt(input[i]);\n }\n\n int count = 0;\n for (i = 0; i < q; i++) {\n if (binarySearch(s, t[i], 0, n - 1)) count++;\n }\n\n System.out.println(count);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String[] input;",
"input",
"int i;",
"i",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"input = br.readLine().split(\" \")",
"input",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (i = 0; i < n; i++) {\n s[i] = Integer.parseInt(input[i]);\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(input[i]);\n }",
"{\n s[i] = Integer.parseInt(input[i]);\n }",
"s[i] = Integer.parseInt(input[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"input = br.readLine().split(\" \")",
"input",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (i = 0; i < q; i++) {\n t[i] = Integer.parseInt(input[i]);\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = Integer.parseInt(input[i]);\n }",
"{\n t[i] = Integer.parseInt(input[i]);\n }",
"t[i] = Integer.parseInt(input[i])",
"t[i]",
"t",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"int count = 0;",
"count",
"0",
"for (i = 0; i < q; i++) {\n if (binarySearch(s, t[i], 0, n - 1)) count++;\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (binarySearch(s, t[i], 0, n - 1)) count++;\n }",
"{\n if (binarySearch(s, t[i], 0, n - 1)) count++;\n }",
"if (binarySearch(s, t[i], 0, n - 1)) count++;",
"binarySearch(s, t[i], 0, n - 1)",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"0",
"n - 1",
"n",
"1",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static boolean binarySearch(int[] arr, int target, int left, int right) {\n if (left > right) return false;\n\n int m = (left + right) / 2;\n if (arr[m] < target) return binarySearch(arr, target, m + 1, right);\n else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);\n else return true;\n }",
"binarySearch",
"{\n if (left > right) return false;\n\n int m = (left + right) / 2;\n if (arr[m] < target) return binarySearch(arr, target, m + 1, right);\n else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);\n else return true;\n }",
"if (left > right) return false;",
"left > right",
"left",
"right",
"return false;",
"false",
"int m = (left + right) / 2;",
"m",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (arr[m] < target) return binarySearch(arr, target, m + 1, right);\n else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);\n else return true;",
"arr[m] < target",
"arr[m]",
"arr",
"m",
"target",
"return binarySearch(arr, target, m + 1, right);",
"binarySearch(arr, target, m + 1, right)",
"binarySearch",
"arr",
"target",
"m + 1",
"m",
"1",
"right",
"if (arr[m] > target) return binarySearch(arr, target, left, m - 1);\n else return true;",
"arr[m] > target",
"arr[m]",
"arr",
"m",
"target",
"return binarySearch(arr, target, left, m - 1);",
"binarySearch(arr, target, left, m - 1)",
"binarySearch",
"arr",
"target",
"left",
"m - 1",
"m",
"1",
"return true;",
"true",
"int[] arr",
"arr",
"int target",
"target",
"int left",
"left",
"int right",
"right"
] | import java.io.*;
class Main {
public static void main (String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] input;
int i;
int n = Integer.parseInt(br.readLine());
input = br.readLine().split(" ");
int[] s = new int[n];
for (i = 0; i < n; i++) {
s[i] = Integer.parseInt(input[i]);
}
int q = Integer.parseInt(br.readLine());
input = br.readLine().split(" ");
int[] t = new int[q];
for (i = 0; i < q; i++) {
t[i] = Integer.parseInt(input[i]);
}
int count = 0;
for (i = 0; i < q; i++) {
if (binarySearch(s, t[i], 0, n - 1)) count++;
}
System.out.println(count);
}
public static boolean binarySearch(int[] arr, int target, int left, int right) {
if (left > right) return false;
int m = (left + right) / 2;
if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
else return true;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
41,
13,
4,
18,
13,
13,
13,
14,
2,
2,
2,
17,
13,
2,
13,
13,
2,
18,
13,
13,
13,
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
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
353,
23
],
[
353,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
26,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
44,
45
],
[
44,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
39,
50
],
[
51,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
26,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
26,
64
],
[
64,
65
],
[
64,
66
],
[
26,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
26,
88
],
[
88,
89
],
[
88,
90
],
[
26,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
91,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
111,
115
],
[
103,
116
],
[
116,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
116,
130
],
[
130,
131
],
[
131,
132
],
[
26,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
24,
139
],
[
139,
140
],
[
353,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
141,
149
],
[
149,
150
],
[
141,
151
],
[
151,
152
],
[
141,
153
],
[
153,
154
],
[
141,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
155,
163
],
[
163,
164
],
[
141,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
168,
173
],
[
173,
174
],
[
167,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
183,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
179,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
196,
200
],
[
200,
201
],
[
201,
202
],
[
167,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
141,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
210,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
215,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
210,
224
],
[
224,
225
],
[
224,
226
],
[
210,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
227,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
233,
236
],
[
232,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
210,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
141,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
247,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
256
],
[
256,
257
],
[
256,
258
],
[
258,
259
],
[
247,
260
],
[
260,
261
],
[
260,
262
],
[
247,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
263,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
270,
271
],
[
267,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
247,
276
],
[
276,
277
],
[
276,
278
],
[
247,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
281,
283
],
[
279,
284
],
[
284,
285
],
[
285,
286
],
[
286,
287
],
[
287,
288
],
[
287,
289
],
[
286,
290
],
[
290,
291
],
[
290,
292
],
[
285,
293
],
[
293,
294
],
[
284,
295
],
[
295,
296
],
[
295,
297
],
[
284,
298
],
[
298,
299
],
[
298,
300
],
[
300,
301
],
[
300,
302
],
[
284,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
247,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
141,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
314,
318
],
[
318,
319
],
[
319,
320
],
[
320,
321
],
[
319,
322
],
[
313,
323
],
[
323,
324
],
[
327,
325
],
[
337,
326
],
[
334,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
327,
331
],
[
331,
332
],
[
331,
333
],
[
334,
334
],
[
334,
335
],
[
334,
336
],
[
337,
337
],
[
337,
338
],
[
337,
339
],
[
327,
340
],
[
340,
341
],
[
340,
342
],
[
342,
343
],
[
311,
344
],
[
344,
345
],
[
141,
346
],
[
346,
347
],
[
346,
348
],
[
348,
349
],
[
348,
350
],
[
350,
351
],
[
0,
352
],
[
352,
353
],
[
352,
354
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.LinkedList;\nimport java.util.PriorityQueue;\n\n \npublic class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.LinkedList;",
"LinkedList",
"java.util",
"import java.util.PriorityQueue;",
"PriorityQueue",
"java.util",
"public class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }\n System.out.println(ans);\n }",
"InputReader sc = new InputReader(System.in);",
"sc",
"new InputReader(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ss = new int[n];",
"ss",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ss[i] = sc.nextInt();\n }",
"{\n ss[i] = sc.nextInt();\n }",
"ss[i] = sc.nextInt()",
"ss[i]",
"ss",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ts = new int[m];",
"ts",
"new int[m]",
"m",
"for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n ts[i] = sc.nextInt();\n }",
"{\n ts[i] = sc.nextInt();\n }",
"ts[i] = sc.nextInt()",
"ts[i]",
"ts",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"for(int i = 0; i < m; i++){\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }",
"{\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }",
"int target = ts[i];",
"target",
"ts[i]",
"ts",
"i",
"int res = Arrays.binarySearch(ss, target);",
"res",
"Arrays.binarySearch(ss, target)",
"Arrays.binarySearch",
"Arrays",
"ss",
"target",
"if(0 <= res && res < n && ss[res] == target){\n ans++;\n }",
"0 <= res && res < n && ss[res] == target",
"0 <= res && res < n && ss[res] == target",
"0 <= res",
"0",
"res",
"res < n",
"res",
"n",
"ss[res] == target",
"ss[res]",
"ss",
"res",
"target",
"{\n ans++;\n }",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
" static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"next",
"{\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"if (numChars == -1)\n throw new InputMismatchException();",
"numChars == -1",
"numChars",
"-1",
"1",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0)\n return -1;",
"numChars <= 0",
"numChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }",
"nextStr",
"{\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }",
"int c = next();",
"c",
"next()",
"next",
"while(isSpaceChar(c)){c = next();}",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{c = next();}",
"c = next()",
"c",
"next()",
"next",
"StringBuffer str = new StringBuffer();",
"str",
"new StringBuffer()",
"do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n str.append((char)c);\n c = next();\n }",
"str.append((char)c)",
"str.append",
"str",
"(char)c",
"c = next()",
"c",
"next()",
"next",
"return str.toString();",
"str.toString()",
"str.toString",
"str",
"public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = next();",
"c",
"next()",
"next",
"while (isSpaceChar(c))\n c = next();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = next()",
"c",
"next()",
"next",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = next();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = next();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = next()",
"c",
"next()",
"next",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n }",
"if (c < '0' || c > '9')\n throw new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = next()",
"c",
"next()",
"next",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isSpaceChar",
"{\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"if (filter != null)\n return filter.isSpaceChar(c);",
"filter != null",
"filter",
"null",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int res = Arrays.binarySearch(ss, target);\n if(0 <= res && res < n && ss[res] == target){\n ans++;\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
public class Main {
public static void main(String[] args) {
InputReader sc = new InputReader(System.in);
int n = sc.nextInt();
int[] ss = new int[n];
for(int i = 0; i < n; i++){
ss[i] = sc.nextInt();
}
int m = sc.nextInt();
int[] ts = new int[m];
for(int i = 0; i < m; i++){
ts[i] = sc.nextInt();
}
int ans = 0;
for(int i = 0; i < m; i++){
int target = ts[i];
int res = Arrays.binarySearch(ss, target);
if(0 <= res && res < n && ss[res] == target){
ans++;
}
}
System.out.println(ans);
}
// LinkedList<Integer>[] setsu = new LinkedList[n];
// for(int i = 0; i < n; i++){
// setsu[i] = new LinkedList<Integer>();
// }
//ここからテンプレ
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int next() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public String nextStr() {
int c = next();
while(isSpaceChar(c)){c = next();}
StringBuffer str = new StringBuffer();
do{
str.append((char)c);
c = next();
}while(!isSpaceChar(c));
return str.toString();
}
public int nextInt() {
int c = next();
while (isSpaceChar(c))
c = next();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = next();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = next();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
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,
41,
13,
17,
41,
13,
41,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
0,
13,
2,
13,
17,
0,
13,
17,
42,
17,
30,
14,
2,
13,
13,
30,
3,
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
],
[
192,
5
],
[
192,
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,
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
],
[
69,
72
],
[
72,
73
],
[
72,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
95,
97
],
[
8,
98
],
[
98,
99
],
[
98,
100
],
[
8,
101
],
[
101,
102
],
[
8,
103
],
[
103,
104
],
[
8,
105
],
[
105,
106
],
[
8,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
119,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
119,
130
],
[
130,
131
],
[
130,
132
],
[
119,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
135,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
135,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
149,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
149,
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
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
171,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
180,
182
],
[
8,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
183,
188
],
[
6,
189
],
[
189,
190
],
[
0,
191
],
[
191,
192
],
[
191,
193
]
] | [
"import java.util.Scanner;\npublic class Main {\n public static void main (String[] args) {\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] inputS = scan.nextLine().split(\" \");\n\tint q = Integer.parseInt(scan.nextLine());\n\tString[] inputT = scan.nextLine().split(\" \");\n\tint[] s = new int[n];\n\tint[] t = new int[q];\n\tfor (int i = 0; i < n; i++) {\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}\n\tfor (int i = 0; i < q; i++) {\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}\n\n\tint cnt = 0;\n\tint high, low, j;\n\tfor (int i = 0; i < q; i++) {\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}\n\tSystem.out.println(cnt);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main (String[] args) {\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] inputS = scan.nextLine().split(\" \");\n\tint q = Integer.parseInt(scan.nextLine());\n\tString[] inputT = scan.nextLine().split(\" \");\n\tint[] s = new int[n];\n\tint[] t = new int[q];\n\tfor (int i = 0; i < n; i++) {\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}\n\tfor (int i = 0; i < q; i++) {\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}\n\n\tint cnt = 0;\n\tint high, low, j;\n\tfor (int i = 0; i < q; i++) {\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}\n\tSystem.out.println(cnt);\n }\n}",
"Main",
"public static void main (String[] args) {\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] inputS = scan.nextLine().split(\" \");\n\tint q = Integer.parseInt(scan.nextLine());\n\tString[] inputT = scan.nextLine().split(\" \");\n\tint[] s = new int[n];\n\tint[] t = new int[q];\n\tfor (int i = 0; i < n; i++) {\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}\n\tfor (int i = 0; i < q; i++) {\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}\n\n\tint cnt = 0;\n\tint high, low, j;\n\tfor (int i = 0; i < q; i++) {\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}\n\tSystem.out.println(cnt);\n }",
"main",
"{\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] inputS = scan.nextLine().split(\" \");\n\tint q = Integer.parseInt(scan.nextLine());\n\tString[] inputT = scan.nextLine().split(\" \");\n\tint[] s = new int[n];\n\tint[] t = new int[q];\n\tfor (int i = 0; i < n; i++) {\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}\n\tfor (int i = 0; i < q; i++) {\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}\n\n\tint cnt = 0;\n\tint high, low, j;\n\tfor (int i = 0; i < q; i++) {\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}\n\tSystem.out.println(cnt);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = Integer.parseInt(scan.nextLine());",
"n",
"Integer.parseInt(scan.nextLine())",
"Integer.parseInt",
"Integer",
"scan.nextLine()",
"scan.nextLine",
"scan",
"String[] inputS = scan.nextLine().split(\" \");",
"inputS",
"scan.nextLine().split(\" \")",
"scan.nextLine().split",
"scan.nextLine()",
"scan.nextLine",
"scan",
"\" \"",
"int q = Integer.parseInt(scan.nextLine());",
"q",
"Integer.parseInt(scan.nextLine())",
"Integer.parseInt",
"Integer",
"scan.nextLine()",
"scan.nextLine",
"scan",
"String[] inputT = scan.nextLine().split(\" \");",
"inputT",
"scan.nextLine().split(\" \")",
"scan.nextLine().split",
"scan.nextLine()",
"scan.nextLine",
"scan",
"\" \"",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < n; i++) {\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}",
"{\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}",
"s[i] = Integer.parseInt(inputS[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(inputS[i])",
"Integer.parseInt",
"Integer",
"inputS[i]",
"inputS",
"i",
"for (int i = 0; i < q; i++) {\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}",
"{\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}",
"t[i] = Integer.parseInt(inputT[i])",
"t[i]",
"t",
"i",
"Integer.parseInt(inputT[i])",
"Integer.parseInt",
"Integer",
"inputT[i]",
"inputT",
"i",
"int cnt = 0;",
"cnt",
"0",
"int high",
"high",
"low",
"low",
"j;",
"j",
"for (int i = 0; i < q; i++) {\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}",
"{\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}",
"int key = t[i];",
"key",
"t[i]",
"t",
"i",
"high = n - 1",
"high",
"n - 1",
"n",
"1",
"low = 0",
"low",
"0",
"while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }",
"true",
"{\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }",
"if (high < low) {\n\t\t break;\n\t\t}",
"high < low",
"high",
"low",
"{\n\t\t break;\n\t\t}",
"break;",
"j = (high + low) / 2",
"j",
"(high + low) / 2",
"(high + low)",
"high",
"low",
"2",
"if (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}",
"s[j] == key",
"s[j]",
"s",
"j",
"key",
"{\n\t\t cnt++;\n\t\t break;\n\t\t}",
"cnt++",
"cnt",
"break;",
"if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}",
"s[j] < key",
"s[j]",
"s",
"j",
"key",
"{\n\t\t low = j + 1;\n\t\t}",
"low = j + 1",
"low",
"j + 1",
"j",
"1",
"if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}",
"s[j] > key",
"s[j]",
"s",
"j",
"key",
"{\n\t\t high = j - 1;\n\t\t}",
"high = j - 1",
"high",
"j - 1",
"j",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n public static void main (String[] args) {\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] inputS = scan.nextLine().split(\" \");\n\tint q = Integer.parseInt(scan.nextLine());\n\tString[] inputT = scan.nextLine().split(\" \");\n\tint[] s = new int[n];\n\tint[] t = new int[q];\n\tfor (int i = 0; i < n; i++) {\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}\n\tfor (int i = 0; i < q; i++) {\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}\n\n\tint cnt = 0;\n\tint high, low, j;\n\tfor (int i = 0; i < q; i++) {\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}\n\tSystem.out.println(cnt);\n }\n}",
"public class Main {\n public static void main (String[] args) {\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] inputS = scan.nextLine().split(\" \");\n\tint q = Integer.parseInt(scan.nextLine());\n\tString[] inputT = scan.nextLine().split(\" \");\n\tint[] s = new int[n];\n\tint[] t = new int[q];\n\tfor (int i = 0; i < n; i++) {\n\t s[i] = Integer.parseInt(inputS[i]);\n\t}\n\tfor (int i = 0; i < q; i++) {\n\t t[i] = Integer.parseInt(inputT[i]);\n\t}\n\n\tint cnt = 0;\n\tint high, low, j;\n\tfor (int i = 0; i < q; i++) {\n\t int key = t[i];\n\t high = n - 1;\n\t low = 0;\n\t while (true) {\n\t\tif (high < low) {\n\t\t break;\n\t\t}\n\t\tj = (high + low) / 2;\n\t\tif (s[j] == key) {\n\t\t cnt++;\n\t\t break;\n\t\t} else if (s[j] < key) {\n\t\t low = j + 1;\n\t\t} else if (s[j] > key) {\n\t\t high = j - 1;\n\t\t}\n\t }\n\t}\n\tSystem.out.println(cnt);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main (String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.nextLine());
String[] inputS = scan.nextLine().split(" ");
int q = Integer.parseInt(scan.nextLine());
String[] inputT = scan.nextLine().split(" ");
int[] s = new int[n];
int[] t = new int[q];
for (int i = 0; i < n; i++) {
s[i] = Integer.parseInt(inputS[i]);
}
for (int i = 0; i < q; i++) {
t[i] = Integer.parseInt(inputT[i]);
}
int cnt = 0;
int high, low, j;
for (int i = 0; i < q; i++) {
int key = t[i];
high = n - 1;
low = 0;
while (true) {
if (high < low) {
break;
}
j = (high + low) / 2;
if (s[j] == key) {
cnt++;
break;
} else if (s[j] < key) {
low = j + 1;
} else if (s[j] > key) {
high = j - 1;
}
}
}
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
12,
13,
30,
14,
2,
13,
2,
13,
17,
30,
29,
2,
18,
13,
13,
13,
41,
13,
2,
2,
2,
13,
13,
17,
13,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
29,
17,
14,
2,
13,
13,
30,
29,
4,
13,
13,
13,
13,
13,
14,
2,
13,
13,
30,
29,
4,
13,
13,
13,
13,
13,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
17,
13,
18,
13,
13,
30,
40,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
4,
18,
20,
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,
18,
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
],
[
17,
19
],
[
204,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
22,
24
],
[
204,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
31,
33
],
[
28,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
27,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
43,
49
],
[
27,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
27,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
60
],
[
60,
61
],
[
55,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
68,
71
],
[
68,
72
],
[
68,
73
],
[
62,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
80,
83
],
[
80,
84
],
[
80,
85
],
[
27,
86
],
[
86,
87
],
[
25,
88
],
[
88,
89
],
[
25,
90
],
[
90,
91
],
[
25,
92
],
[
92,
93
],
[
25,
94
],
[
94,
95
],
[
204,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
98,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
109,
112
],
[
98,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
98,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
120,
123
],
[
98,
124
],
[
124,
125
],
[
125,
126
],
[
98,
127
],
[
127,
128
],
[
127,
129
],
[
98,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
135,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
130,
141
],
[
142,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
144,
147
],
[
144,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
143,
152
],
[
152,
153
],
[
153,
154
],
[
98,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
96,
159
],
[
159,
160
],
[
204,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
161,
168
],
[
168,
169
],
[
204,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
177,
182
],
[
182,
183
],
[
182,
184
],
[
177,
185
],
[
185,
186
],
[
186,
187
],
[
177,
188
],
[
189,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
194,
195
],
[
195,
196
],
[
172,
197
],
[
197,
198
],
[
170,
199
],
[
199,
200
],
[
170,
201
],
[
201,
202
],
[
0,
203
],
[
203,
204
],
[
203,
205
]
] | [
"import java.io.InputStream;\nimport java.io.PrintStream;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tInputStream in = System.in;\n\tPrintStream out = System.out;\n\n\tprivate static boolean binarySearch(int[] a, int st, int ed, int k) {\n\t\tif (st == ed - 1) {\n\t\t\treturn a[st] == k;\n\t\t}\n\n\t\tint idx = (ed - st) / 2 + st;\n\t\tint m = a[idx];\n\n\t\tif (m == k) {\n\t\t\treturn true;\n\t\t} else if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}\n\n\t\treturn false; // 到達しない\n\n\t}\n\n\tpublic void _main(String[] args) {\n\t\tScanner sc = new Scanner(in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] S = nextIntArray(sc, n);\n\n\t\tint q = sc.nextInt();\n\t\tint[] T = nextIntArray(sc, q);\n\n\t\tsc.close();\n\n\t\tint ans = 0;\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main()._main(args);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate int[] nextIntArray(Scanner sc, int n) {\n\t\tint[] result = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tresult[i] = sc.nextInt();\n\t\t}\n\t\treturn result;\n\t}\n}\n",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintStream;",
"PrintStream",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tInputStream in = System.in;\n\tPrintStream out = System.out;\n\n\tprivate static boolean binarySearch(int[] a, int st, int ed, int k) {\n\t\tif (st == ed - 1) {\n\t\t\treturn a[st] == k;\n\t\t}\n\n\t\tint idx = (ed - st) / 2 + st;\n\t\tint m = a[idx];\n\n\t\tif (m == k) {\n\t\t\treturn true;\n\t\t} else if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}\n\n\t\treturn false; // 到達しない\n\n\t}\n\n\tpublic void _main(String[] args) {\n\t\tScanner sc = new Scanner(in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] S = nextIntArray(sc, n);\n\n\t\tint q = sc.nextInt();\n\t\tint[] T = nextIntArray(sc, q);\n\n\t\tsc.close();\n\n\t\tint ans = 0;\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main()._main(args);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate int[] nextIntArray(Scanner sc, int n) {\n\t\tint[] result = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tresult[i] = sc.nextInt();\n\t\t}\n\t\treturn result;\n\t}\n}",
"Main",
"InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"PrintStream out = System.out;",
"out",
"System.out",
"System",
"System.out",
"private static boolean binarySearch(int[] a, int st, int ed, int k) {\n\t\tif (st == ed - 1) {\n\t\t\treturn a[st] == k;\n\t\t}\n\n\t\tint idx = (ed - st) / 2 + st;\n\t\tint m = a[idx];\n\n\t\tif (m == k) {\n\t\t\treturn true;\n\t\t} else if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}\n\n\t\treturn false; // 到達しない\n\n\t}",
"binarySearch",
"{\n\t\tif (st == ed - 1) {\n\t\t\treturn a[st] == k;\n\t\t}\n\n\t\tint idx = (ed - st) / 2 + st;\n\t\tint m = a[idx];\n\n\t\tif (m == k) {\n\t\t\treturn true;\n\t\t} else if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}\n\n\t\treturn false; // 到達しない\n\n\t}",
"if (st == ed - 1) {\n\t\t\treturn a[st] == k;\n\t\t}",
"st == ed - 1",
"st",
"ed - 1",
"ed",
"1",
"{\n\t\t\treturn a[st] == k;\n\t\t}",
"return a[st] == k;",
"a[st] == k",
"a[st]",
"a",
"st",
"k",
"int idx = (ed - st) / 2 + st;",
"idx",
"(ed - st) / 2 + st",
"(ed - st) / 2",
"(ed - st)",
"ed",
"st",
"2",
"st",
"int m = a[idx];",
"m",
"a[idx]",
"a",
"idx",
"if (m == k) {\n\t\t\treturn true;\n\t\t} else if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}",
"m == k",
"m",
"k",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}",
"m > k",
"m",
"k",
"{\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t}",
"return binarySearch(a, st, idx, k);",
"binarySearch(a, st, idx, k)",
"binarySearch",
"a",
"st",
"idx",
"k",
"if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}",
"m < k",
"m",
"k",
"{\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}",
"return binarySearch(a, idx, ed, k);",
"binarySearch(a, idx, ed, k)",
"binarySearch",
"a",
"idx",
"ed",
"k",
"return false; // 到達しない",
"false",
"int[] a",
"a",
"int st",
"st",
"int ed",
"ed",
"int k",
"k",
"public void _main(String[] args) {\n\t\tScanner sc = new Scanner(in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] S = nextIntArray(sc, n);\n\n\t\tint q = sc.nextInt();\n\t\tint[] T = nextIntArray(sc, q);\n\n\t\tsc.close();\n\n\t\tint ans = 0;\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\n\t}",
"_main",
"{\n\t\tScanner sc = new Scanner(in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] S = nextIntArray(sc, n);\n\n\t\tint q = sc.nextInt();\n\t\tint[] T = nextIntArray(sc, q);\n\n\t\tsc.close();\n\n\t\tint ans = 0;\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\n\t}",
"Scanner sc = new Scanner(in);",
"sc",
"new Scanner(in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = nextIntArray(sc, n);",
"S",
"nextIntArray(sc, n)",
"nextIntArray",
"sc",
"n",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = nextIntArray(sc, q);",
"T",
"nextIntArray(sc, q)",
"nextIntArray",
"sc",
"q",
"sc.close()",
"sc.close",
"sc",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"if (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}",
"binarySearch(S, 0, n, T[i])",
"binarySearch",
"S",
"0",
"n",
"T[i]",
"T",
"i",
"{\n\t\t\t\tans++;\n\t\t\t}",
"ans++",
"ans",
"out.println(ans)",
"out.println",
"out",
"ans",
"String[] args",
"args",
"public static void main(String[] args) {\n\t\tnew Main()._main(args);\n\t}",
"main",
"{\n\t\tnew Main()._main(args);\n\t}",
"new Main()._main(args)",
"new Main()._main",
"new Main()",
"args",
"String[] args",
"args",
"@SuppressWarnings(\"unused\")\n\tprivate int[] nextIntArray(Scanner sc, int n) {\n\t\tint[] result = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tresult[i] = sc.nextInt();\n\t\t}\n\t\treturn result;\n\t}",
"nextIntArray",
"{\n\t\tint[] result = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tresult[i] = sc.nextInt();\n\t\t}\n\t\treturn result;\n\t}",
"int[] result = new int[n];",
"result",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tresult[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tresult[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tresult[i] = sc.nextInt();\n\t\t}",
"result[i] = sc.nextInt()",
"result[i]",
"result",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"return result;",
"result",
"Scanner sc",
"sc",
"int n",
"n",
"public class Main {\n\tInputStream in = System.in;\n\tPrintStream out = System.out;\n\n\tprivate static boolean binarySearch(int[] a, int st, int ed, int k) {\n\t\tif (st == ed - 1) {\n\t\t\treturn a[st] == k;\n\t\t}\n\n\t\tint idx = (ed - st) / 2 + st;\n\t\tint m = a[idx];\n\n\t\tif (m == k) {\n\t\t\treturn true;\n\t\t} else if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}\n\n\t\treturn false; // 到達しない\n\n\t}\n\n\tpublic void _main(String[] args) {\n\t\tScanner sc = new Scanner(in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] S = nextIntArray(sc, n);\n\n\t\tint q = sc.nextInt();\n\t\tint[] T = nextIntArray(sc, q);\n\n\t\tsc.close();\n\n\t\tint ans = 0;\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main()._main(args);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate int[] nextIntArray(Scanner sc, int n) {\n\t\tint[] result = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tresult[i] = sc.nextInt();\n\t\t}\n\t\treturn result;\n\t}\n}",
"public class Main {\n\tInputStream in = System.in;\n\tPrintStream out = System.out;\n\n\tprivate static boolean binarySearch(int[] a, int st, int ed, int k) {\n\t\tif (st == ed - 1) {\n\t\t\treturn a[st] == k;\n\t\t}\n\n\t\tint idx = (ed - st) / 2 + st;\n\t\tint m = a[idx];\n\n\t\tif (m == k) {\n\t\t\treturn true;\n\t\t} else if (m > k) {\n\t\t\treturn binarySearch(a, st, idx, k);\n\t\t} else if (m < k) {\n\t\t\treturn binarySearch(a, idx, ed, k);\n\t\t}\n\n\t\treturn false; // 到達しない\n\n\t}\n\n\tpublic void _main(String[] args) {\n\t\tScanner sc = new Scanner(in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] S = nextIntArray(sc, n);\n\n\t\tint q = sc.nextInt();\n\t\tint[] T = nextIntArray(sc, q);\n\n\t\tsc.close();\n\n\t\tint ans = 0;\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, 0, n, T[i])) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main()._main(args);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate int[] nextIntArray(Scanner sc, int n) {\n\t\tint[] result = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tresult[i] = sc.nextInt();\n\t\t}\n\t\treturn result;\n\t}\n}",
"Main"
] | import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
InputStream in = System.in;
PrintStream out = System.out;
private static boolean binarySearch(int[] a, int st, int ed, int k) {
if (st == ed - 1) {
return a[st] == k;
}
int idx = (ed - st) / 2 + st;
int m = a[idx];
if (m == k) {
return true;
} else if (m > k) {
return binarySearch(a, st, idx, k);
} else if (m < k) {
return binarySearch(a, idx, ed, k);
}
return false; // 到達しない
}
public void _main(String[] args) {
Scanner sc = new Scanner(in);
int n = sc.nextInt();
int[] S = nextIntArray(sc, n);
int q = sc.nextInt();
int[] T = nextIntArray(sc, q);
sc.close();
int ans = 0;
for (int i = 0; i < q; i++) {
if (binarySearch(S, 0, n, T[i])) {
ans++;
}
}
out.println(ans);
}
public static void main(String[] args) {
new Main()._main(args);
}
@SuppressWarnings("unused")
private int[] nextIntArray(Scanner sc, int n) {
int[] result = new int[n];
for (int i = 0; i < n; i++) {
result[i] = sc.nextInt();
}
return result;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
14,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
30,
29,
17,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
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,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
4,
18,
13,
13,
17,
2,
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
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
19,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
20,
26
],
[
26,
27
],
[
27,
28
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
14,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
36,
42
],
[
42,
43
],
[
43,
44
],
[
36,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
45,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
53,
56
],
[
53,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
45,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
69,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
69,
76
],
[
14,
77
],
[
77,
78
],
[
12,
79
],
[
79,
80
],
[
12,
81
],
[
81,
82
],
[
12,
83
],
[
83,
84
],
[
12,
85
],
[
85,
86
],
[
10,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
102,
103
],
[
89,
104
],
[
104,
105
],
[
104,
106
],
[
89,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
110,
115
],
[
89,
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
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
136,
138
],
[
89,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
144,
145
],
[
145,
146
],
[
89,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
149,
154
],
[
89,
155
],
[
155,
156
],
[
155,
157
],
[
155,
158
],
[
159,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
161,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
161,
168
],
[
161,
169
],
[
169,
170
],
[
169,
171
],
[
160,
172
],
[
172,
173
],
[
173,
174
],
[
89,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
87,
181
],
[
181,
182
]
] | [
"import java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\nclass Main {\n static boolean binarySearch(int[] x, int index, int start, int end) {\n if(start >= end) {\n if(x[start] != index) {\n return false;\n }\n }\n \n int mid = (start + end) / 2;\n \n if(x[mid] == index) {\n return true;\n }else if(x[mid] > index) {\n return binarySearch(x, index, start, mid - 1);\n }else if(x[mid] < index) {\n return binarySearch(x, index, mid + 1, end);\n }\n \n return false; //unreachable\n }\n \n public static void main(String[] args) throws IOException {\n BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));\n \n int result = 0;\n \n int num = Integer.parseInt(br_num.readLine());\n int[] array = new int[num];\n String[] inputs_nums = br_num.readLine().split(\" \");\n \n for(int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(inputs_nums[i]);\n }\n \n int q = Integer.parseInt(br_num.readLine());\n String[] inputs_numt = br_num.readLine().split(\" \");\n for(String numt : inputs_numt) {\n if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }\n }\n \n System.out.println(result);\n }\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"class Main {\n static boolean binarySearch(int[] x, int index, int start, int end) {\n if(start >= end) {\n if(x[start] != index) {\n return false;\n }\n }\n \n int mid = (start + end) / 2;\n \n if(x[mid] == index) {\n return true;\n }else if(x[mid] > index) {\n return binarySearch(x, index, start, mid - 1);\n }else if(x[mid] < index) {\n return binarySearch(x, index, mid + 1, end);\n }\n \n return false; //unreachable\n }\n \n public static void main(String[] args) throws IOException {\n BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));\n \n int result = 0;\n \n int num = Integer.parseInt(br_num.readLine());\n int[] array = new int[num];\n String[] inputs_nums = br_num.readLine().split(\" \");\n \n for(int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(inputs_nums[i]);\n }\n \n int q = Integer.parseInt(br_num.readLine());\n String[] inputs_numt = br_num.readLine().split(\" \");\n for(String numt : inputs_numt) {\n if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }\n }\n \n System.out.println(result);\n }\n}",
"Main",
"static boolean binarySearch(int[] x, int index, int start, int end) {\n if(start >= end) {\n if(x[start] != index) {\n return false;\n }\n }\n \n int mid = (start + end) / 2;\n \n if(x[mid] == index) {\n return true;\n }else if(x[mid] > index) {\n return binarySearch(x, index, start, mid - 1);\n }else if(x[mid] < index) {\n return binarySearch(x, index, mid + 1, end);\n }\n \n return false; //unreachable\n }",
"binarySearch",
"{\n if(start >= end) {\n if(x[start] != index) {\n return false;\n }\n }\n \n int mid = (start + end) / 2;\n \n if(x[mid] == index) {\n return true;\n }else if(x[mid] > index) {\n return binarySearch(x, index, start, mid - 1);\n }else if(x[mid] < index) {\n return binarySearch(x, index, mid + 1, end);\n }\n \n return false; //unreachable\n }",
"if(start >= end) {\n if(x[start] != index) {\n return false;\n }\n }",
"start >= end",
"start",
"end",
"{\n if(x[start] != index) {\n return false;\n }\n }",
"if(x[start] != index) {\n return false;\n }",
"x[start] != index",
"x[start]",
"x",
"start",
"index",
"{\n return false;\n }",
"return false;",
"false",
"int mid = (start + end) / 2;",
"mid",
"(start + end) / 2",
"(start + end)",
"start",
"end",
"2",
"if(x[mid] == index) {\n return true;\n }else if(x[mid] > index) {\n return binarySearch(x, index, start, mid - 1);\n }else if(x[mid] < index) {\n return binarySearch(x, index, mid + 1, end);\n }",
"x[mid] == index",
"x[mid]",
"x",
"mid",
"index",
"{\n return true;\n }",
"return true;",
"true",
"if(x[mid] > index) {\n return binarySearch(x, index, start, mid - 1);\n }else if(x[mid] < index) {\n return binarySearch(x, index, mid + 1, end);\n }",
"x[mid] > index",
"x[mid]",
"x",
"mid",
"index",
"{\n return binarySearch(x, index, start, mid - 1);\n }",
"return binarySearch(x, index, start, mid - 1);",
"binarySearch(x, index, start, mid - 1)",
"binarySearch",
"x",
"index",
"start",
"mid - 1",
"mid",
"1",
"if(x[mid] < index) {\n return binarySearch(x, index, mid + 1, end);\n }",
"x[mid] < index",
"x[mid]",
"x",
"mid",
"index",
"{\n return binarySearch(x, index, mid + 1, end);\n }",
"return binarySearch(x, index, mid + 1, end);",
"binarySearch(x, index, mid + 1, end)",
"binarySearch",
"x",
"index",
"mid + 1",
"mid",
"1",
"end",
"return false; //unreachable",
"false",
"int[] x",
"x",
"int index",
"index",
"int start",
"start",
"int end",
"end",
"public static void main(String[] args) throws IOException {\n BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));\n \n int result = 0;\n \n int num = Integer.parseInt(br_num.readLine());\n int[] array = new int[num];\n String[] inputs_nums = br_num.readLine().split(\" \");\n \n for(int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(inputs_nums[i]);\n }\n \n int q = Integer.parseInt(br_num.readLine());\n String[] inputs_numt = br_num.readLine().split(\" \");\n for(String numt : inputs_numt) {\n if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }\n }\n \n System.out.println(result);\n }",
"main",
"{\n BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));\n \n int result = 0;\n \n int num = Integer.parseInt(br_num.readLine());\n int[] array = new int[num];\n String[] inputs_nums = br_num.readLine().split(\" \");\n \n for(int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(inputs_nums[i]);\n }\n \n int q = Integer.parseInt(br_num.readLine());\n String[] inputs_numt = br_num.readLine().split(\" \");\n for(String numt : inputs_numt) {\n if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }\n }\n \n System.out.println(result);\n }",
"BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));",
"br_num",
"new BufferedReader(new InputStreamReader(System.in))",
"int result = 0;",
"result",
"0",
"int num = Integer.parseInt(br_num.readLine());",
"num",
"Integer.parseInt(br_num.readLine())",
"Integer.parseInt",
"Integer",
"br_num.readLine()",
"br_num.readLine",
"br_num",
"int[] array = new int[num];",
"array",
"new int[num]",
"num",
"String[] inputs_nums = br_num.readLine().split(\" \");",
"inputs_nums",
"br_num.readLine().split(\" \")",
"br_num.readLine().split",
"br_num.readLine()",
"br_num.readLine",
"br_num",
"\" \"",
"for(int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(inputs_nums[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n array[i] = Integer.parseInt(inputs_nums[i]);\n }",
"{\n array[i] = Integer.parseInt(inputs_nums[i]);\n }",
"array[i] = Integer.parseInt(inputs_nums[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(inputs_nums[i])",
"Integer.parseInt",
"Integer",
"inputs_nums[i]",
"inputs_nums",
"i",
"int q = Integer.parseInt(br_num.readLine());",
"q",
"Integer.parseInt(br_num.readLine())",
"Integer.parseInt",
"Integer",
"br_num.readLine()",
"br_num.readLine",
"br_num",
"String[] inputs_numt = br_num.readLine().split(\" \");",
"inputs_numt",
"br_num.readLine().split(\" \")",
"br_num.readLine().split",
"br_num.readLine()",
"br_num.readLine",
"br_num",
"\" \"",
"for(String numt : inputs_numt) {\n if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }\n }",
"String numt",
"inputs_numt",
"{\n if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }\n }",
"{\n if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }\n }",
"if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {\n result++;\n }",
"binarySearch(array, Integer.parseInt(numt), 0, num - 1)",
"binarySearch",
"array",
"Integer.parseInt(numt)",
"Integer.parseInt",
"Integer",
"numt",
"0",
"num - 1",
"num",
"1",
"{\n result++;\n }",
"result++",
"result",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args"
] | import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
static boolean binarySearch(int[] x, int index, int start, int end) {
if(start >= end) {
if(x[start] != index) {
return false;
}
}
int mid = (start + end) / 2;
if(x[mid] == index) {
return true;
}else if(x[mid] > index) {
return binarySearch(x, index, start, mid - 1);
}else if(x[mid] < index) {
return binarySearch(x, index, mid + 1, end);
}
return false; //unreachable
}
public static void main(String[] args) throws IOException {
BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));
int result = 0;
int num = Integer.parseInt(br_num.readLine());
int[] array = new int[num];
String[] inputs_nums = br_num.readLine().split(" ");
for(int i = 0; i < num; i++) {
array[i] = Integer.parseInt(inputs_nums[i]);
}
int q = Integer.parseInt(br_num.readLine());
String[] inputs_numt = br_num.readLine().split(" ");
for(String numt : inputs_numt) {
if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
result++;
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
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,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
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
],
[
169,
8
],
[
169,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
11,
49
],
[
49,
50
],
[
49,
51
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
11,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
97,
98
],
[
11,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
9,
105
],
[
105,
106
],
[
169,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
109,
120
],
[
120,
121
],
[
120,
122
],
[
109,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
135,
141
],
[
141,
142
],
[
142,
143
],
[
135,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
144,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
144,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
109,
162
],
[
162,
163
],
[
107,
164
],
[
164,
165
],
[
107,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.io.IOException;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n\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 \n \n for(int i = 0; i < q; i++){\n if(BinarySearch(S, T[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n \n public static boolean BinarySearch(int[] S, int key){\n int left = 0;\n int right = S.length - 1;\n int mid = 0;\n \n while(left <= right){\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }\n return false;\n }\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws IOException {\n\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 \n \n for(int i = 0; i < q; i++){\n if(BinarySearch(S, T[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n \n public static boolean BinarySearch(int[] S, int key){\n int left = 0;\n int right = S.length - 1;\n int mid = 0;\n \n while(left <= right){\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }\n return false;\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\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 \n \n for(int i = 0; i < q; i++){\n if(BinarySearch(S, T[i])){\n count++;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n\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 \n \n for(int i = 0; i < q; i++){\n if(BinarySearch(S, T[i])){\n count++;\n }\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n S[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextInt();\n }",
"{\n S[i] = sc.nextInt();\n }",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = sc.nextInt();\n }",
"{\n T[i] = sc.nextInt();\n }",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++){\n if(BinarySearch(S, T[i])){\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if(BinarySearch(S, T[i])){\n count++;\n }\n }",
"{\n if(BinarySearch(S, T[i])){\n count++;\n }\n }",
"if(BinarySearch(S, T[i])){\n count++;\n }",
"BinarySearch(S, T[i])",
"BinarySearch",
"S",
"T[i]",
"T",
"i",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static boolean BinarySearch(int[] S, int key){\n int left = 0;\n int right = S.length - 1;\n int mid = 0;\n \n while(left <= right){\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }\n return false;\n }",
"BinarySearch",
"{\n int left = 0;\n int right = S.length - 1;\n int mid = 0;\n \n while(left <= right){\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = S.length - 1;",
"right",
"S.length - 1",
"S.length",
"S",
"S.length",
"1",
"int mid = 0;",
"mid",
"0",
"while(left <= right){\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }",
"left <= right",
"left",
"right",
"{\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }",
"mid = (left + right)/2",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }",
"S[mid] == key",
"S[mid]",
"S",
"mid",
"key",
"{\n // System.out.println(key + \" \" + mid);\n return true;\n }",
"return true;",
"true",
"if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }",
"key < S[mid]",
"key",
"S[mid]",
"S",
"mid",
"{\n right = mid-1;\n }",
"right = mid-1",
"right",
"mid-1",
"mid",
"1",
"{\n left = mid+1;\n }",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"return false;",
"false",
"int[] S",
"S",
"int key",
"key",
"public class Main {\n public static void main(String[] args) throws IOException {\n\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 \n \n for(int i = 0; i < q; i++){\n if(BinarySearch(S, T[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n \n public static boolean BinarySearch(int[] S, int key){\n int left = 0;\n int right = S.length - 1;\n int mid = 0;\n \n while(left <= right){\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }\n return false;\n }\n}",
"public class Main {\n public static void main(String[] args) throws IOException {\n\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 \n \n for(int i = 0; i < q; i++){\n if(BinarySearch(S, T[i])){\n count++;\n }\n }\n System.out.println(count);\n }\n \n public static boolean BinarySearch(int[] S, int key){\n int left = 0;\n int right = S.length - 1;\n int mid = 0;\n \n while(left <= right){\n //System.out.println(left + \" \" + right + \" \" + mid);\n mid = (left + right)/2;\n if(S[mid] == key){\n // System.out.println(key + \" \" + mid);\n return true;\n }else if (key < S[mid]){\n right = mid-1;\n }else{\n left = mid+1;\n }\n }\n return false;\n }\n}",
"Main"
] | import java.io.IOException;
import java.util.*;
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 count = 0;
for(int i = 0; i < q; i++){
if(BinarySearch(S, T[i])){
count++;
}
}
System.out.println(count);
}
public static boolean BinarySearch(int[] S, int key){
int left = 0;
int right = S.length - 1;
int mid = 0;
while(left <= right){
//System.out.println(left + " " + right + " " + mid);
mid = (left + right)/2;
if(S[mid] == key){
// System.out.println(key + " " + mid);
return true;
}else if (key < S[mid]){
right = mid-1;
}else{
left = mid+1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
12,
13,
30,
41,
13,
17,
28,
13,
13,
30,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
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,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
156,
5
],
[
156,
6
],
[
6,
7
],
[
156,
8
],
[
8,
9
],
[
156,
10
],
[
10,
11
],
[
156,
12
],
[
12,
13
],
[
156,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
21,
22
],
[
16,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
156,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
30,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
30,
39
],
[
39,
40
],
[
39,
41
],
[
30,
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
],
[
30,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
30,
68
],
[
68,
69
],
[
68,
70
],
[
30,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
72,
83
],
[
84,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
156,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
98,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
102,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
113,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
123,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
113,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
133,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
133,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
94,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
0,
155
],
[
155,
156
],
[
155,
157
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n int n, k;\n long[] as;\n long[] qs;\n public static void main(String[] args) {\n Main p = new Main();\n p.read();\n p.solve();\n }\n\n void read() {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n as = new long[n];\n for (int i = 0; i < n; i++) {\n as[i] = sc.nextLong();\n }\n k = sc.nextInt();\n qs = new long[k];\n for (int i = 0; i < k; i++) {\n qs[i] = sc.nextLong();\n }\n }\n\n void solve() {\n long ans = 0;\n for (long query: qs) {\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n int n, k;\n long[] as;\n long[] qs;\n public static void main(String[] args) {\n Main p = new Main();\n p.read();\n p.solve();\n }\n\n void read() {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n as = new long[n];\n for (int i = 0; i < n; i++) {\n as[i] = sc.nextLong();\n }\n k = sc.nextInt();\n qs = new long[k];\n for (int i = 0; i < k; i++) {\n qs[i] = sc.nextLong();\n }\n }\n\n void solve() {\n long ans = 0;\n for (long query: qs) {\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"int n",
"n",
"k;",
"k",
"long[] as;",
"as",
"long[] qs;",
"qs",
"public static void main(String[] args) {\n Main p = new Main();\n p.read();\n p.solve();\n }",
"main",
"{\n Main p = new Main();\n p.read();\n p.solve();\n }",
"Main p = new Main();",
"p",
"new Main()",
"p.read()",
"p.read",
"p",
"p.solve()",
"p.solve",
"p",
"String[] args",
"args",
"void read() {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n as = new long[n];\n for (int i = 0; i < n; i++) {\n as[i] = sc.nextLong();\n }\n k = sc.nextInt();\n qs = new long[k];\n for (int i = 0; i < k; i++) {\n qs[i] = sc.nextLong();\n }\n }",
"read",
"{\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n as = new long[n];\n for (int i = 0; i < n; i++) {\n as[i] = sc.nextLong();\n }\n k = sc.nextInt();\n qs = new long[k];\n for (int i = 0; i < k; i++) {\n qs[i] = sc.nextLong();\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"as = new long[n]",
"as",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n as[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n as[i] = sc.nextLong();\n }",
"{\n as[i] = sc.nextLong();\n }",
"as[i] = sc.nextLong()",
"as[i]",
"as",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"k = sc.nextInt()",
"k",
"sc.nextInt()",
"sc.nextInt",
"sc",
"qs = new long[k]",
"qs",
"new long[k]",
"k",
"for (int i = 0; i < k; i++) {\n qs[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < k",
"i",
"k",
"i++",
"i++",
"i",
"{\n qs[i] = sc.nextLong();\n }",
"{\n qs[i] = sc.nextLong();\n }",
"qs[i] = sc.nextLong()",
"qs[i]",
"qs",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"void solve() {\n long ans = 0;\n for (long query: qs) {\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }\n System.out.println(ans);\n }",
"solve",
"{\n long ans = 0;\n for (long query: qs) {\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }\n System.out.println(ans);\n }",
"long ans = 0;",
"ans",
"0",
"for (long query: qs) {\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }",
"long query",
"qs",
"{\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }",
"{\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }",
"int l = 0;",
"l",
"0",
"int r = n;",
"r",
"n",
"while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }",
"l != r",
"l",
"r",
"{\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }",
"int mid = l + (r - l) / 2;",
"mid",
"l + (r - l) / 2",
"l",
"(r - l) / 2",
"(r - l)",
"r",
"l",
"2",
"if (as[mid] == query) {\n ans++;\n break;\n }",
"as[mid] == query",
"as[mid]",
"as",
"mid",
"query",
"{\n ans++;\n break;\n }",
"ans++",
"ans",
"break;",
"if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }",
"as[mid] > query",
"as[mid]",
"as",
"mid",
"query",
"{\n r = mid;\n }",
"r = mid",
"r",
"mid",
"{\n l = mid + 1;\n }",
"l = mid + 1",
"l",
"mid + 1",
"mid",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"public class Main {\n int n, k;\n long[] as;\n long[] qs;\n public static void main(String[] args) {\n Main p = new Main();\n p.read();\n p.solve();\n }\n\n void read() {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n as = new long[n];\n for (int i = 0; i < n; i++) {\n as[i] = sc.nextLong();\n }\n k = sc.nextInt();\n qs = new long[k];\n for (int i = 0; i < k; i++) {\n qs[i] = sc.nextLong();\n }\n }\n\n void solve() {\n long ans = 0;\n for (long query: qs) {\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n int n, k;\n long[] as;\n long[] qs;\n public static void main(String[] args) {\n Main p = new Main();\n p.read();\n p.solve();\n }\n\n void read() {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n as = new long[n];\n for (int i = 0; i < n; i++) {\n as[i] = sc.nextLong();\n }\n k = sc.nextInt();\n qs = new long[k];\n for (int i = 0; i < k; i++) {\n qs[i] = sc.nextLong();\n }\n }\n\n void solve() {\n long ans = 0;\n for (long query: qs) {\n int l = 0;\n int r = n;\n while (l != r) {\n int mid = l + (r - l) / 2;\n if (as[mid] == query) {\n ans++;\n break;\n }\n if (as[mid] > query) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
int n, k;
long[] as;
long[] qs;
public static void main(String[] args) {
Main p = new Main();
p.read();
p.solve();
}
void read() {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
as = new long[n];
for (int i = 0; i < n; i++) {
as[i] = sc.nextLong();
}
k = sc.nextInt();
qs = new long[k];
for (int i = 0; i < k; i++) {
qs[i] = sc.nextLong();
}
}
void solve() {
long ans = 0;
for (long query: qs) {
int l = 0;
int r = n;
while (l != r) {
int mid = l + (r - l) / 2;
if (as[mid] == query) {
ans++;
break;
}
if (as[mid] > query) {
r = mid;
} else {
l = mid + 1;
}
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
41,
13,
41,
13,
17,
0,
13,
4,
18,
13,
41,
13,
41,
13,
41,
13,
41,
13,
42,
2,
13,
17,
30,
40,
13,
0,
13,
4,
18,
13,
0,
13,
40,
17,
0,
13,
2,
13,
17,
42,
2,
2,
13,
13,
17,
30,
0,
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
],
[
127,
8
],
[
127,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
11,
45
],
[
45,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
11,
55
],
[
55,
56
],
[
11,
57
],
[
57,
58
],
[
11,
59
],
[
59,
60
],
[
11,
61
],
[
61,
62
],
[
11,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
67,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
67,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
67,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
98,
104
],
[
104,
105
],
[
104,
106
],
[
98,
107
],
[
107,
108
],
[
107,
109
],
[
67,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
110,
116
],
[
116,
117
],
[
11,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
9,
124
],
[
124,
125
],
[
0,
126
],
[
126,
127
],
[
126,
128
]
] | [
"import java.io.*;\nimport java.util.*;\npublic class Main{\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int n;\n n=sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)a[i]=sc.nextInt();\n int q;\n int ans=0;\n q=sc.nextInt();\n int c;\n int l,r,mid;\n while(q>0){\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }\n System.out.println(ans);\n}\n}",
"import java.io.*;",
"io.*",
"java",
"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;\n n=sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)a[i]=sc.nextInt();\n int q;\n int ans=0;\n q=sc.nextInt();\n int c;\n int l,r,mid;\n while(q>0){\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }\n System.out.println(ans);\n}\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int n;\n n=sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)a[i]=sc.nextInt();\n int q;\n int ans=0;\n q=sc.nextInt();\n int c;\n int l,r,mid;\n while(q>0){\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }\n System.out.println(ans);\n}",
"main",
"{\n Scanner sc=new Scanner(System.in);\n int n;\n n=sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)a[i]=sc.nextInt();\n int q;\n int ans=0;\n q=sc.nextInt();\n int c;\n int l,r,mid;\n while(q>0){\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }\n System.out.println(ans);\n}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n;",
"n",
"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++)a[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=sc.nextInt();",
"a[i]=sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q;",
"q",
"int ans=0;",
"ans",
"0",
"q=sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int c;",
"c",
"int l",
"l",
"r",
"r",
"mid;",
"mid",
"while(q>0){\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }",
"q>0",
"q",
"0",
"{\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }",
"q--",
"q",
"c=sc.nextInt()",
"c",
"sc.nextInt()",
"sc.nextInt",
"sc",
"l=-1",
"l",
"-1",
"1",
"r=n-1",
"r",
"n-1",
"n",
"1",
"while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }",
"r-l>1",
"r-l",
"r",
"l",
"1",
"{\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }",
"mid=(l+r)/2",
"mid",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(a[mid]>=c)r=mid;\n else l=mid;",
"a[mid]>=c",
"a[mid]",
"a",
"mid",
"c",
"r=mid",
"r",
"mid",
"l=mid",
"l",
"mid",
"if(a[r]==c)ans++;",
"a[r]==c",
"a[r]",
"a",
"r",
"c",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int n;\n n=sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)a[i]=sc.nextInt();\n int q;\n int ans=0;\n q=sc.nextInt();\n int c;\n int l,r,mid;\n while(q>0){\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }\n System.out.println(ans);\n}\n}",
"public class Main{\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int n;\n n=sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)a[i]=sc.nextInt();\n int q;\n int ans=0;\n q=sc.nextInt();\n int c;\n int l,r,mid;\n while(q>0){\n q--;\n c=sc.nextInt();\n l=-1;r=n-1;\n while(r-l>1){\n mid=(l+r)/2;\n if(a[mid]>=c)r=mid;\n else l=mid;\n }\n if(a[r]==c)ans++;\n }\n System.out.println(ans);\n}\n}",
"Main"
] | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n;
n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)a[i]=sc.nextInt();
int q;
int ans=0;
q=sc.nextInt();
int c;
int l,r,mid;
while(q>0){
q--;
c=sc.nextInt();
l=-1;r=n-1;
while(r-l>1){
mid=(l+r)/2;
if(a[mid]>=c)r=mid;
else l=mid;
}
if(a[r]==c)ans++;
}
System.out.println(ans);
}
}
|
[
7,
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,
30,
0,
18,
13,
13,
4,
18,
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,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
40,
17,
41,
13,
18,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
14,
2,
13,
18,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
30,
29,
17,
23,
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
],
[
14,
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
49,
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
],
[
76,
79
],
[
79,
80
],
[
80,
81
],
[
8,
82
],
[
82,
83
],
[
83,
84
],
[
8,
85
],
[
85,
86
],
[
85,
87
],
[
8,
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
],
[
103,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
8,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
6,
115
],
[
115,
116
],
[
183,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
143,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
143,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
119,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
157,
163
],
[
163,
164
],
[
164,
165
],
[
119,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
166,
172
],
[
172,
173
],
[
173,
174
],
[
166,
175
],
[
175,
176
],
[
176,
177
],
[
117,
178
],
[
178,
179
],
[
117,
180
],
[
180,
181
],
[
0,
182
],
[
182,
183
],
[
182,
184
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = Integer.parseInt(scan.next());\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(scan.next());\n }\n int q = Integer.parseInt(scan.next());\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(scan.next());\n }\n scan.close();\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n ans += binarySearch(s, t[i]);\n }\n System.out.println(ans);\n }\n\n private static int binarySearch(int[] s, int t) {\n int left = -1;\n int right = s.length;\n\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }\n\n if (right == s.length) {\n return 0;\n }\n\n if (s[right] == t) {\n return 1;\n } else {\n return 0;\n }\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = Integer.parseInt(scan.next());\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(scan.next());\n }\n int q = Integer.parseInt(scan.next());\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(scan.next());\n }\n scan.close();\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n ans += binarySearch(s, t[i]);\n }\n System.out.println(ans);\n }\n\n private static int binarySearch(int[] s, int t) {\n int left = -1;\n int right = s.length;\n\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }\n\n if (right == s.length) {\n return 0;\n }\n\n if (s[right] == t) {\n return 1;\n } else {\n return 0;\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = Integer.parseInt(scan.next());\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(scan.next());\n }\n int q = Integer.parseInt(scan.next());\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(scan.next());\n }\n scan.close();\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n ans += binarySearch(s, t[i]);\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n = Integer.parseInt(scan.next());\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(scan.next());\n }\n int q = Integer.parseInt(scan.next());\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(scan.next());\n }\n scan.close();\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n ans += binarySearch(s, t[i]);\n }\n System.out.println(ans);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = Integer.parseInt(scan.next());",
"n",
"Integer.parseInt(scan.next())",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(scan.next());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(scan.next());\n }",
"{\n s[i] = Integer.parseInt(scan.next());\n }",
"s[i] = Integer.parseInt(scan.next())",
"s[i]",
"s",
"i",
"Integer.parseInt(scan.next())",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int q = Integer.parseInt(scan.next());",
"q",
"Integer.parseInt(scan.next())",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(scan.next());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = Integer.parseInt(scan.next());\n }",
"{\n t[i] = Integer.parseInt(scan.next());\n }",
"t[i] = Integer.parseInt(scan.next())",
"t[i]",
"t",
"i",
"Integer.parseInt(scan.next())",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"scan.close()",
"scan.close",
"scan",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n ans += binarySearch(s, t[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n ans += binarySearch(s, t[i]);\n }",
"{\n ans += binarySearch(s, t[i]);\n }",
"ans += binarySearch(s, t[i])",
"ans",
"binarySearch(s, t[i])",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"private static int binarySearch(int[] s, int t) {\n int left = -1;\n int right = s.length;\n\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }\n\n if (right == s.length) {\n return 0;\n }\n\n if (s[right] == t) {\n return 1;\n } else {\n return 0;\n }\n }",
"binarySearch",
"{\n int left = -1;\n int right = s.length;\n\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }\n\n if (right == s.length) {\n return 0;\n }\n\n if (s[right] == t) {\n return 1;\n } else {\n return 0;\n }\n }",
"int left = -1;",
"left",
"-1",
"1",
"int right = s.length;",
"right",
"s.length",
"s",
"s.length",
"while (right - left > 1) {\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }",
"right - left > 1",
"right - left",
"right",
"left",
"1",
"{\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }",
"int mid = (right + left) / 2;",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }",
"s[mid] >= t",
"s[mid]",
"s",
"mid",
"t",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid;\n }",
"left = mid",
"left",
"mid",
"if (right == s.length) {\n return 0;\n }",
"right == s.length",
"right",
"s.length",
"s",
"s.length",
"{\n return 0;\n }",
"return 0;",
"0",
"if (s[right] == t) {\n return 1;\n } else {\n return 0;\n }",
"s[right] == t",
"s[right]",
"s",
"right",
"t",
"{\n return 1;\n }",
"return 1;",
"1",
"{\n return 0;\n }",
"return 0;",
"0",
"int[] s",
"s",
"int t",
"t",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = Integer.parseInt(scan.next());\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(scan.next());\n }\n int q = Integer.parseInt(scan.next());\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(scan.next());\n }\n scan.close();\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n ans += binarySearch(s, t[i]);\n }\n System.out.println(ans);\n }\n\n private static int binarySearch(int[] s, int t) {\n int left = -1;\n int right = s.length;\n\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }\n\n if (right == s.length) {\n return 0;\n }\n\n if (s[right] == t) {\n return 1;\n } else {\n return 0;\n }\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = Integer.parseInt(scan.next());\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(scan.next());\n }\n int q = Integer.parseInt(scan.next());\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(scan.next());\n }\n scan.close();\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n ans += binarySearch(s, t[i]);\n }\n System.out.println(ans);\n }\n\n private static int binarySearch(int[] s, int t) {\n int left = -1;\n int right = s.length;\n\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (s[mid] >= t) {\n right = mid;\n } else {\n left = mid;\n }\n }\n\n if (right == s.length) {\n return 0;\n }\n\n if (s[right] == t) {\n return 1;\n } else {\n return 0;\n }\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.next());
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = Integer.parseInt(scan.next());
}
int q = Integer.parseInt(scan.next());
int[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = Integer.parseInt(scan.next());
}
scan.close();
int ans = 0;
for (int i = 0; i < q; i++) {
ans += binarySearch(s, t[i]);
}
System.out.println(ans);
}
private static int binarySearch(int[] s, int t) {
int left = -1;
int right = s.length;
while (right - left > 1) {
int mid = (right + left) / 2;
if (s[mid] >= t) {
right = mid;
} else {
left = mid;
}
}
if (right == s.length) {
return 0;
}
if (s[right] == t) {
return 1;
} else {
return 0;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
0,
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,
30,
0,
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
],
[
202,
11
],
[
202,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
14,
77
],
[
77,
78
],
[
77,
79
],
[
14,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
109,
112
],
[
12,
113
],
[
113,
114
],
[
202,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
120,
121
],
[
117,
122
],
[
122,
123
],
[
117,
124
],
[
124,
125
],
[
124,
126
],
[
117,
127
],
[
127,
128
],
[
117,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
129,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
143,
149
],
[
149,
150
],
[
149,
151
],
[
143,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
143,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
161,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
169,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
169,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
179,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
188,
190
],
[
179,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
117,
195
],
[
195,
196
],
[
115,
197
],
[
197,
198
],
[
115,
199
],
[
199,
200
],
[
0,
201
],
[
201,
202
],
[
201,
203
]
] | [
"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 Exception, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sStr = br.readLine().split(\" \");\n\t\tint S[] = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++){\n\t\t\tS[i] = Integer.parseInt(sStr[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tStr = br.readLine().split(\" \");\n\t\tint T[] = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++){\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S,T));\n\t}\n\n\tpublic static int binarySearch(int[] S,int[] T){\n\t\tint min;\n\t\tint max;\n\t\tint mid;\n\t\tint count = 0;\n\t\tint searchNum;\n\n\t\tfor(int y = 0; y < T.length; y++){\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sStr = br.readLine().split(\" \");\n\t\tint S[] = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++){\n\t\t\tS[i] = Integer.parseInt(sStr[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tStr = br.readLine().split(\" \");\n\t\tint T[] = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++){\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S,T));\n\t}\n\n\tpublic static int binarySearch(int[] S,int[] T){\n\t\tint min;\n\t\tint max;\n\t\tint mid;\n\t\tint count = 0;\n\t\tint searchNum;\n\n\t\tfor(int y = 0; y < T.length; y++){\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws Exception, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sStr = br.readLine().split(\" \");\n\t\tint S[] = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++){\n\t\t\tS[i] = Integer.parseInt(sStr[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tStr = br.readLine().split(\" \");\n\t\tint T[] = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++){\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S,T));\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sStr = br.readLine().split(\" \");\n\t\tint S[] = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++){\n\t\t\tS[i] = Integer.parseInt(sStr[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tStr = br.readLine().split(\" \");\n\t\tint T[] = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++){\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S,T));\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[] sStr = br.readLine().split(\" \");",
"sStr",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int S[] = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0 ; i < n ; i++){\n\t\t\tS[i] = Integer.parseInt(sStr[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(sStr[i]);\n\t\t}",
"{\n\t\t\tS[i] = Integer.parseInt(sStr[i]);\n\t\t}",
"S[i] = Integer.parseInt(sStr[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(sStr[i])",
"Integer.parseInt",
"Integer",
"sStr[i]",
"sStr",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"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",
"\" \"",
"int T[] = new int[q];",
"T",
"new int[q]",
"q",
"for(int i = 0 ; i < q ; i++){\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}",
"{\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}",
"T[i] = Integer.parseInt(tStr[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(tStr[i])",
"Integer.parseInt",
"Integer",
"tStr[i]",
"tStr",
"i",
"System.out.println(binarySearch(S,T))",
"System.out.println",
"System.out",
"System",
"System.out",
"binarySearch(S,T)",
"binarySearch",
"S",
"T",
"String[] args",
"args",
"public static int binarySearch(int[] S,int[] T){\n\t\tint min;\n\t\tint max;\n\t\tint mid;\n\t\tint count = 0;\n\t\tint searchNum;\n\n\t\tfor(int y = 0; y < T.length; y++){\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t}",
"binarySearch",
"{\n\t\tint min;\n\t\tint max;\n\t\tint mid;\n\t\tint count = 0;\n\t\tint searchNum;\n\n\t\tfor(int y = 0; y < T.length; y++){\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t}",
"int min;",
"min",
"int max;",
"max",
"int mid;",
"mid",
"int count = 0;",
"count",
"0",
"int searchNum;",
"searchNum",
"for(int y = 0; y < T.length; y++){\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int y = 0;",
"int y = 0;",
"y",
"0",
"y < T.length",
"y",
"T.length",
"T",
"T.length",
"y++",
"y++",
"y",
"{\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"searchNum = T[y]",
"searchNum",
"T[y]",
"T",
"y",
"min = 0",
"min",
"0",
"max = S.length",
"max",
"S.length",
"S",
"S.length",
"while(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}",
"max > min",
"max",
"min",
"{\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}",
"mid = (max + min) / 2",
"mid",
"(max + min) / 2",
"(max + min)",
"max",
"min",
"2",
"if(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}",
"S[mid] == searchNum",
"S[mid]",
"S",
"mid",
"searchNum",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}",
"S[mid] < searchNum",
"S[mid]",
"S",
"mid",
"searchNum",
"{\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}",
"min = mid + 1",
"min",
"mid + 1",
"mid",
"1",
"{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}",
"max = mid",
"max",
"mid",
"return count;",
"count",
"int[] S",
"S",
"int[] T",
"T",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sStr = br.readLine().split(\" \");\n\t\tint S[] = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++){\n\t\t\tS[i] = Integer.parseInt(sStr[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tStr = br.readLine().split(\" \");\n\t\tint T[] = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++){\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S,T));\n\t}\n\n\tpublic static int binarySearch(int[] S,int[] T){\n\t\tint min;\n\t\tint max;\n\t\tint mid;\n\t\tint count = 0;\n\t\tint searchNum;\n\n\t\tfor(int y = 0; y < T.length; y++){\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sStr = br.readLine().split(\" \");\n\t\tint S[] = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++){\n\t\t\tS[i] = Integer.parseInt(sStr[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tStr = br.readLine().split(\" \");\n\t\tint T[] = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++){\n\t\t\tT[i] = Integer.parseInt(tStr[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S,T));\n\t}\n\n\tpublic static int binarySearch(int[] S,int[] T){\n\t\tint min;\n\t\tint max;\n\t\tint mid;\n\t\tint count = 0;\n\t\tint searchNum;\n\n\t\tfor(int y = 0; y < T.length; y++){\n\t\t\tsearchNum = T[y];\n\t\t\tmin = 0;\n\t\t\tmax = S.length;\n\t\t\twhile(max > min){\n\t\t\t\tmid = (max + min) / 2;\n\t\t\t\tif(S[mid] == searchNum){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(S[mid] < searchNum){\n\t\t\t\t\tmin = mid + 1;\n\t\t\t\t}else{\n\t\t\t\t\tmax = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn count;\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) throws Exception, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] sStr = br.readLine().split(" ");
int S[] = new int[n];
for(int i = 0 ; i < n ; i++){
S[i] = Integer.parseInt(sStr[i]);
}
int q = Integer.parseInt(br.readLine());
String[] tStr = br.readLine().split(" ");
int T[] = new int[q];
for(int i = 0 ; i < q ; i++){
T[i] = Integer.parseInt(tStr[i]);
}
System.out.println(binarySearch(S,T));
}
public static int binarySearch(int[] S,int[] T){
int min;
int max;
int mid;
int count = 0;
int searchNum;
for(int y = 0; y < T.length; y++){
searchNum = T[y];
min = 0;
max = S.length;
while(max > min){
mid = (max + min) / 2;
if(S[mid] == searchNum){
count++;
break;
}else if(S[mid] < searchNum){
min = mid + 1;
}else{
max = mid;
}
}
}
return count;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
41,
13,
40,
17,
41,
13,
17,
42,
2,
2,
13,
17,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
14,
13,
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
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
85,
95
],
[
95,
96
],
[
95,
97
],
[
85,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
98,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
112,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
130,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
125,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
85,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
8,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
6,
152
],
[
152,
153
]
] | [
"\nimport java.util.*;\n\nclass Main{\n\tpublic static void main(String[] args){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint ul = s.length;\n\t\t\tint ll = -1;\n\t\t\tboolean flag = false;\n\t\t\twhile(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\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 in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint ul = s.length;\n\t\t\tint ll = -1;\n\t\t\tboolean flag = false;\n\t\t\twhile(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint ul = s.length;\n\t\t\tint ll = -1;\n\t\t\tboolean flag = false;\n\t\t\twhile(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ts[i] = in.nextInt();\n\t\t}\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i=0;i<q;i++){\n\t\t\tt[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint ul = s.length;\n\t\t\tint ll = -1;\n\t\t\tboolean flag = false;\n\t\t\twhile(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"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;i<n;i++){\n\t\t\ts[i] = in.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts[i] = in.nextInt();\n\t\t}",
"{\n\t\t\ts[i] = in.nextInt();\n\t\t}",
"s[i] = in.nextInt()",
"s[i]",
"s",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for(int i=0;i<q;i++){\n\t\t\tt[i] = in.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tt[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tt[i] = in.nextInt();\n\t\t}",
"t[i] = in.nextInt()",
"t[i]",
"t",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int count = 0;",
"count",
"0",
"for(int i=0;i<q;i++){\n\t\t\tint ul = s.length;\n\t\t\tint ll = -1;\n\t\t\tboolean flag = false;\n\t\t\twhile(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag){\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\tint ul = s.length;\n\t\t\tint ll = -1;\n\t\t\tboolean flag = false;\n\t\t\twhile(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint ul = s.length;\n\t\t\tint ll = -1;\n\t\t\tboolean flag = false;\n\t\t\twhile(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int ul = s.length;",
"ul",
"s.length",
"s",
"s.length",
"int ll = -1;",
"ll",
"-1",
"1",
"boolean flag = false;",
"flag",
"false",
"while(ll+1<ul){\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}",
"ll+1<ul",
"ll+1",
"ll",
"1",
"ul",
"{\n\t\t\t\tint mid = (ll+ul)/2;\n\t\t\t\tif(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}\n\t\t\t}",
"int mid = (ll+ul)/2;",
"mid",
"(ll+ul)/2",
"(ll+ul)",
"ll",
"ul",
"2",
"if(s[mid] == t[i]){\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}",
"s[mid] == t[i]",
"s[mid]",
"s",
"mid",
"t[i]",
"t",
"i",
"{\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"flag = true",
"flag",
"true",
"break;",
"if(s[mid]<t[i]){\n\t\t\t\t\tll = mid;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tul = mid;\n\t\t\t\t}",
"s[mid]<t[i]",
"s[mid]",
"s",
"mid",
"t[i]",
"t",
"i",
"{\n\t\t\t\t\tll = mid;\n\t\t\t\t}",
"ll = mid",
"ll",
"mid",
"{\n\t\t\t\t\tul = mid;\n\t\t\t\t}",
"ul = mid",
"ul",
"mid",
"if(flag){\n\t\t\t\tcount++;\n\t\t\t}",
"flag",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] |
import java.util.*;
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;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 count = 0;
for(int i=0;i<q;i++){
int ul = s.length;
int ll = -1;
boolean flag = false;
while(ll+1<ul){
int mid = (ll+ul)/2;
if(s[mid] == t[i]){
flag = true;
break;
}
else if(s[mid]<t[i]){
ll = mid;
}
else{
ul = mid;
}
}
if(flag){
count++;
}
}
System.out.println(count);
}
} |
[
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,
20,
41,
13,
20,
4,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
4,
18,
13,
13,
13,
17,
40,
13,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
30,
29,
18,
13,
40,
13,
30,
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,
30,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
30,
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,
30,
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,
30,
37,
20,
29,
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,
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,
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
],
[
480,
17
],
[
480,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
20,
27
],
[
27,
28
],
[
27,
29
],
[
20,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
20,
34
],
[
34,
35
],
[
35,
36
],
[
18,
37
],
[
37,
38
],
[
0,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
39,
43
],
[
43,
44
],
[
39,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
39,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
51,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
51,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
51,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
49,
74
],
[
74,
75
],
[
39,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
82,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
89,
93
],
[
88,
94
],
[
87,
95
],
[
95,
96
],
[
78,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
76,
101
],
[
101,
102
],
[
0,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
103,
110
],
[
110,
111
],
[
110,
112
],
[
103,
114
],
[
114,
115
],
[
114,
116
],
[
103,
117
],
[
117,
118
],
[
117,
119
],
[
103,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
123,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
134,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
130,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
153,
154
],
[
122,
155
],
[
155,
156
],
[
103,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
160,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
103,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
181,
182
],
[
181,
183
],
[
173,
184
],
[
184,
185
],
[
103,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
190,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
196,
198
],
[
189,
199
],
[
199,
200
],
[
200,
201
],
[
188,
202
],
[
202,
203
],
[
203,
204
],
[
103,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
208,
212
],
[
212,
213
],
[
213,
214
],
[
207,
215
],
[
215,
216
],
[
215,
217
],
[
207,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
207,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
227,
230
],
[
226,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
207,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
103,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
244,
245
],
[
242,
246
],
[
246,
247
],
[
247,
248
],
[
241,
249
],
[
249,
250
],
[
249,
251
],
[
241,
252
],
[
252,
253
],
[
252,
254
],
[
241,
255
],
[
255,
256
],
[
255,
257
],
[
257,
258
],
[
241,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
259,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
263,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
241,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
273,
275
],
[
272,
276
],
[
276,
277
],
[
276,
278
],
[
271,
279
],
[
279,
280
],
[
280,
281
],
[
241,
282
],
[
282,
283
],
[
282,
284
],
[
284,
285
],
[
285,
286
],
[
286,
287
],
[
287,
288
],
[
287,
289
],
[
286,
290
],
[
290,
291
],
[
290,
292
],
[
285,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
293,
297
],
[
297,
298
],
[
297,
299
],
[
299,
300
],
[
299,
301
],
[
285,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
303,
308
],
[
308,
309
],
[
309,
310
],
[
309,
311
],
[
302,
312
],
[
312,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
316,
317
],
[
314,
318
],
[
302,
319
],
[
319,
320
],
[
320,
321
],
[
284,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
103,
326
],
[
326,
327
],
[
326,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
331,
332
],
[
328,
333
],
[
333,
334
],
[
334,
335
],
[
335,
336
],
[
335,
337
],
[
337,
338
],
[
337,
339
],
[
334,
340
],
[
340,
341
],
[
340,
342
],
[
342,
343
],
[
342,
344
],
[
333,
345
],
[
345,
346
],
[
346,
347
],
[
328,
348
],
[
348,
349
],
[
103,
350
],
[
350,
351
],
[
350,
352
],
[
352,
353
],
[
353,
354
],
[
354,
355
],
[
355,
356
],
[
354,
357
],
[
357,
358
],
[
103,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
362,
363
],
[
362,
364
],
[
361,
366
],
[
366,
367
],
[
367,
368
],
[
368,
369
],
[
368,
370
],
[
366,
371
],
[
371,
372
],
[
371,
373
],
[
366,
374
],
[
374,
375
],
[
375,
376
],
[
366,
377
],
[
378,
378
],
[
378,
379
],
[
379,
380
],
[
380,
381
],
[
380,
382
],
[
379,
383
],
[
383,
384
],
[
361,
385
],
[
385,
386
],
[
359,
387
],
[
387,
388
],
[
103,
389
],
[
389,
390
],
[
389,
391
],
[
391,
392
],
[
392,
393
],
[
392,
394
],
[
391,
396
],
[
396,
397
],
[
397,
398
],
[
398,
399
],
[
398,
400
],
[
396,
401
],
[
401,
402
],
[
401,
403
],
[
396,
404
],
[
404,
405
],
[
405,
406
],
[
396,
407
],
[
408,
408
],
[
408,
409
],
[
409,
410
],
[
410,
411
],
[
410,
412
],
[
409,
413
],
[
413,
414
],
[
391,
415
],
[
415,
416
],
[
389,
417
],
[
417,
418
],
[
103,
419
],
[
419,
420
],
[
419,
421
],
[
421,
422
],
[
422,
423
],
[
422,
424
],
[
421,
426
],
[
426,
427
],
[
427,
428
],
[
428,
429
],
[
428,
430
],
[
426,
431
],
[
431,
432
],
[
431,
433
],
[
426,
434
],
[
434,
435
],
[
435,
436
],
[
426,
437
],
[
438,
438
],
[
438,
439
],
[
439,
440
],
[
440,
441
],
[
440,
442
],
[
439,
443
],
[
443,
444
],
[
421,
445
],
[
445,
446
],
[
419,
447
],
[
447,
448
],
[
103,
449
],
[
449,
450
],
[
449,
451
],
[
451,
452
],
[
452,
453
],
[
452,
454
],
[
451,
456
],
[
456,
457
],
[
457,
458
],
[
458,
459
],
[
458,
460
],
[
456,
461
],
[
461,
462
],
[
461,
463
],
[
456,
464
],
[
464,
465
],
[
465,
466
],
[
456,
467
],
[
468,
468
],
[
468,
469
],
[
469,
470
],
[
470,
471
],
[
470,
472
],
[
469,
473
],
[
473,
474
],
[
451,
475
],
[
475,
476
],
[
449,
477
],
[
477,
478
],
[
0,
479
],
[
479,
480
],
[
479,
481
]
] | [
"\nimport java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AOJ problem = new AOJ(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AOJ {\n\n int n, q;\n int[] S, T;\n\n AOJ(FastScanner sc) {\n n = sc.nextInt();\n S = sc.arrayInt(n);\n q = sc.nextInt();\n T = sc.arrayInt(q);\n }\n\n void solve(PrintWriter out) {\n int cnt = 0;\n for (int i : T) {\n if (Arrays.binarySearch(S, i) >= 0) cnt++;\n }\n out.println(cnt);\n }\n\n}\n\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] arrayInt(int N) {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n\n public long[] arrayLong(int N) {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n\n public double[] arrayDouble(int N) {\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n\n public String[] arrayString(int N) {\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }\n\n}\n",
"import java.text.DecimalFormat;",
"DecimalFormat",
"java.text",
"import java.util.stream.LongStream;",
"LongStream",
"java.util.stream",
"import java.util.stream.IntStream;",
"IntStream",
"java.util.stream",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AOJ problem = new AOJ(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"Main",
"public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AOJ problem = new AOJ(sc);\n problem.solve(out);\n\n out.flush();\n }",
"main",
"{\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AOJ problem = new AOJ(sc);\n problem.solve(out);\n\n out.flush();\n }",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"AOJ problem = new AOJ(sc);",
"problem",
"new AOJ(sc)",
"problem.solve(out)",
"problem.solve",
"problem",
"out",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"class AOJ {\n\n int n, q;\n int[] S, T;\n\n AOJ(FastScanner sc) {\n n = sc.nextInt();\n S = sc.arrayInt(n);\n q = sc.nextInt();\n T = sc.arrayInt(q);\n }\n\n void solve(PrintWriter out) {\n int cnt = 0;\n for (int i : T) {\n if (Arrays.binarySearch(S, i) >= 0) cnt++;\n }\n out.println(cnt);\n }\n\n}",
"AOJ",
"int n",
"n",
"q;",
"q",
"int[] S",
"S",
"T;",
"T",
"AOJ(FastScanner sc) {\n n = sc.nextInt();\n S = sc.arrayInt(n);\n q = sc.nextInt();\n T = sc.arrayInt(q);\n }",
"AOJ",
"{\n n = sc.nextInt();\n S = sc.arrayInt(n);\n q = sc.nextInt();\n T = sc.arrayInt(q);\n }",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S = sc.arrayInt(n)",
"S",
"sc.arrayInt(n)",
"sc.arrayInt",
"sc",
"n",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"T = sc.arrayInt(q)",
"T",
"sc.arrayInt(q)",
"sc.arrayInt",
"sc",
"q",
"FastScanner sc",
"sc",
"void solve(PrintWriter out) {\n int cnt = 0;\n for (int i : T) {\n if (Arrays.binarySearch(S, i) >= 0) cnt++;\n }\n out.println(cnt);\n }",
"solve",
"{\n int cnt = 0;\n for (int i : T) {\n if (Arrays.binarySearch(S, i) >= 0) cnt++;\n }\n out.println(cnt);\n }",
"int cnt = 0;",
"cnt",
"0",
"for (int i : T) {\n if (Arrays.binarySearch(S, i) >= 0) cnt++;\n }",
"int i",
"T",
"{\n if (Arrays.binarySearch(S, i) >= 0) cnt++;\n }",
"{\n if (Arrays.binarySearch(S, i) >= 0) cnt++;\n }",
"if (Arrays.binarySearch(S, i) >= 0) cnt++;",
"Arrays.binarySearch(S, i) >= 0",
"Arrays.binarySearch(S, i)",
"Arrays.binarySearch",
"Arrays",
"S",
"i",
"0",
"cnt++",
"cnt",
"out.println(cnt)",
"out.println",
"out",
"cnt",
"PrintWriter out",
"out",
"class FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] arrayInt(int N) {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n\n public long[] arrayLong(int N) {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n\n public double[] arrayDouble(int N) {\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n\n public String[] arrayString(int N) {\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }\n\n}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"hasNextByte",
"{\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr < buflen",
"ptr",
"buflen",
"{\n return true;\n }",
"return true;",
"true",
"{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr = 0",
"ptr",
"0",
"try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }",
"readByte",
"{\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }",
"if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }",
"hasNextByte()",
"hasNextByte",
"{\n return buffer[ptr++];\n }",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }",
"isPrintableChar",
"{\n return 33 <= c && c <= 126;\n }",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }",
"hasNext",
"{\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }",
"while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"{\n ptr++;\n }",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"next",
"{\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"if (!hasNext()) {\n throw new NoSuchElementException();\n }",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n throw new NoSuchElementException();\n }",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n sb.appendCodePoint(b);\n b = readByte();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"nextLong",
"{\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"if (!hasNext()) {\n throw new NoSuchElementException();\n }",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n throw new NoSuchElementException();\n }",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n minus = true;\n b = readByte();\n }",
"b == '-'",
"b",
"'-'",
"{\n minus = true;\n b = readByte();\n }",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"true",
"{\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n n *= 10;\n n += b - '0';\n }",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n return minus ? -n : n;\n }",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }",
"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",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public double nextDouble() {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] arrayInt(int N) {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }",
"arrayInt",
"{\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }",
"int[] array = new int[N];",
"array",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n array[i] = nextInt();\n }",
"{\n array[i] = nextInt();\n }",
"array[i] = nextInt()",
"array[i]",
"array",
"i",
"nextInt()",
"nextInt",
"return array;",
"array",
"int N",
"N",
"public long[] arrayLong(int N) {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }",
"arrayLong",
"{\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }",
"long[] array = new long[N];",
"array",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n array[i] = nextLong();\n }",
"{\n array[i] = nextLong();\n }",
"array[i] = nextLong()",
"array[i]",
"array",
"i",
"nextLong()",
"nextLong",
"return array;",
"array",
"int N",
"N",
"public double[] arrayDouble(int N) {\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }",
"arrayDouble",
"{\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }",
"double[] array = new double[N];",
"array",
"new double[N]",
"N",
"for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n array[i] = nextDouble();\n }",
"{\n array[i] = nextDouble();\n }",
"array[i] = nextDouble()",
"array[i]",
"array",
"i",
"nextDouble()",
"nextDouble",
"return array;",
"array",
"int N",
"N",
"public String[] arrayString(int N) {\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }",
"arrayString",
"{\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }",
"String[] array = new String[N];",
"array",
"new String[N]",
"N",
"for (int i = 0; i < N; i++) {\n array[i] = next();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n array[i] = next();\n }",
"{\n array[i] = next();\n }",
"array[i] = next()",
"array[i]",
"array",
"i",
"next()",
"next",
"return array;",
"array",
"int N",
"N",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AOJ problem = new AOJ(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AOJ problem = new AOJ(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}",
"Main"
] |
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
AOJ problem = new AOJ(sc);
problem.solve(out);
out.flush();
}
}
class AOJ {
int n, q;
int[] S, T;
AOJ(FastScanner sc) {
n = sc.nextInt();
S = sc.arrayInt(n);
q = sc.nextInt();
T = sc.arrayInt(q);
}
void solve(PrintWriter out) {
int cnt = 0;
for (int i : T) {
if (Arrays.binarySearch(S, i) >= 0) cnt++;
}
out.println(cnt);
}
}
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());
}
public int[] arrayInt(int N) {
int[] array = new int[N];
for (int i = 0; i < N; i++) {
array[i] = nextInt();
}
return array;
}
public long[] arrayLong(int N) {
long[] array = new long[N];
for (int i = 0; i < N; i++) {
array[i] = nextLong();
}
return array;
}
public double[] arrayDouble(int N) {
double[] array = new double[N];
for (int i = 0; i < N; i++) {
array[i] = nextDouble();
}
return array;
}
public String[] arrayString(int N) {
String[] array = new String[N];
for (int i = 0; i < N; i++) {
array[i] = next();
}
return array;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
166,
5
],
[
166,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
75,
78
],
[
75,
79
],
[
75,
80
],
[
6,
81
],
[
81,
82
],
[
166,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
107,
109
],
[
101,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
101,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
137,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
85,
155
],
[
155,
156
],
[
83,
157
],
[
157,
158
],
[
83,
159
],
[
159,
160
],
[
83,
161
],
[
161,
162
],
[
83,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint m = sc.nextInt();\n\t\tint[] T = new int[m];\n\t\tfor (int j = 0; j < m; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\tSystem.out.println(binSearch(S, n, T, m));\n\t}\n\n\tstatic int binSearch(int[] array, int n, int[] array1, int m) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}\n\t\treturn count;\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint m = sc.nextInt();\n\t\tint[] T = new int[m];\n\t\tfor (int j = 0; j < m; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\tSystem.out.println(binSearch(S, n, T, m));\n\t}\n\n\tstatic int binSearch(int[] array, int n, int[] array1, int m) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}\n\t\treturn count;\n\t}\n}",
"Main",
"public static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint m = sc.nextInt();\n\t\tint[] T = new int[m];\n\t\tfor (int j = 0; j < m; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\tSystem.out.println(binSearch(S, n, T, m));\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint m = sc.nextInt();\n\t\tint[] T = new int[m];\n\t\tfor (int j = 0; j < m; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\tSystem.out.println(binSearch(S, n, T, m));\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 m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[m];",
"T",
"new int[m]",
"m",
"for (int j = 0; j < m; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < m",
"j",
"m",
"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",
"System.out.println(binSearch(S, n, T, m))",
"System.out.println",
"System.out",
"System",
"System.out",
"binSearch(S, n, T, m)",
"binSearch",
"S",
"n",
"T",
"m",
"String[] args",
"args",
"static int binSearch(int[] array, int n, int[] array1, int m) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}\n\t\treturn count;\n\t}",
"binSearch",
"{\n\t\tint count = 0;\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}\n\t\treturn count;\n\t}",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < m; i++) {\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}",
"{\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}",
"int key = array1[i];",
"key",
"array1[i]",
"array1",
"i",
"int pl = 0;",
"pl",
"0",
"int pr = n - 1;",
"pr",
"n - 1",
"n",
"1",
"do {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);",
"pl <= pr",
"pl",
"pr",
"{\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t}",
"int pc = (pr + pl) / 2;",
"pc",
"(pr + pl) / 2",
"(pr + pl)",
"pr",
"pl",
"2",
"if (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}",
"array[pc] == key",
"array[pc]",
"array",
"pc",
"key",
"{\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}",
"count++",
"count",
"break;",
"if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}",
"array[pc] < key",
"array[pc]",
"array",
"pc",
"key",
"{\n\t\t\t\tpl = pc + 1;\n\t\t\t}",
"pl = pc + 1",
"pl",
"pc + 1",
"pc",
"1",
"{\n\t\t\t\tpr = pc - 1;\n\t\t\t}",
"pr = pc - 1",
"pr",
"pc - 1",
"pc",
"1",
"return count;",
"count",
"int[] array",
"array",
"int n",
"n",
"int[] array1",
"array1",
"int m",
"m",
"public class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint m = sc.nextInt();\n\t\tint[] T = new int[m];\n\t\tfor (int j = 0; j < m; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\tSystem.out.println(binSearch(S, n, T, m));\n\t}\n\n\tstatic int binSearch(int[] array, int n, int[] array1, int m) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}\n\t\treturn count;\n\t}\n}",
"public class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint m = sc.nextInt();\n\t\tint[] T = new int[m];\n\t\tfor (int j = 0; j < m; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\tSystem.out.println(binSearch(S, n, T, m));\n\t}\n\n\tstatic int binSearch(int[] array, int n, int[] array1, int m) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint key = array1[i];\n\t\t\tint pl = 0;\n\t\t\tint pr = n - 1;\n\t\t\tdo {\n\t\t\t\tint pc = (pr + pl) / 2;\n\t\t\tif (array[pc] == key) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if (array[pc] < key){\n\t\t\t\tpl = pc + 1;\n\t\t\t} else {\n\t\t\t\tpr = pc - 1;\n\t\t\t}\n\t\t\t} while (pl <= pr);\n\t\t}\n\t\treturn count;\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = sc.nextInt();
}
int m = sc.nextInt();
int[] T = new int[m];
for (int j = 0; j < m; j++) {
T[j] = sc.nextInt();
}
System.out.println(binSearch(S, n, T, m));
}
static int binSearch(int[] array, int n, int[] array1, int m) {
int count = 0;
for (int i = 0; i < m; i++) {
int key = array1[i];
int pl = 0;
int pr = n - 1;
do {
int pc = (pr + pl) / 2;
if (array[pc] == key) {
count++;
break;
} else if (array[pc] < key){
pl = pc + 1;
} else {
pr = pc - 1;
}
} while (pl <= pr);
}
return count;
}
}
|
[
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,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
4,
18,
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
],
[
158,
11
],
[
158,
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
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
72,
77
],
[
16,
78
],
[
78,
79
],
[
78,
80
],
[
16,
81
],
[
81,
82
],
[
81,
83
],
[
81,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
87,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
86,
94
],
[
94,
95
],
[
16,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
12,
102
],
[
102,
103
],
[
158,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
106,
115
],
[
115,
116
],
[
106,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
129,
135
],
[
135,
136
],
[
129,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
143,
145
],
[
137,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
106,
151
],
[
151,
152
],
[
104,
153
],
[
153,
154
],
[
104,
155
],
[
155,
156
],
[
0,
157
],
[
157,
158
],
[
157,
159
]
] | [
"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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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",
"line = br.readLine().split(\" \")",
"line",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int cnt=0;",
"cnt",
"0",
"for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;\n }",
"String ref",
"line",
"{\n if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;\n }",
"{\n if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;\n }",
"if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )\n cnt++;",
"isExistSeachByBinary(seqS, Integer.parseInt(ref))",
"isExistSeachByBinary",
"seqS",
"Integer.parseInt(ref)",
"Integer.parseInt",
"Integer",
"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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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 line = br.readLine().split(\" \");\n \n int cnt=0;\n for (String ref : line) {\n if( isExistSeachByBinary(seqS, Integer.parseInt(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());
line = br.readLine().split(" ");
int cnt=0;
for (String ref : line) {
if( isExistSeachByBinary(seqS, Integer.parseInt(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,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
17,
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,
20,
13,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
41,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
18,
13,
13,
17,
0,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
0,
13,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
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
],
[
238,
14
],
[
238,
15
],
[
15,
16
],
[
15,
17
],
[
238,
18
],
[
18,
19
],
[
18,
20
],
[
238,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
27,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
27,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
40,
49
],
[
49,
50
],
[
49,
51
],
[
40,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
55,
60
],
[
40,
61
],
[
61,
62
],
[
61,
63
],
[
40,
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
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
40,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
96,
97
],
[
40,
98
],
[
98,
99
],
[
98,
100
],
[
40,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
104,
109
],
[
40,
110
],
[
110,
111
],
[
110,
112
],
[
40,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
114,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
136,
138
],
[
40,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
40,
143
],
[
143,
144
],
[
143,
145
],
[
40,
146
],
[
146,
147
],
[
146,
148
],
[
40,
149
],
[
149,
150
],
[
40,
151
],
[
151,
152
],
[
40,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
153,
163
],
[
163,
164
],
[
164,
165
],
[
153,
166
],
[
167,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
167,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
167,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
188,
192
],
[
192,
193
],
[
192,
194
],
[
187,
195
],
[
195,
196
],
[
196,
197
],
[
195,
198
],
[
198,
199
],
[
198,
200
],
[
195,
201
],
[
187,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
203,
207
],
[
207,
208
],
[
207,
209
],
[
202,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
213,
215
],
[
202,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
219,
221
],
[
186,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
225,
226
],
[
225,
227
],
[
224,
228
],
[
40,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
231,
233
],
[
229,
234
],
[
21,
235
],
[
235,
236
],
[
0,
237
],
[
237,
238
],
[
237,
239
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\npublic class Main {\n\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tString input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\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.Arrays;",
"Arrays",
"java.util",
"public class Main {\n\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tString input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"Main",
"public static final int BIG_NUM = 2000000000;",
"BIG_NUM",
"2000000000",
"public static final int MOD = 1000000007;",
"MOD",
"1000000007",
"public static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tString input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"main",
"{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tString input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"try {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tString input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"NumberFormatException e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"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 input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t}",
"int N = Integer.parseInt(br.readLine());",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String input[] = new String[N];",
"input",
"new String[N]",
"N",
"input = br.readLine().split(\"\\\\s+\")",
"input",
"br.readLine().split(\"\\\\s+\")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\"\\\\s+\"",
"int S[] = new int[N];",
"S",
"new int[N]",
"N",
"for(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < input.length",
"i",
"input.length",
"input",
"input.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}",
"{\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}",
"S[i] = Integer.parseInt(input[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"int Q = Integer.parseInt(br.readLine());",
"Q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String inputQ[] = new String[Q];",
"inputQ",
"new String[Q]",
"Q",
"inputQ = br.readLine().split(\"\\\\s+\")",
"inputQ",
"br.readLine().split(\"\\\\s+\")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\"\\\\s+\"",
"int T[] = new int[Q];",
"T",
"new int[Q]",
"Q",
"for(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < inputQ.length",
"i",
"inputQ.length",
"inputQ",
"inputQ.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}",
"{\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}",
"T[i] = Integer.parseInt(inputQ[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(inputQ[i])",
"Integer.parseInt",
"Integer",
"inputQ[i]",
"inputQ",
"i",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int ans = 0;",
"ans",
"0",
"int left = 0",
"left",
"0",
"right",
"right",
"m;",
"m",
"for(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\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\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}",
"right = S.length-1",
"right",
"S.length-1",
"S.length",
"S",
"S.length",
"1",
"m = (left+right)/2",
"m",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"while(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}",
"if(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}",
"S[m] == T[i]",
"S[m]",
"S",
"m",
"T[i]",
"T",
"i",
"{\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"ans++",
"ans",
"left = m",
"left",
"m",
"break;",
"if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}",
"S[m] > T[i]",
"S[m]",
"S",
"m",
"T[i]",
"T",
"i",
"{\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}",
"right = m-1",
"right",
"m-1",
"m",
"1",
"{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}",
"left = m+1",
"left",
"m+1",
"m",
"1",
"m = (left+right)/2",
"m",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tString input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tString input[] = new String[N];\n\t\t\tinput = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint S[] = new int[N];\n\t\t\tfor(int i = 0; i < input.length; i++){\n\t\t\t\tS[i] = Integer.parseInt(input[i]);\n\t\t\t}\n\n\t\t\tint Q = Integer.parseInt(br.readLine());\n\t\t\tString inputQ[] = new String[Q];\n\t\t\tinputQ = br.readLine().split(\"\\\\s+\");\n\n\t\t\tint T[] = new int[Q];\n\t\t\tfor(int i = 0; i < inputQ.length; i++){\n\t\t\t\tT[i] = Integer.parseInt(inputQ[i]);\n\t\t\t}\n\n\t\t\tArrays.sort(T);\n\n\t\t\tint ans = 0;\n\t\t\tint left = 0,right,m;\n\n\t\t\tfor(int i = 0; i < T.length; i++){\n\t\t\t\tright = S.length-1;\n\t\t\t\tm = (left+right)/2;\n\n\t\t\t\twhile(left <= right){\n\t\t\t\t\tif(S[m] == T[i]){\n\t\t\t\t\t\tans++;\n\t\t\t\t\t\tleft = m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(S[m] > T[i]){\n\t\t\t\t\t\tright = m-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = m+1;\n\t\t\t\t\t}\n\t\t\t\t\tm = (left+right)/2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\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 final int BIG_NUM = 2000000000;
public static final int MOD = 1000000007;
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
int N = Integer.parseInt(br.readLine());
String input[] = new String[N];
input = br.readLine().split("\\s+");
int S[] = new int[N];
for(int i = 0; i < input.length; i++){
S[i] = Integer.parseInt(input[i]);
}
int Q = Integer.parseInt(br.readLine());
String inputQ[] = new String[Q];
inputQ = br.readLine().split("\\s+");
int T[] = new int[Q];
for(int i = 0; i < inputQ.length; i++){
T[i] = Integer.parseInt(inputQ[i]);
}
Arrays.sort(T);
int ans = 0;
int left = 0,right,m;
for(int i = 0; i < T.length; i++){
right = S.length-1;
m = (left+right)/2;
while(left <= right){
if(S[m] == T[i]){
ans++;
left = m;
break;
}else if(S[m] > T[i]){
right = m-1;
}else{
left = m+1;
}
m = (left+right)/2;
}
}
System.out.println(ans);
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
2,
17,
17,
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
13,
13,
18,
13,
13,
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,
17,
42,
2,
13,
13,
30,
41,
13,
4,
18,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
30,
29,
17,
30,
0,
13,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
160,
5
],
[
160,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
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
],
[
47,
48
],
[
46,
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
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
80,
87
],
[
79,
88
],
[
88,
89
],
[
89,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
6,
97
],
[
97,
98
],
[
160,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
101,
110
],
[
110,
111
],
[
110,
112
],
[
101,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
117,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
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
],
[
140,
146
],
[
146,
147
],
[
147,
148
],
[
140,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
101,
153
],
[
153,
154
],
[
99,
155
],
[
155,
156
],
[
99,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] | [
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n int count = 0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A = new int[100000 + 1];\n for(int i = 0; i<n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n int q = sc.nextInt();\n int[] Key = new int[100000];\n for(int i = 0; i < q; i++){\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }\n System.out.println(count);\n\n }\n\n public static int binarySearch(int[] A, int Key){\n int left = 0;\n int right = A.length;\n int YesNo = 0;\n while(left < right){\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }\n return YesNo;\n\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n int count = 0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A = new int[100000 + 1];\n for(int i = 0; i<n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n int q = sc.nextInt();\n int[] Key = new int[100000];\n for(int i = 0; i < q; i++){\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }\n System.out.println(count);\n\n }\n\n public static int binarySearch(int[] A, int Key){\n int left = 0;\n int right = A.length;\n int YesNo = 0;\n while(left < right){\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }\n return YesNo;\n\n }\n}",
"Main",
"public static void main(String[] args){\n int count = 0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A = new int[100000 + 1];\n for(int i = 0; i<n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n int q = sc.nextInt();\n int[] Key = new int[100000];\n for(int i = 0; i < q; i++){\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }\n System.out.println(count);\n\n }",
"main",
"{\n int count = 0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A = new int[100000 + 1];\n for(int i = 0; i<n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n int q = sc.nextInt();\n int[] Key = new int[100000];\n for(int i = 0; i < q; i++){\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }\n System.out.println(count);\n\n }",
"int count = 0;",
"count",
"0",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] A = new int[100000 + 1];",
"A",
"new int[100000 + 1]",
"100000 + 1",
"100000",
"1",
"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 q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] Key = new int[100000];",
"Key",
"new int[100000]",
"100000",
"for(int i = 0; i < q; i++){\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }",
"{\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }",
"Key[i] = sc.nextInt()",
"Key[i]",
"Key",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(binarySearch(A, Key[i]) == 1){\n count++;\n }",
"binarySearch(A, Key[i]) == 1",
"binarySearch(A, Key[i])",
"binarySearch",
"A",
"Key[i]",
"Key",
"i",
"1",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int binarySearch(int[] A, int Key){\n int left = 0;\n int right = A.length;\n int YesNo = 0;\n while(left < right){\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }\n return YesNo;\n\n }",
"binarySearch",
"{\n int left = 0;\n int right = A.length;\n int YesNo = 0;\n while(left < right){\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }\n return YesNo;\n\n }",
"int left = 0;",
"left",
"0",
"int right = A.length;",
"right",
"A.length",
"A",
"A.length",
"int YesNo = 0;",
"YesNo",
"0",
"while(left < right){\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }",
"int mid = (int)Math.ceil((left + right)/2);",
"mid",
"(int)Math.ceil((left + right)/2)",
"Math.ceil",
"Math",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }",
"Key > A[mid]",
"Key",
"A[mid]",
"A",
"mid",
"{\n left = mid + 1; //注意需要加一 因为是向下取整数\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }",
"Key == A[mid]",
"Key",
"A[mid]",
"A",
"mid",
"{\n return 1;\n }",
"return 1;",
"1",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"return YesNo;",
"YesNo",
"int[] A",
"A",
"int Key",
"Key",
"public class Main{\n public static void main(String[] args){\n int count = 0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A = new int[100000 + 1];\n for(int i = 0; i<n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n int q = sc.nextInt();\n int[] Key = new int[100000];\n for(int i = 0; i < q; i++){\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }\n System.out.println(count);\n\n }\n\n public static int binarySearch(int[] A, int Key){\n int left = 0;\n int right = A.length;\n int YesNo = 0;\n while(left < right){\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }\n return YesNo;\n\n }\n}",
"public class Main{\n public static void main(String[] args){\n int count = 0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A = new int[100000 + 1];\n for(int i = 0; i<n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n int q = sc.nextInt();\n int[] Key = new int[100000];\n for(int i = 0; i < q; i++){\n Key[i] = sc.nextInt();\n if(binarySearch(A, Key[i]) == 1){\n count++;\n }\n }\n System.out.println(count);\n\n }\n\n public static int binarySearch(int[] A, int Key){\n int left = 0;\n int right = A.length;\n int YesNo = 0;\n while(left < right){\n int mid = (int)Math.ceil((left + right)/2);\n if(Key > A[mid]){\n left = mid + 1; //注意需要加一 因为是向下取整数\n }else if(Key == A[mid]){\n return 1;\n }else{\n right = mid;\n }\n }\n return YesNo;\n\n }\n}",
"Main"
] | import java.util.*;
public class Main{
public static void main(String[] args){
int count = 0;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] A = new int[100000 + 1];
for(int i = 0; i<n; i++){
A[i] = sc.nextInt();
}
Arrays.sort(A);
int q = sc.nextInt();
int[] Key = new int[100000];
for(int i = 0; i < q; i++){
Key[i] = sc.nextInt();
if(binarySearch(A, Key[i]) == 1){
count++;
}
}
System.out.println(count);
}
public static int binarySearch(int[] A, int Key){
int left = 0;
int right = A.length;
int YesNo = 0;
while(left < right){
int mid = (int)Math.ceil((left + right)/2);
if(Key > A[mid]){
left = mid + 1; //注意需要加一 因为是向下取整数
}else if(Key == A[mid]){
return 1;
}else{
right = mid;
}
}
return YesNo;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
4,
18,
13,
41,
13,
20,
28,
13,
4,
18,
4,
18,
13,
17,
30,
30,
4,
18,
13,
13,
17,
4,
18,
13,
41,
13,
17,
28,
13,
4,
18,
4,
18,
13,
17,
30,
30,
14,
4,
18,
13,
13,
30,
0,
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
],
[
75,
11
],
[
75,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
21,
22
],
[
16,
23
],
[
23,
24
],
[
23,
25
],
[
16,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
26,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
36,
40
],
[
16,
41
],
[
41,
42
],
[
42,
43
],
[
16,
44
],
[
44,
45
],
[
44,
46
],
[
16,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
49,
54
],
[
47,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
57,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
16,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
12,
72
],
[
72,
73
],
[
0,
74
],
[
74,
75
],
[
74,
76
]
] | [
"import java.util.HashMap;\nimport java.util.Map;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n try (Scanner scan = new Scanner(System.in)) {\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }\n\n }\n\n}\n",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n\n try (Scanner scan = new Scanner(System.in)) {\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }\n\n }\n\n}",
"Main",
"public static void main(String[] args) {\n\n try (Scanner scan = new Scanner(System.in)) {\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }\n\n }",
"main",
"{\n\n try (Scanner scan = new Scanner(System.in)) {\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }\n\n }",
"try (Scanner scan = new Scanner(System.in)) {\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }",
"{\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }",
"Scanner scan = new Scanner(System.in)",
"Scanner scan = new Scanner(System.in)",
"new Scanner(System.in)",
"scan.nextLine()",
"scan.nextLine",
"scan",
"Map<String, String> map = new HashMap<String, String>();",
"map",
"new HashMap<String, String>()",
"for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }",
"String num",
"scan.nextLine().split(\" \")",
"scan.nextLine().split",
"scan.nextLine()",
"scan.nextLine",
"scan",
"\" \"",
"{\n map.put(num, \"\");\n }",
"{\n map.put(num, \"\");\n }",
"map.put(num, \"\")",
"map.put",
"map",
"num",
"\"\"",
"scan.nextLine()",
"scan.nextLine",
"scan",
"int count = 0;",
"count",
"0",
"for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }",
"String num",
"scan.nextLine().split(\" \")",
"scan.nextLine().split",
"scan.nextLine()",
"scan.nextLine",
"scan",
"\" \"",
"{\n if (map.containsKey(num)) {\n count += 1;\n }\n }",
"{\n if (map.containsKey(num)) {\n count += 1;\n }\n }",
"if (map.containsKey(num)) {\n count += 1;\n }",
"map.containsKey(num)",
"map.containsKey",
"map",
"num",
"{\n count += 1;\n }",
"count += 1",
"count",
"1",
"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\n try (Scanner scan = new Scanner(System.in)) {\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }\n\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n\n try (Scanner scan = new Scanner(System.in)) {\n // スキップ\n scan.nextLine();\n\n // 検索対象をmapに格納する\n Map<String, String> map = new HashMap<String, String>();\n for (String num : scan.nextLine().split(\" \")) {\n map.put(num, \"\");\n }\n\n // スキップ\n scan.nextLine();\n\n // 検索対象が存在する場合はカウントする\n int count = 0;\n for (String num : scan.nextLine().split(\" \")) {\n if (map.containsKey(num)) {\n count += 1;\n }\n }\n\n System.out.println(count);\n }\n\n }\n\n}",
"Main"
] | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner scan = new Scanner(System.in)) {
// スキップ
scan.nextLine();
// 検索対象をmapに格納する
Map<String, String> map = new HashMap<String, String>();
for (String num : scan.nextLine().split(" ")) {
map.put(num, "");
}
// スキップ
scan.nextLine();
// 検索対象が存在する場合はカウントする
int count = 0;
for (String num : scan.nextLine().split(" ")) {
if (map.containsKey(num)) {
count += 1;
}
}
System.out.println(count);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
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,
2,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
13,
14,
2,
4,
13,
13,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
0,
18,
13,
13,
13,
42,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
13,
13,
30,
29,
13,
29,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
137,
5
],
[
137,
6
],
[
6,
7
],
[
6,
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
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
11,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
11,
51
],
[
51,
52
],
[
51,
53
],
[
54,
55
],
[
54,
56
],
[
11,
57
],
[
57,
58
],
[
57,
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
],
[
72,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
72,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
85,
88
],
[
85,
89
],
[
84,
90
],
[
83,
91
],
[
91,
92
],
[
11,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
9,
99
],
[
99,
100
],
[
137,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
103,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
112,
118
],
[
118,
119
],
[
119,
120
],
[
103,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
103,
128
],
[
128,
129
],
[
101,
130
],
[
130,
131
],
[
101,
132
],
[
132,
133
],
[
101,
134
],
[
134,
135
],
[
0,
136
],
[
136,
137
],
[
136,
138
]
] | [
"import java.util.*;\n\npublic class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n + 1];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q + 1];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int linearSearch(int n, int[] arr, int key) {\n int i = 0;\n arr[n] = key;\n while (arr[i] != key) {\n i++;\n }\n if (i == n) {\n return NOT_FOUND;\n }\n return i;\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n + 1];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q + 1];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int linearSearch(int n, int[] arr, int key) {\n int i = 0;\n arr[n] = key;\n while (arr[i] != key) {\n i++;\n }\n if (i == n) {\n return NOT_FOUND;\n }\n return i;\n }\n}",
"Main",
"static int NOT_FOUND = 99999999;",
"NOT_FOUND",
"99999999",
"public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n + 1];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q + 1];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n + 1];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q + 1];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) 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[] sArr = new int[n + 1];",
"sArr",
"new int[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n sArr[i] = sc.nextInt();\n }",
"{\n sArr[i] = sc.nextInt();\n }",
"sArr[i] = sc.nextInt()",
"sArr[i]",
"sArr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] tArr = new int[q + 1];",
"tArr",
"new int[q + 1]",
"q + 1",
"q",
"1",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }",
"{\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"tArr[i] = x",
"tArr[i]",
"tArr",
"i",
"x",
"if (linearSearch(n, sArr, x) != NOT_FOUND) count++;",
"linearSearch(n, sArr, x) != NOT_FOUND",
"linearSearch(n, sArr, x)",
"linearSearch",
"n",
"sArr",
"x",
"NOT_FOUND",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int linearSearch(int n, int[] arr, int key) {\n int i = 0;\n arr[n] = key;\n while (arr[i] != key) {\n i++;\n }\n if (i == n) {\n return NOT_FOUND;\n }\n return i;\n }",
"linearSearch",
"{\n int i = 0;\n arr[n] = key;\n while (arr[i] != key) {\n i++;\n }\n if (i == n) {\n return NOT_FOUND;\n }\n return i;\n }",
"int i = 0;",
"i",
"0",
"arr[n] = key",
"arr[n]",
"arr",
"n",
"key",
"while (arr[i] != key) {\n i++;\n }",
"arr[i] != key",
"arr[i]",
"arr",
"i",
"key",
"{\n i++;\n }",
"i++",
"i",
"if (i == n) {\n return NOT_FOUND;\n }",
"i == n",
"i",
"n",
"{\n return NOT_FOUND;\n }",
"return NOT_FOUND;",
"NOT_FOUND",
"return i;",
"i",
"int n",
"n",
"int[] arr",
"arr",
"int key",
"key",
"public class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n + 1];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q + 1];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int linearSearch(int n, int[] arr, int key) {\n int i = 0;\n arr[n] = key;\n while (arr[i] != key) {\n i++;\n }\n if (i == n) {\n return NOT_FOUND;\n }\n return i;\n }\n}",
"public class Main {\n\n static int NOT_FOUND = 99999999;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] sArr = new int[n + 1];\n for (int i = 0; i < n; i++) {\n sArr[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] tArr = new int[q + 1];\n int count = 0;\n for (int i = 0; i < q; i++) {\n int x = sc.nextInt();\n tArr[i] = x;\n if (linearSearch(n, sArr, x) != NOT_FOUND) count++;\n }\n System.out.println(count);\n }\n\n public static int linearSearch(int n, int[] arr, int key) {\n int i = 0;\n arr[n] = key;\n while (arr[i] != key) {\n i++;\n }\n if (i == n) {\n return NOT_FOUND;\n }\n return i;\n }\n}",
"Main"
] | import java.util.*;
public class Main {
static int NOT_FOUND = 99999999;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] sArr = new int[n + 1];
for (int i = 0; i < n; i++) {
sArr[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] tArr = new int[q + 1];
int count = 0;
for (int i = 0; i < q; i++) {
int x = sc.nextInt();
tArr[i] = x;
if (linearSearch(n, sArr, x) != NOT_FOUND) count++;
}
System.out.println(count);
}
public static int linearSearch(int n, int[] arr, int key) {
int i = 0;
arr[n] = key;
while (arr[i] != key) {
i++;
}
if (i == n) {
return NOT_FOUND;
}
return i;
}
}
|
[
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,
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,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
37,
20,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
341,
11
],
[
341,
12
],
[
12,
13
],
[
12,
14
],
[
341,
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
],
[
54,
57
],
[
57,
58
],
[
58,
59
],
[
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
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
77,
81
],
[
18,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
16,
88
],
[
88,
89
],
[
0,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
97,
98
],
[
97,
99
],
[
90,
101
],
[
101,
102
],
[
101,
103
],
[
90,
104
],
[
104,
105
],
[
104,
106
],
[
90,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
110,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
121,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
117,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
140,
141
],
[
109,
142
],
[
142,
143
],
[
90,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
147,
155
],
[
155,
156
],
[
156,
157
],
[
90,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
166,
168
],
[
158,
169
],
[
169,
170
],
[
90,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
181,
183
],
[
174,
184
],
[
184,
185
],
[
173,
186
],
[
186,
187
],
[
187,
188
],
[
90,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
192,
196
],
[
196,
197
],
[
191,
198
],
[
198,
199
],
[
198,
200
],
[
191,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
191,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
210,
213
],
[
209,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
191,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
90,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
225,
229
],
[
229,
230
],
[
224,
231
],
[
231,
232
],
[
231,
233
],
[
224,
234
],
[
234,
235
],
[
234,
236
],
[
224,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
224,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
241,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
245,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
224,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
258,
259
],
[
258,
260
],
[
253,
261
],
[
261,
262
],
[
262,
263
],
[
224,
264
],
[
264,
265
],
[
264,
266
],
[
266,
267
],
[
267,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
268,
272
],
[
272,
273
],
[
272,
274
],
[
267,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
275,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
281,
283
],
[
267,
284
],
[
284,
285
],
[
285,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
285,
290
],
[
290,
291
],
[
291,
292
],
[
291,
293
],
[
284,
294
],
[
294,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
296,
300
],
[
284,
301
],
[
301,
302
],
[
302,
303
],
[
266,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
90,
308
],
[
308,
309
],
[
308,
310
],
[
310,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
310,
315
],
[
315,
316
],
[
316,
317
],
[
317,
318
],
[
317,
319
],
[
319,
320
],
[
319,
321
],
[
316,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
324,
326
],
[
315,
327
],
[
327,
328
],
[
310,
329
],
[
329,
330
],
[
90,
331
],
[
331,
332
],
[
331,
333
],
[
333,
334
],
[
334,
335
],
[
335,
336
],
[
336,
337
],
[
335,
338
],
[
338,
339
],
[
0,
340
],
[
340,
341
],
[
340,
342
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tFastScanner sc = new FastScanner();\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\t\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.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tFastScanner sc = new FastScanner();\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\t\n}",
"Main",
"static int[] boo = new int[100000];",
"boo",
"new int[100000]",
"100000",
"public static void main(String[] args)throws Exception{\n\t\tFastScanner sc = new FastScanner();\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\tFastScanner sc = new FastScanner();\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}",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"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",
"class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n 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}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"hasNextByte",
"{\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr < buflen",
"ptr",
"buflen",
"{\n return true;\n }",
"return true;",
"true",
"{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr = 0",
"ptr",
"0",
"try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}",
"readByte",
"{ if (hasNextByte()) return buffer[ptr++]; else return -1;}",
"if (hasNextByte()) return buffer[ptr++]; else return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}",
"isPrintableChar",
"{ return 33 <= c && c <= 126;}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}",
"hasNext",
"{ while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}",
"while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"next",
"{\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n sb.appendCodePoint(b);\n b = readByte();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"nextLong",
"{\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n minus = true;\n b = readByte();\n }",
"b == '-'",
"b",
"'-'",
"{\n minus = true;\n b = readByte();\n }",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"true",
"{\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n n *= 10;\n n += b - '0';\n }",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n return minus ? -n : n;\n }",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();",
"nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE",
"nl < Integer.MIN_VALUE",
"nl",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"nl > Integer.MAX_VALUE",
"nl",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public double nextDouble() { return Double.parseDouble(next());}",
"nextDouble",
"{ return Double.parseDouble(next());}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tFastScanner sc = new FastScanner();\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\t\n}",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tFastScanner sc = new FastScanner();\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\t\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
public class Main {
static int[] boo = new int[100000];
public static void main(String[] args)throws Exception{
FastScanner sc = new FastScanner();
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);
}
}
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,
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,
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,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
163,
5
],
[
163,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
87,
90
],
[
90,
91
],
[
90,
92
],
[
86,
93
],
[
93,
94
],
[
94,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
163,
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
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
129,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
138,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
138,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
106,
156
],
[
156,
157
],
[
104,
158
],
[
158,
159
],
[
104,
160
],
[
160,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tint length = in.nextInt();\n\t\tint[] string = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tstring[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlength = in.nextInt();\n\t\tint[] search = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static boolean Search(int[] list, int n)\n\t{\n\t\tint start = 0;\n\t\tint end = list.length - 1;\n\t\twhile(start <= end)\n\t\t{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n}\n\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tint length = in.nextInt();\n\t\tint[] string = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tstring[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlength = in.nextInt();\n\t\tint[] search = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static boolean Search(int[] list, int n)\n\t{\n\t\tint start = 0;\n\t\tint end = list.length - 1;\n\t\twhile(start <= end)\n\t\t{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n}",
"Main",
"public static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tint length = in.nextInt();\n\t\tint[] string = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tstring[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlength = in.nextInt();\n\t\tint[] search = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tint length = in.nextInt();\n\t\tint[] string = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tstring[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlength = in.nextInt();\n\t\tint[] search = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int length = in.nextInt();",
"length",
"in.nextInt()",
"in.nextInt",
"in",
"int[] string = new int[length];",
"string",
"new int[length]",
"length",
"for(int i = 0; i < length; i++)\n\t\t{\n\t\t\tstring[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < length",
"i",
"length",
"i++",
"i++",
"i",
"{\n\t\t\tstring[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tstring[i] = in.nextInt();\n\t\t}",
"string[i] = in.nextInt()",
"string[i]",
"string",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"length = in.nextInt()",
"length",
"in.nextInt()",
"in.nextInt",
"in",
"int[] search = new int[length];",
"search",
"new int[length]",
"length",
"for(int i = 0; i < length; i++)\n\t\t{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < length",
"i",
"length",
"i++",
"i++",
"i",
"{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}",
"search[i] = in.nextInt()",
"search[i]",
"search",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < length; i++)\n\t\t{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < length",
"i",
"length",
"i++",
"i++",
"i",
"{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"if(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}",
"Search(string, search[i])",
"Search",
"string",
"search[i]",
"search",
"i",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static boolean Search(int[] list, int n)\n\t{\n\t\tint start = 0;\n\t\tint end = list.length - 1;\n\t\twhile(start <= end)\n\t\t{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}",
"Search",
"{\n\t\tint start = 0;\n\t\tint end = list.length - 1;\n\t\twhile(start <= end)\n\t\t{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}",
"int start = 0;",
"start",
"0",
"int end = list.length - 1;",
"end",
"list.length - 1",
"list.length",
"list",
"list.length",
"1",
"while(start <= end)\n\t\t{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}",
"start <= end",
"start",
"end",
"{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}",
"int mid = ((start + end) / 2);",
"mid",
"((start + end) / 2)",
"(start + end)",
"start",
"end",
"2",
"if(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}",
"list[mid] == n",
"list[mid]",
"list",
"mid",
"n",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}",
"list[mid] > n",
"list[mid]",
"list",
"mid",
"n",
"{\n\t\t\t\tend = mid - 1;\n\t\t\t}",
"end = mid - 1",
"end",
"mid - 1",
"mid",
"1",
"{\n\t\t\t\tstart = mid + 1;\n\t\t\t}",
"start = mid + 1",
"start",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] list",
"list",
"int n",
"n",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tint length = in.nextInt();\n\t\tint[] string = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tstring[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlength = in.nextInt();\n\t\tint[] search = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static boolean Search(int[] list, int n)\n\t{\n\t\tint start = 0;\n\t\tint end = list.length - 1;\n\t\twhile(start <= end)\n\t\t{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tint length = in.nextInt();\n\t\tint[] string = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tstring[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlength = in.nextInt();\n\t\tint[] search = new int[length];\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tsearch[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0;\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tif(Search(string, search[i]))\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static boolean Search(int[] list, int n)\n\t{\n\t\tint start = 0;\n\t\tint end = list.length - 1;\n\t\twhile(start <= end)\n\t\t{\n\t\t\tint mid = ((start + end) / 2);\n\t\t\n\t\t\tif(list[mid] == n)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t} else if (list[mid] > n) {\n\t\t\t\tend = mid - 1;\n\t\t\t}else {\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int length = in.nextInt();
int[] string = new int[length];
for(int i = 0; i < length; i++)
{
string[i] = in.nextInt();
}
length = in.nextInt();
int[] search = new int[length];
for(int i = 0; i < length; i++)
{
search[i] = in.nextInt();
}
int count = 0;
for(int i = 0; i < length; i++)
{
if(Search(string, search[i]))
{
count++;
}
}
System.out.println(count);
}
public static boolean Search(int[] list, int n)
{
int start = 0;
int end = list.length - 1;
while(start <= end)
{
int mid = ((start + end) / 2);
if(list[mid] == n)
{
return true;
} else if (list[mid] > n) {
end = mid - 1;
}else {
start = mid + 1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
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,
41,
13,
18,
13,
13,
41,
13,
40,
17,
41,
13,
18,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
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
],
[
149,
5
],
[
149,
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
],
[
87,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
87,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
87,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
116,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
116,
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
],
[
8,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
6,
146
],
[
146,
147
],
[
0,
148
],
[
148,
149
],
[
148,
150
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n]; \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\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\tint count = 0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n]; \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\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\tint count = 0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n]; \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\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\tint count = 0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n]; \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\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\tint count = 0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"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 count = 0;",
"count",
"0",
"for (int i = 0; i < T.length; i++) {\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.length",
"i",
"T.length",
"T",
"T.length",
"i++",
"i++",
"i",
"{\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int t = T[i];",
"t",
"T[i]",
"T",
"i",
"int l = -1;",
"l",
"-1",
"1",
"int u = S.length;",
"u",
"S.length",
"S",
"S.length",
"while(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}",
"u - l > 1",
"u - l",
"u",
"l",
"1",
"{\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}",
"int m = (u + l) / 2;",
"m",
"(u + l) / 2",
"(u + l)",
"u",
"l",
"2",
"if(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}",
"t == S[m]",
"t",
"S[m]",
"S",
"m",
"{ \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}",
"t < S[m]",
"t",
"S[m]",
"S",
"m",
"{\n\t\t\t\t\tu = m;\n\t\t\t\t}",
"u = m",
"u",
"m",
"{\n\t\t\t\t\tl = m;\n\t\t\t\t}",
"l = m",
"l",
"m",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"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\t\tint[] S = new int[n]; \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\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\tint count = 0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n]; \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\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\tint count = 0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint t = T[i];\n\t\t\t\n\t\t\tint l = -1;\n\t\t\tint u = S.length;\n\t\t\twhile(u - l > 1) {\n\t\t\t\tint m = (u + l) / 2;\t\n\t\t\t\tif(t == S[m]) { \n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (t < S[m]) {\n\t\t\t\t\tu = m;\n\t\t\t\t} else {\n\t\t\t\t\tl = m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] T = new int[q];
for (int i = 0; i < q; i++) {
T[i] = sc.nextInt();
}
int count = 0;
for (int i = 0; i < T.length; i++) {
int t = T[i];
int l = -1;
int u = S.length;
while(u - l > 1) {
int m = (u + l) / 2;
if(t == S[m]) {
count++;
break;
} else if (t < S[m]) {
u = m;
} else {
l = m;
}
}
}
System.out.println(count);
}
} |
[
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,
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,
41,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
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
],
[
430,
11
],
[
430,
12
],
[
12,
13
],
[
12,
14
],
[
430,
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
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
17,
52
],
[
52,
53
],
[
52,
54
],
[
17,
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
],
[
17,
76
],
[
76,
77
],
[
76,
78
],
[
17,
79
],
[
79,
80
],
[
17,
81
],
[
81,
82
],
[
17,
83
],
[
83,
84
],
[
17,
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
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
97,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
116,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
128,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
140,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
17,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
15,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
160,
164
],
[
164,
165
],
[
164,
166
],
[
160,
168
],
[
168,
169
],
[
168,
170
],
[
160,
171
],
[
171,
172
],
[
171,
173
],
[
160,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
174,
182
],
[
182,
183
],
[
160,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
191,
192
],
[
192,
193
],
[
187,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
194,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
198,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
208,
211
],
[
194,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
212,
216
],
[
216,
217
],
[
217,
218
],
[
186,
219
],
[
219,
220
],
[
160,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
224,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
224,
232
],
[
232,
233
],
[
233,
234
],
[
160,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
240,
242
],
[
239,
243
],
[
243,
244
],
[
243,
245
],
[
235,
246
],
[
246,
247
],
[
160,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
252,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
258,
259
],
[
258,
260
],
[
251,
261
],
[
261,
262
],
[
250,
263
],
[
263,
264
],
[
264,
265
],
[
160,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
269,
273
],
[
273,
274
],
[
268,
275
],
[
275,
276
],
[
275,
277
],
[
268,
278
],
[
278,
279
],
[
278,
280
],
[
280,
281
],
[
268,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
286,
287
],
[
287,
288
],
[
288,
289
],
[
287,
290
],
[
286,
291
],
[
291,
292
],
[
291,
293
],
[
293,
294
],
[
268,
295
],
[
295,
296
],
[
296,
297
],
[
297,
298
],
[
160,
299
],
[
299,
300
],
[
299,
301
],
[
301,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
302,
306
],
[
306,
307
],
[
301,
308
],
[
308,
309
],
[
308,
310
],
[
301,
311
],
[
311,
312
],
[
311,
313
],
[
301,
314
],
[
314,
315
],
[
314,
316
],
[
316,
317
],
[
301,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
318,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
322,
326
],
[
326,
327
],
[
326,
328
],
[
328,
329
],
[
301,
330
],
[
330,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
331,
335
],
[
335,
336
],
[
335,
337
],
[
330,
338
],
[
338,
339
],
[
339,
340
],
[
301,
341
],
[
341,
342
],
[
341,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
346,
347
],
[
346,
348
],
[
345,
349
],
[
349,
350
],
[
349,
351
],
[
344,
352
],
[
352,
353
],
[
353,
354
],
[
353,
355
],
[
352,
356
],
[
356,
357
],
[
356,
358
],
[
358,
359
],
[
358,
360
],
[
344,
361
],
[
361,
362
],
[
362,
363
],
[
363,
364
],
[
363,
365
],
[
365,
366
],
[
362,
367
],
[
367,
368
],
[
368,
369
],
[
368,
370
],
[
361,
371
],
[
371,
372
],
[
372,
373
],
[
373,
374
],
[
373,
375
],
[
375,
376
],
[
373,
377
],
[
361,
378
],
[
378,
379
],
[
379,
380
],
[
343,
381
],
[
381,
382
],
[
381,
383
],
[
383,
384
],
[
160,
385
],
[
385,
386
],
[
385,
387
],
[
387,
388
],
[
388,
389
],
[
388,
390
],
[
390,
391
],
[
387,
392
],
[
392,
393
],
[
393,
394
],
[
394,
395
],
[
394,
396
],
[
396,
397
],
[
396,
398
],
[
393,
399
],
[
399,
400
],
[
399,
401
],
[
401,
402
],
[
401,
403
],
[
392,
404
],
[
404,
405
],
[
387,
406
],
[
406,
407
],
[
160,
408
],
[
408,
409
],
[
408,
410
],
[
410,
411
],
[
411,
412
],
[
412,
413
],
[
413,
414
],
[
412,
415
],
[
415,
416
],
[
160,
417
],
[
417,
418
],
[
417,
419
],
[
419,
420
],
[
420,
421
],
[
421,
422
],
[
421,
423
],
[
420,
424
],
[
424,
425
],
[
425,
426
],
[
426,
427
],
[
160,
428
],
[
0,
429
],
[
429,
430
],
[
429,
431
]
] | [
"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[] array = new int[n];\n\t\tfor (int i=0; i<n; i++) {array[i] = sc.nextInt();}\n\t\t\n\t\tint m = sc.nextInt();\n\t\tint[] element = new int[m];\n\t\tfor (int i=0; i<m; i++) {element[i] = sc.nextInt();}\n\t\t\n\t\tint num = 0, L, R, M;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(num);\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[] array = new int[n];\n\t\tfor (int i=0; i<n; i++) {array[i] = sc.nextInt();}\n\t\t\n\t\tint m = sc.nextInt();\n\t\tint[] element = new int[m];\n\t\tfor (int i=0; i<m; i++) {element[i] = sc.nextInt();}\n\t\t\n\t\tint num = 0, L, R, M;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(num);\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[] array = new int[n];\n\t\tfor (int i=0; i<n; i++) {array[i] = sc.nextInt();}\n\t\t\n\t\tint m = sc.nextInt();\n\t\tint[] element = new int[m];\n\t\tfor (int i=0; i<m; i++) {element[i] = sc.nextInt();}\n\t\t\n\t\tint num = 0, L, R, M;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(num);\n\t}",
"main",
"{\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tfor (int i=0; i<n; i++) {array[i] = sc.nextInt();}\n\t\t\n\t\tint m = sc.nextInt();\n\t\tint[] element = new int[m];\n\t\tfor (int i=0; i<m; i++) {element[i] = sc.nextInt();}\n\t\t\n\t\tint num = 0, L, R, M;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(num);\n\t}",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"for (int i=0; i<n; i++) {array[i] = sc.nextInt();}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{array[i] = sc.nextInt();}",
"{array[i] = sc.nextInt();}",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] element = new int[m];",
"element",
"new int[m]",
"m",
"for (int i=0; i<m; i++) {element[i] = sc.nextInt();}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<m",
"i",
"m",
"i++",
"i++",
"i",
"{element[i] = sc.nextInt();}",
"{element[i] = sc.nextInt();}",
"element[i] = sc.nextInt()",
"element[i]",
"element",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int num = 0",
"num",
"0",
"L",
"L",
"R",
"R",
"M;",
"M",
"for (int i=0; i<m; i++) {\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}",
"{\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}",
"L = 0",
"L",
"0",
"R = n",
"R",
"n",
"while (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}",
"L < R",
"L",
"R",
"{\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}",
"M = (L+R)/2",
"M",
"(L+R)/2",
"(L+R)",
"L",
"R",
"2",
"if (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}",
"array[M] == element[i]",
"array[M]",
"array",
"M",
"element[i]",
"element",
"i",
"{num++; break;}",
"num++",
"num",
"break;",
"if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}",
"array[M] > element[i]",
"array[M]",
"array",
"M",
"element[i]",
"element",
"i",
"{R = M;}",
"R = M",
"R",
"M",
"if (array[M] < element[i]) {L = M+1;}",
"array[M] < element[i]",
"array[M]",
"array",
"M",
"element[i]",
"element",
"i",
"{L = M+1;}",
"L = M+1",
"L",
"M+1",
"M",
"1",
"out.println(num)",
"out.println",
"out",
"num",
"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[] array = new int[n];\n\t\tfor (int i=0; i<n; i++) {array[i] = sc.nextInt();}\n\t\t\n\t\tint m = sc.nextInt();\n\t\tint[] element = new int[m];\n\t\tfor (int i=0; i<m; i++) {element[i] = sc.nextInt();}\n\t\t\n\t\tint num = 0, L, R, M;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(num);\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[] array = new int[n];\n\t\tfor (int i=0; i<n; i++) {array[i] = sc.nextInt();}\n\t\t\n\t\tint m = sc.nextInt();\n\t\tint[] element = new int[m];\n\t\tfor (int i=0; i<m; i++) {element[i] = sc.nextInt();}\n\t\t\n\t\tint num = 0, L, R, M;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tL = 0;\n\t\t\tR = n;\n\t\t\twhile (L < R) {\n\t\t\t\tM = (L+R)/2;\n\t\t\t\tif (array[M] == element[i]) {num++; break;}\n\t\t\t\telse if (array[M] > element[i]) {R = M;}\n\t\t\t\telse if (array[M] < element[i]) {L = M+1;}\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(num);\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[] array = new int[n];
for (int i=0; i<n; i++) {array[i] = sc.nextInt();}
int m = sc.nextInt();
int[] element = new int[m];
for (int i=0; i<m; i++) {element[i] = sc.nextInt();}
int num = 0, L, R, M;
for (int i=0; i<m; i++) {
L = 0;
R = n;
while (L < R) {
M = (L+R)/2;
if (array[M] == element[i]) {num++; break;}
else if (array[M] > element[i]) {R = M;}
else if (array[M] < element[i]) {L = M+1;}
}
}
out.println(num);
}
}
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,
6,
13,
12,
13,
30,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
4,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
4,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
17,
2,
4,
18,
13,
17,
4,
18,
13,
30,
0,
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
],
[
9,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
13,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
22,
27
],
[
21,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
31,
33
],
[
21,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
35,
40
],
[
34,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
44,
46
],
[
34,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
6,
52
],
[
52,
53
],
[
6,
54
],
[
54,
55
],
[
6,
56
],
[
56,
57
],
[
6,
58
],
[
58,
59
],
[
4,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
62,
71
],
[
71,
72
],
[
71,
73
],
[
62,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
90,
91
],
[
91,
92
],
[
62,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
62,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
62,
102
],
[
102,
103
],
[
102,
104
],
[
62,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
105,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
119,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
123,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
118,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
62,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
60,
141
],
[
141,
142
]
] | [
"import java.util.*;\n\nclass Main {\n\n public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {\n while (left <= right) {\n int mid = (left + right) / 2;\n if (a.get(mid) < goal) {\n left = mid + 1;\n } else if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n ArrayList<Integer> s = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n Collections.sort(s);\n n = in.nextInt();\n int res = 0;\n for (int i = 0; i < n; i++) {\n if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }\n }\n System.out.println(res);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\n public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {\n while (left <= right) {\n int mid = (left + right) / 2;\n if (a.get(mid) < goal) {\n left = mid + 1;\n } else if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n ArrayList<Integer> s = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n Collections.sort(s);\n n = in.nextInt();\n int res = 0;\n for (int i = 0; i < n; i++) {\n if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }\n }\n System.out.println(res);\n }\n}",
"Main",
"public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {\n while (left <= right) {\n int mid = (left + right) / 2;\n if (a.get(mid) < goal) {\n left = mid + 1;\n } else if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n }",
"bsearch",
"{\n while (left <= right) {\n int mid = (left + right) / 2;\n if (a.get(mid) < goal) {\n left = mid + 1;\n } else if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n }",
"while (left <= right) {\n int mid = (left + right) / 2;\n if (a.get(mid) < goal) {\n left = mid + 1;\n } else if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }\n }",
"left <= right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (a.get(mid) < goal) {\n left = mid + 1;\n } else if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (a.get(mid) < goal) {\n left = mid + 1;\n } else if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }",
"a.get(mid) < goal",
"a.get(mid)",
"a.get",
"a",
"mid",
"goal",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if (a.get(mid) > goal) {\n right = mid - 1;\n } else {\n return true;\n }",
"a.get(mid) > goal",
"a.get(mid)",
"a.get",
"a",
"mid",
"goal",
"{\n right = mid - 1;\n }",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"{\n return true;\n }",
"return true;",
"true",
"return false;",
"false",
"ArrayList<Integer> a",
"a",
"int left",
"left",
"int right",
"right",
"int goal",
"goal",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n ArrayList<Integer> s = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n Collections.sort(s);\n n = in.nextInt();\n int res = 0;\n for (int i = 0; i < n; i++) {\n if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }\n }\n System.out.println(res);\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n ArrayList<Integer> s = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }\n Collections.sort(s);\n n = in.nextInt();\n int res = 0;\n for (int i = 0; i < n; i++) {\n if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }\n }\n System.out.println(res);\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"ArrayList<Integer> s = new ArrayList<>();",
"s",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n s.add(in.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s.add(in.nextInt());\n }",
"{\n s.add(in.nextInt());\n }",
"s.add(in.nextInt())",
"s.add",
"s",
"in.nextInt()",
"in.nextInt",
"in",
"Collections.sort(s)",
"Collections.sort",
"Collections",
"s",
"n = in.nextInt()",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int res = 0;",
"res",
"0",
"for (int i = 0; i < n; i++) {\n if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }\n }",
"{\n if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }\n }",
"if (bsearch(s, 0, s.size() - 1, in.nextInt())) {\n res += 1;\n }",
"bsearch(s, 0, s.size() - 1, in.nextInt())",
"bsearch",
"s",
"0",
"s.size() - 1",
"s.size()",
"s.size",
"s",
"1",
"in.nextInt()",
"in.nextInt",
"in",
"{\n res += 1;\n }",
"res += 1",
"res",
"1",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args"
] | import java.util.*;
class Main {
public static boolean bsearch(ArrayList<Integer> a, int left, int right, int goal) {
while (left <= right) {
int mid = (left + right) / 2;
if (a.get(mid) < goal) {
left = mid + 1;
} else if (a.get(mid) > goal) {
right = mid - 1;
} else {
return true;
}
}
return false;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
ArrayList<Integer> s = new ArrayList<>();
for (int i = 0; i < n; i++) {
s.add(in.nextInt());
}
Collections.sort(s);
n = in.nextInt();
int res = 0;
for (int i = 0; i < n; i++) {
if (bsearch(s, 0, s.size() - 1, in.nextInt())) {
res += 1;
}
}
System.out.println(res);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
40,
17,
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,
40,
17,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
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,
13,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
169,
5
],
[
169,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
169,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
12,
21
],
[
21,
22
],
[
21,
23
],
[
12,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
12,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
12,
50
],
[
50,
51
],
[
50,
52
],
[
12,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
12,
74
],
[
74,
75
],
[
74,
76
],
[
12,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
92,
95
],
[
95,
96
],
[
95,
97
],
[
91,
98
],
[
98,
99
],
[
90,
100
],
[
100,
101
],
[
12,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
12,
108
],
[
108,
109
],
[
109,
110
],
[
10,
111
],
[
111,
112
],
[
169,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
115,
124
],
[
124,
125
],
[
115,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
138,
144
],
[
144,
145
],
[
130,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
146,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
115,
162
],
[
162,
163
],
[
113,
164
],
[
164,
165
],
[
113,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.util.Scanner;\n\n/**\n * 二分探索\n * @author nobu\n * @see <a href=\"http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=ja\">ALDS1_4_B</a>\n */\npublic class Main {\n\n\tprivate static final int NOT_FOUND = -1;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tint answer = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t\tsc.close();\n\t}\n\n\tprivate static int binarySearch(int x[], int key) {\n\t\tint left = 0;\n\t\tint right = x.length;\n\t\tint mid;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (x[mid] == key) return mid;\n\t\t\tif (key < x[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 NOT_FOUND;\n\t}\n\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tprivate static final int NOT_FOUND = -1;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tint answer = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t\tsc.close();\n\t}\n\n\tprivate static int binarySearch(int x[], int key) {\n\t\tint left = 0;\n\t\tint right = x.length;\n\t\tint mid;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (x[mid] == key) return mid;\n\t\t\tif (key < x[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 NOT_FOUND;\n\t}\n\n}",
"Main",
"private static final int NOT_FOUND = -1;",
"NOT_FOUND",
"-1",
"1",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tint answer = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tint answer = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t\tsc.close();\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 answer = 0;",
"answer",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}",
"{\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}",
"if (binarySearch(s, t[i]) != -1) answer++;",
"binarySearch(s, t[i]) != -1",
"binarySearch(s, t[i])",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"-1",
"1",
"answer++",
"answer",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"private static int binarySearch(int x[], int key) {\n\t\tint left = 0;\n\t\tint right = x.length;\n\t\tint mid;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (x[mid] == key) return mid;\n\t\t\tif (key < x[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 NOT_FOUND;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = x.length;\n\t\tint mid;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (x[mid] == key) return mid;\n\t\t\tif (key < x[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 NOT_FOUND;\n\t}",
"int left = 0;",
"left",
"0",
"int right = x.length;",
"right",
"x.length",
"x",
"x.length",
"int mid;",
"mid",
"while (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (x[mid] == key) return mid;\n\t\t\tif (key < x[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 (x[mid] == key) return mid;\n\t\t\tif (key < x[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 (x[mid] == key) return mid;",
"x[mid] == key",
"x[mid]",
"x",
"mid",
"key",
"return mid;",
"mid",
"if (key < x[mid]) {\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"key < x[mid]",
"key",
"x[mid]",
"x",
"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 NOT_FOUND;",
"NOT_FOUND",
"int x[]",
"x",
"int key",
"key",
"public class Main {\n\n\tprivate static final int NOT_FOUND = -1;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tint answer = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t\tsc.close();\n\t}\n\n\tprivate static int binarySearch(int x[], int key) {\n\t\tint left = 0;\n\t\tint right = x.length;\n\t\tint mid;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (x[mid] == key) return mid;\n\t\t\tif (key < x[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 NOT_FOUND;\n\t}\n\n}",
"public class Main {\n\n\tprivate static final int NOT_FOUND = -1;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tint answer = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(s, t[i]) != -1) answer++;\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t\tsc.close();\n\t}\n\n\tprivate static int binarySearch(int x[], int key) {\n\t\tint left = 0;\n\t\tint right = x.length;\n\t\tint mid;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (x[mid] == key) return mid;\n\t\t\tif (key < x[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 NOT_FOUND;\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
/**
* 二分探索
* @author nobu
* @see <a href="http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=ja">ALDS1_4_B</a>
*/
public class Main {
private static final int NOT_FOUND = -1;
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 answer = 0;
for (int i = 0; i < q; i++) {
if (binarySearch(s, t[i]) != -1) answer++;
}
System.out.println(answer);
sc.close();
}
private static int binarySearch(int x[], int key) {
int left = 0;
int right = x.length;
int mid;
while (left < right) {
mid = (left + right) / 2;
if (x[mid] == key) return mid;
if (key < x[mid]) {
right = mid;
} else {
left = mid + 1;
}
}
return NOT_FOUND;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
0,
18,
13,
13,
13,
41,
13,
17,
42,
2,
18,
13,
13,
13,
40,
13,
29,
2,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
17,
41,
13,
20,
17,
41,
13,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
4,
13,
13,
13,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
10,
12
],
[
9,
13
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
17,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
6,
29
],
[
29,
30
],
[
6,
31
],
[
31,
32
],
[
6,
33
],
[
33,
34
],
[
4,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
41,
43
],
[
37,
44
],
[
44,
45
],
[
44,
46
],
[
37,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
59,
65
],
[
65,
66
],
[
51,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
67,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
51,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
84,
85
],
[
84,
86
],
[
37,
87
],
[
87,
88
],
[
35,
89
],
[
89,
90
],
[
35,
91
],
[
91,
92
],
[
35,
93
],
[
93,
94
],
[
4,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
97,
105
],
[
105,
106
],
[
105,
107
],
[
97,
109
],
[
109,
110
],
[
109,
111
],
[
97,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
97,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
117,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
97,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
97,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
146,
148
],
[
141,
149
],
[
149,
150
],
[
150,
151
],
[
141,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
97,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
165,
166
],
[
165,
167
],
[
160,
168
],
[
168,
169
],
[
169,
170
],
[
160,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
173,
176
],
[
173,
177
],
[
177,
178
],
[
177,
179
],
[
172,
180
],
[
180,
181
],
[
97,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
182,
187
],
[
95,
188
],
[
188,
189
]
] | [
"import java.util.*;\n\nclass Main {\n\t//?????¢??¢?´¢?????¬???\n\tpublic static boolean search(int[] A, int n, int key) {\n\t\tA[n] = key;\n\t\tint i = 0;\n\t\twhile(A[i] != key)i++;\n\t\treturn i != n;\n\t}\n\t\n\tpublic static boolean binarySearch(int[] A, int n, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return true;\n\t\t\tif ( key > A[mid] ) left = mid + 1;\n\t\t\tif ( key < A[mid] ) right = mid;\n\t\t}\n\treturn false;\n\t}\n\n\tpublic static void main(String args[]) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j])) count++;\n\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\t//?????¢??¢?´¢?????¬???\n\tpublic static boolean search(int[] A, int n, int key) {\n\t\tA[n] = key;\n\t\tint i = 0;\n\t\twhile(A[i] != key)i++;\n\t\treturn i != n;\n\t}\n\t\n\tpublic static boolean binarySearch(int[] A, int n, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return true;\n\t\t\tif ( key > A[mid] ) left = mid + 1;\n\t\t\tif ( key < A[mid] ) right = mid;\n\t\t}\n\treturn false;\n\t}\n\n\tpublic static void main(String args[]) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j])) count++;\n\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"//?????¢??¢?´¢?????¬???\n\tpublic static boolean search(int[] A, int n, int key) {\n\t\tA[n] = key;\n\t\tint i = 0;\n\t\twhile(A[i] != key)i++;\n\t\treturn i != n;\n\t}",
"search",
"{\n\t\tA[n] = key;\n\t\tint i = 0;\n\t\twhile(A[i] != key)i++;\n\t\treturn i != n;\n\t}",
"A[n] = key",
"A[n]",
"A",
"n",
"key",
"int i = 0;",
"i",
"0",
"while(A[i] != key)i++;",
"A[i] != key",
"A[i]",
"A",
"i",
"key",
"i++",
"i",
"return i != n;",
"i != n",
"i",
"n",
"int[] A",
"A",
"int n",
"n",
"int key",
"key",
"public static boolean binarySearch(int[] A, int n, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return true;\n\t\t\tif ( key > A[mid] ) left = mid + 1;\n\t\t\tif ( key < A[mid] ) right = mid;\n\t\t}\n\treturn false;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return true;\n\t\t\tif ( key > A[mid] ) left = mid + 1;\n\t\t\tif ( key < A[mid] ) right = mid;\n\t\t}\n\treturn false;\n\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid = 0;",
"mid",
"0",
"while(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return true;\n\t\t\tif ( key > A[mid] ) left = mid + 1;\n\t\t\tif ( key < A[mid] ) right = mid;\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return true;\n\t\t\tif ( key > A[mid] ) left = mid + 1;\n\t\t\tif ( 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 true;",
"key == A[mid]",
"key",
"A[mid]",
"A",
"mid",
"return true;",
"true",
"if ( key > A[mid] ) left = mid + 1;",
"key > A[mid]",
"key",
"A[mid]",
"A",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if ( key < A[mid] ) right = mid;",
"key < A[mid]",
"key",
"A[mid]",
"A",
"mid",
"right = mid",
"right",
"mid",
"return false;",
"false",
"int[] A",
"A",
"int n",
"n",
"int key",
"key",
"public static void main(String args[]) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j])) count++;\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j])) count++;\n\n\t\tSystem.out.println(count);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int[] arrayS = new int[100000];",
"arrayS",
"new int[100000]",
"100000",
"int[] arrayT = new int[50000];",
"arrayT",
"new int[50000]",
"50000",
"int count = 0;",
"count",
"0",
"int sNum = scan.nextInt();",
"sNum",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sNum",
"i",
"sNum",
"i++",
"i++",
"i",
"arrayS[i] = scan.nextInt();",
"arrayS[i] = scan.nextInt()",
"arrayS[i]",
"arrayS",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int tNum = scan.nextInt();",
"tNum",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < tNum",
"j",
"tNum",
"j++",
"j++",
"j",
"arrayT[j] = scan.nextInt();",
"arrayT[j] = scan.nextInt()",
"arrayT[j]",
"arrayT",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j])) count++;",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < tNum",
"j",
"tNum",
"j++",
"j++",
"j",
"if(binarySearch(arrayS, sNum, arrayT[j])) count++;",
"if(binarySearch(arrayS, sNum, arrayT[j])) count++;",
"binarySearch(arrayS, sNum, arrayT[j])",
"binarySearch",
"arrayS",
"sNum",
"arrayT[j]",
"arrayT",
"j",
"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 boolean search(int[] A, int n, int key) {
A[n] = key;
int i = 0;
while(A[i] != key)i++;
return i != n;
}
public static boolean binarySearch(int[] A, int n, int key) {
int left = 0;
int right = n;
int mid = 0;
while(left < right) {
mid = (left + right) / 2;
if ( key == A[mid] ) return true;
if ( key > A[mid] ) left = mid + 1;
if ( key < A[mid] ) right = mid;
}
return false;
}
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int[] arrayS = new int[100000]; //??°???S
int[] arrayT = new int[50000]; //??°???T
int count = 0; //?????°????¨???????????????°
//????´??????°???????????????ArrayS?????°???S???????????????
int sNum = scan.nextInt();
for (int i = 0; i < sNum; i++)
arrayS[i] = scan.nextInt();
//????´??????°???????????????ArrayT?????°???T???????????????
int tNum = scan.nextInt();
for (int j = 0; j < tNum; j++)
arrayT[j] = scan.nextInt();
//??°???T???????´??????°???A????????????????????????????????????
for (int j = 0; j < tNum; j++)
if(binarySearch(arrayS, sNum, arrayT[j])) count++;
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
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,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
13,
13,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
14,
2,
13,
18,
13,
13,
29,
41,
13,
2,
2,
13,
13,
17,
42,
2,
2,
13,
13,
17,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
13,
0,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
2,
13,
13,
17,
30,
14,
2,
18,
13,
13,
13,
40,
13,
14,
2,
18,
13,
13,
13,
40,
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
],
[
238,
14
],
[
238,
15
],
[
15,
16
],
[
15,
17
],
[
238,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
20,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
20,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
20,
43
],
[
43,
44
],
[
43,
45
],
[
20,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
66,
68
],
[
20,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
75,
76
],
[
20,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
79,
84
],
[
20,
85
],
[
85,
86
],
[
85,
87
],
[
20,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
108,
110
],
[
20,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
111,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
123,
126
],
[
126,
127
],
[
126,
128
],
[
20,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
20,
133
],
[
133,
134
],
[
134,
135
],
[
18,
136
],
[
136,
137
],
[
238,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
140,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
151,
157
],
[
151,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
140,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
140,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
172,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
179,
185
],
[
185,
186
],
[
186,
187
],
[
185,
188
],
[
179,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
189,
195
],
[
195,
196
],
[
195,
197
],
[
189,
198
],
[
198,
199
],
[
198,
200
],
[
178,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
140,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
211,
215
],
[
210,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
219,
221
],
[
218,
222
],
[
217,
223
],
[
223,
224
],
[
217,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
226,
230
],
[
225,
231
],
[
231,
232
],
[
138,
233
],
[
233,
234
],
[
138,
235
],
[
235,
236
],
[
0,
237
],
[
237,
238
],
[
237,
239
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n\npublic class Main {\n\tpublic static int count = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sready = (br.readLine()).split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = Integer.parseInt(sready[i]);\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tready = (br.readLine()).split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = Integer.parseInt(tready[i]);\n\t\t\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tdoBinarySearch(s, t[i]);\n\t\t\n\t\tpw.println(count);\n\t\tpw.close();\n\t}\n\t\n\tpublic static void doBinarySearch(int[] s, int x) {\n\t\tint index1 = 0;\n\t\tint index2 = s.length - 1;\n\t\tif (x < s[index1])\n\t\t\treturn;\n\t\telse if (x > s[index2])\n\t\t\treturn;\n\t\t\n\t\tint point = (index2 - index1) / 2;\n\t\tdo {\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t} while (index2 - index1 > 1);\n\t\tif (index2 - index1 ==1) {\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\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.io.PrintWriter;",
"PrintWriter",
"java.io",
"public class Main {\n\tpublic static int count = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sready = (br.readLine()).split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = Integer.parseInt(sready[i]);\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tready = (br.readLine()).split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = Integer.parseInt(tready[i]);\n\t\t\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tdoBinarySearch(s, t[i]);\n\t\t\n\t\tpw.println(count);\n\t\tpw.close();\n\t}\n\t\n\tpublic static void doBinarySearch(int[] s, int x) {\n\t\tint index1 = 0;\n\t\tint index2 = s.length - 1;\n\t\tif (x < s[index1])\n\t\t\treturn;\n\t\telse if (x > s[index2])\n\t\t\treturn;\n\t\t\n\t\tint point = (index2 - index1) / 2;\n\t\tdo {\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t} while (index2 - index1 > 1);\n\t\tif (index2 - index1 ==1) {\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\n\t\t}\n\t}\n}",
"Main",
"public static int count = 0;",
"count",
"0",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sready = (br.readLine()).split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = Integer.parseInt(sready[i]);\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tready = (br.readLine()).split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = Integer.parseInt(tready[i]);\n\t\t\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tdoBinarySearch(s, t[i]);\n\t\t\n\t\tpw.println(count);\n\t\tpw.close();\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sready = (br.readLine()).split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = Integer.parseInt(sready[i]);\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tready = (br.readLine()).split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = Integer.parseInt(tready[i]);\n\t\t\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tdoBinarySearch(s, t[i]);\n\t\t\n\t\tpw.println(count);\n\t\tpw.close();\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"PrintWriter pw = new PrintWriter(System.out);",
"pw",
"new PrintWriter(System.out)",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] sready = (br.readLine()).split(\" \");",
"sready",
"(br.readLine()).split(\" \")",
"(br.readLine()).split",
"(br.readLine())",
"br.readLine",
"br",
"\" \"",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\ts[i] = Integer.parseInt(sready[i]);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"s[i] = Integer.parseInt(sready[i]);",
"s[i] = Integer.parseInt(sready[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(sready[i])",
"Integer.parseInt",
"Integer",
"sready[i]",
"sready",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] tready = (br.readLine()).split(\" \");",
"tready",
"(br.readLine()).split(\" \")",
"(br.readLine()).split",
"(br.readLine())",
"br.readLine",
"br",
"\" \"",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++)\n\t\t\tt[i] = Integer.parseInt(tready[i]);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"t[i] = Integer.parseInt(tready[i]);",
"t[i] = Integer.parseInt(tready[i])",
"t[i]",
"t",
"i",
"Integer.parseInt(tready[i])",
"Integer.parseInt",
"Integer",
"tready[i]",
"tready",
"i",
"for (int i = 0; i < q; i++)\n\t\t\tdoBinarySearch(s, t[i]);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"doBinarySearch(s, t[i]);",
"doBinarySearch(s, t[i])",
"doBinarySearch",
"s",
"t[i]",
"t",
"i",
"pw.println(count)",
"pw.println",
"pw",
"count",
"pw.close()",
"pw.close",
"pw",
"String[] args",
"args",
"public static void doBinarySearch(int[] s, int x) {\n\t\tint index1 = 0;\n\t\tint index2 = s.length - 1;\n\t\tif (x < s[index1])\n\t\t\treturn;\n\t\telse if (x > s[index2])\n\t\t\treturn;\n\t\t\n\t\tint point = (index2 - index1) / 2;\n\t\tdo {\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t} while (index2 - index1 > 1);\n\t\tif (index2 - index1 ==1) {\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\n\t\t}\n\t}",
"doBinarySearch",
"{\n\t\tint index1 = 0;\n\t\tint index2 = s.length - 1;\n\t\tif (x < s[index1])\n\t\t\treturn;\n\t\telse if (x > s[index2])\n\t\t\treturn;\n\t\t\n\t\tint point = (index2 - index1) / 2;\n\t\tdo {\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t} while (index2 - index1 > 1);\n\t\tif (index2 - index1 ==1) {\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\n\t\t}\n\t}",
"int index1 = 0;",
"index1",
"0",
"int index2 = s.length - 1;",
"index2",
"s.length - 1",
"s.length",
"s",
"s.length",
"1",
"if (x < s[index1])\n\t\t\treturn;\n\t\telse if (x > s[index2])\n\t\t\treturn;",
"x < s[index1]",
"x",
"s[index1]",
"s",
"index1",
"return;",
"if (x > s[index2])\n\t\t\treturn;",
"x > s[index2]",
"x",
"s[index2]",
"s",
"index2",
"return;",
"int point = (index2 - index1) / 2;",
"point",
"(index2 - index1) / 2",
"(index2 - index1)",
"index2",
"index1",
"2",
"do {\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t} while (index2 - index1 > 1);",
"index2 - index1 > 1",
"index2 - index1",
"index2",
"index1",
"1",
"{\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t}",
"if (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;",
"s[point] == x",
"s[point]",
"s",
"point",
"x",
"{\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}",
"count++",
"count",
"break;",
"if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;",
"s[point] > x",
"s[point]",
"s",
"point",
"x",
"index2 = point",
"index2",
"point",
"index1 = point",
"index1",
"point",
"point = index1 + (index2 - index1) / 2",
"point",
"index1 + (index2 - index1) / 2",
"index1",
"(index2 - index1) / 2",
"(index2 - index1)",
"index2",
"index1",
"2",
"if (index2 - index1 ==1) {\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\n\t\t}",
"index2 - index1 ==1",
"index2 - index1",
"index2",
"index1",
"1",
"{\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\n\t\t}",
"if (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;",
"s[index1] == x",
"s[index1]",
"s",
"index1",
"x",
"count++",
"count",
"if (s[index2] == x)\n\t\t\t\tcount++;",
"s[index2] == x",
"s[index2]",
"s",
"index2",
"x",
"count++",
"count",
"int[] s",
"s",
"int x",
"x",
"public class Main {\n\tpublic static int count = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sready = (br.readLine()).split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = Integer.parseInt(sready[i]);\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tready = (br.readLine()).split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = Integer.parseInt(tready[i]);\n\t\t\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tdoBinarySearch(s, t[i]);\n\t\t\n\t\tpw.println(count);\n\t\tpw.close();\n\t}\n\t\n\tpublic static void doBinarySearch(int[] s, int x) {\n\t\tint index1 = 0;\n\t\tint index2 = s.length - 1;\n\t\tif (x < s[index1])\n\t\t\treturn;\n\t\telse if (x > s[index2])\n\t\t\treturn;\n\t\t\n\t\tint point = (index2 - index1) / 2;\n\t\tdo {\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t} while (index2 - index1 > 1);\n\t\tif (index2 - index1 ==1) {\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static int count = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] sready = (br.readLine()).split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = Integer.parseInt(sready[i]);\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] tready = (br.readLine()).split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = Integer.parseInt(tready[i]);\n\t\t\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tdoBinarySearch(s, t[i]);\n\t\t\n\t\tpw.println(count);\n\t\tpw.close();\n\t}\n\t\n\tpublic static void doBinarySearch(int[] s, int x) {\n\t\tint index1 = 0;\n\t\tint index2 = s.length - 1;\n\t\tif (x < s[index1])\n\t\t\treturn;\n\t\telse if (x > s[index2])\n\t\t\treturn;\n\t\t\n\t\tint point = (index2 - index1) / 2;\n\t\tdo {\n\t\t\tif (s[point] == x) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (s[point] > x)\n\t\t\t\tindex2 = point;\n\t\t\telse\n\t\t\t\tindex1 = point;\n\t\t\tpoint = index1 + (index2 - index1) / 2;\n\t\t} while (index2 - index1 > 1);\n\t\tif (index2 - index1 ==1) {\n\t\t\tif (s[index1] == x)\n\t\t\t\tcount++;\n\t\t\telse if (s[index2] == x)\n\t\t\t\tcount++;\n\t\t}\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static int count = 0;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
int n = Integer.parseInt(br.readLine());
String[] sready = (br.readLine()).split(" ");
int[] s = new int[n];
for (int i = 0; i < n; i++)
s[i] = Integer.parseInt(sready[i]);
int q = Integer.parseInt(br.readLine());
String[] tready = (br.readLine()).split(" ");
int[] t = new int[q];
for (int i = 0; i < q; i++)
t[i] = Integer.parseInt(tready[i]);
for (int i = 0; i < q; i++)
doBinarySearch(s, t[i]);
pw.println(count);
pw.close();
}
public static void doBinarySearch(int[] s, int x) {
int index1 = 0;
int index2 = s.length - 1;
if (x < s[index1])
return;
else if (x > s[index2])
return;
int point = (index2 - index1) / 2;
do {
if (s[point] == x) {
count++;
break;
}
else if (s[point] > x)
index2 = point;
else
index1 = point;
point = index1 + (index2 - index1) / 2;
} while (index2 - index1 > 1);
if (index2 - index1 ==1) {
if (s[index1] == x)
count++;
else if (s[index2] == x)
count++;
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.