node_ids
listlengths 4
1.4k
| edge_index
listlengths 1
2.22k
| text
listlengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
40,
13,
30,
14,
40,
4,
18,
13,
2,
13,
13,
0,
13,
17,
0,
13,
13,
14,
2,
13,
17,
0,
13,
2,
17,
13,
0,
13,
2,
2,
17,
13,
17,
4,
18,
18,
13,
13,
2,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
64,
66
],
[
55,
67
],
[
67,
68
],
[
67,
69
],
[
55,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
70,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
6,
94
],
[
94,
95
]
]
| [
"import java.util.*;\nclass Main\n{\n public static void main(String [] args)\n {\n Scanner s = new Scanner(System.in);\n int num = s.nextInt();\n int n = s.nextInt();\n \n HashSet<Integer>h = new HashSet<>();\n \n \tfor(int i = 0; i < n;i++)\n h.add(s.nextInt());\n \n int count = 0;\n boolean found = false;\n int prev = 0;\n \n while(!found)\n {\n if(!(h.contains(num - count))) found = true;\n prev = count; \n if(count > 0)\n count = 0 - count;\n else\n count = 0 - count + 1;\n \n }\n \n System.out.println(num - prev);\n \n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main\n{\n public static void main(String [] args)\n {\n Scanner s = new Scanner(System.in);\n int num = s.nextInt();\n int n = s.nextInt();\n \n HashSet<Integer>h = new HashSet<>();\n \n \tfor(int i = 0; i < n;i++)\n h.add(s.nextInt());\n \n int count = 0;\n boolean found = false;\n int prev = 0;\n \n while(!found)\n {\n if(!(h.contains(num - count))) found = true;\n prev = count; \n if(count > 0)\n count = 0 - count;\n else\n count = 0 - count + 1;\n \n }\n \n System.out.println(num - prev);\n \n }\n}",
"Main",
"public static void main(String [] args)\n {\n Scanner s = new Scanner(System.in);\n int num = s.nextInt();\n int n = s.nextInt();\n \n HashSet<Integer>h = new HashSet<>();\n \n \tfor(int i = 0; i < n;i++)\n h.add(s.nextInt());\n \n int count = 0;\n boolean found = false;\n int prev = 0;\n \n while(!found)\n {\n if(!(h.contains(num - count))) found = true;\n prev = count; \n if(count > 0)\n count = 0 - count;\n else\n count = 0 - count + 1;\n \n }\n \n System.out.println(num - prev);\n \n }",
"main",
"{\n Scanner s = new Scanner(System.in);\n int num = s.nextInt();\n int n = s.nextInt();\n \n HashSet<Integer>h = new HashSet<>();\n \n \tfor(int i = 0; i < n;i++)\n h.add(s.nextInt());\n \n int count = 0;\n boolean found = false;\n int prev = 0;\n \n while(!found)\n {\n if(!(h.contains(num - count))) found = true;\n prev = count; \n if(count > 0)\n count = 0 - count;\n else\n count = 0 - count + 1;\n \n }\n \n System.out.println(num - prev);\n \n }",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int num = s.nextInt();",
"num",
"s.nextInt()",
"s.nextInt",
"s",
"int n = s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"HashSet<Integer>h = new HashSet<>();",
"h",
"new HashSet<>()",
"for(int i = 0; i < n;i++)\n h.add(s.nextInt());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"h.add(s.nextInt());",
"h.add(s.nextInt())",
"h.add",
"h",
"s.nextInt()",
"s.nextInt",
"s",
"int count = 0;",
"count",
"0",
"boolean found = false;",
"found",
"false",
"int prev = 0;",
"prev",
"0",
"while(!found)\n {\n if(!(h.contains(num - count))) found = true;\n prev = count; \n if(count > 0)\n count = 0 - count;\n else\n count = 0 - count + 1;\n \n }",
"!found",
"found",
"{\n if(!(h.contains(num - count))) found = true;\n prev = count; \n if(count > 0)\n count = 0 - count;\n else\n count = 0 - count + 1;\n \n }",
"if(!(h.contains(num - count))) found = true;",
"!(h.contains(num - count))",
"(h.contains(num - count))",
"h.contains",
"h",
"num - count",
"num",
"count",
"found = true",
"found",
"true",
"prev = count",
"prev",
"count",
"if(count > 0)\n count = 0 - count;\n else\n count = 0 - count + 1;",
"count > 0",
"count",
"0",
"count = 0 - count",
"count",
"0 - count",
"0",
"count",
"count = 0 - count + 1",
"count",
"0 - count + 1",
"0 - count",
"0",
"count",
"1",
"System.out.println(num - prev)",
"System.out.println",
"System.out",
"System",
"System.out",
"num - prev",
"num",
"prev",
"String [] args",
"args"
]
| import java.util.*;
class Main
{
public static void main(String [] args)
{
Scanner s = new Scanner(System.in);
int num = s.nextInt();
int n = s.nextInt();
HashSet<Integer>h = new HashSet<>();
for(int i = 0; i < n;i++)
h.add(s.nextInt());
int count = 0;
boolean found = false;
int prev = 0;
while(!found)
{
if(!(h.contains(num - count))) found = true;
prev = count;
if(count > 0)
count = 0 - count;
else
count = 0 - count + 1;
}
System.out.println(num - prev);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
0,
13,
17,
0,
13,
17,
14,
2,
2,
13,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
18,
13,
13,
30,
0,
13,
17,
0,
13,
17,
14,
40,
13,
30,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
18,
13,
13,
30,
0,
13,
17,
0,
13,
17,
14,
13,
30,
14,
13,
30,
0,
13,
2,
13,
13,
14,
13,
30,
0,
13,
2,
13,
13,
0,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
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
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
76,
82
],
[
82,
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
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
66,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
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
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
143,
145
],
[
66,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
149,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
162,
164
],
[
148,
165
],
[
165,
166
],
[
165,
167
],
[
66,
168
],
[
168,
169
],
[
8,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
6,
176
],
[
176,
177
]
]
| [
"import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n Scanner scan=new Scanner(System.in);\n int flag=scan.nextInt();\n int num=scan.nextInt();\n int[] stk=new int[num];\n for(int a=0; a<num; a++){\n stk[a]=scan.nextInt();\n }\n boolean tmp=true;\n int ans=0;\n int count=0;\n boolean cap=true;\n boolean capplus=true;\n boolean capminus=true;\n while(tmp){\n capplus=true;\n capminus=true;\n cap=true;\n if(flag-count>0){\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }\n if(!cap){\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }\n if(cap){\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }\n count++;\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n public static void main(String[] args){\n Scanner scan=new Scanner(System.in);\n int flag=scan.nextInt();\n int num=scan.nextInt();\n int[] stk=new int[num];\n for(int a=0; a<num; a++){\n stk[a]=scan.nextInt();\n }\n boolean tmp=true;\n int ans=0;\n int count=0;\n boolean cap=true;\n boolean capplus=true;\n boolean capminus=true;\n while(tmp){\n capplus=true;\n capminus=true;\n cap=true;\n if(flag-count>0){\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }\n if(!cap){\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }\n if(cap){\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }\n count++;\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan=new Scanner(System.in);\n int flag=scan.nextInt();\n int num=scan.nextInt();\n int[] stk=new int[num];\n for(int a=0; a<num; a++){\n stk[a]=scan.nextInt();\n }\n boolean tmp=true;\n int ans=0;\n int count=0;\n boolean cap=true;\n boolean capplus=true;\n boolean capminus=true;\n while(tmp){\n capplus=true;\n capminus=true;\n cap=true;\n if(flag-count>0){\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }\n if(!cap){\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }\n if(cap){\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }\n count++;\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scan=new Scanner(System.in);\n int flag=scan.nextInt();\n int num=scan.nextInt();\n int[] stk=new int[num];\n for(int a=0; a<num; a++){\n stk[a]=scan.nextInt();\n }\n boolean tmp=true;\n int ans=0;\n int count=0;\n boolean cap=true;\n boolean capplus=true;\n boolean capminus=true;\n while(tmp){\n capplus=true;\n capminus=true;\n cap=true;\n if(flag-count>0){\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }\n if(!cap){\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }\n if(cap){\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }\n count++;\n }\n System.out.println(ans);\n }",
"Scanner scan=new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int flag=scan.nextInt();",
"flag",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int num=scan.nextInt();",
"num",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] stk=new int[num];",
"stk",
"new int[num]",
"num",
"for(int a=0; a<num; a++){\n stk[a]=scan.nextInt();\n }",
"int a=0;",
"int a=0;",
"a",
"0",
"a<num",
"a",
"num",
"a++",
"a++",
"a",
"{\n stk[a]=scan.nextInt();\n }",
"{\n stk[a]=scan.nextInt();\n }",
"stk[a]=scan.nextInt()",
"stk[a]",
"stk",
"a",
"scan.nextInt()",
"scan.nextInt",
"scan",
"boolean tmp=true;",
"tmp",
"true",
"int ans=0;",
"ans",
"0",
"int count=0;",
"count",
"0",
"boolean cap=true;",
"cap",
"true",
"boolean capplus=true;",
"capplus",
"true",
"boolean capminus=true;",
"capminus",
"true",
"while(tmp){\n capplus=true;\n capminus=true;\n cap=true;\n if(flag-count>0){\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }\n if(!cap){\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }\n if(cap){\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }\n count++;\n }",
"tmp",
"{\n capplus=true;\n capminus=true;\n cap=true;\n if(flag-count>0){\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }\n if(!cap){\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }\n if(cap){\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }\n count++;\n }",
"capplus=true",
"capplus",
"true",
"capminus=true",
"capminus",
"true",
"cap=true",
"cap",
"true",
"if(flag-count>0){\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }",
"flag-count>0",
"flag-count",
"flag",
"count",
"0",
"{\n for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }\n }",
"for(int a=0; a<num; a++){\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }",
"int a=0;",
"int a=0;",
"a",
"0",
"a<num",
"a",
"num",
"a++",
"a++",
"a",
"{\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }",
"{\n if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }\n }",
"if(flag-count==stk[a]){\n cap=false;\n capminus=false;\n }",
"flag-count==stk[a]",
"flag-count",
"flag",
"count",
"stk[a]",
"stk",
"a",
"{\n cap=false;\n capminus=false;\n }",
"cap=false",
"cap",
"false",
"capminus=false",
"capminus",
"false",
"if(!cap){\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }",
"!cap",
"cap",
"{\n cap=true;\n for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }\n }",
"cap=true",
"cap",
"true",
"for(int a=0; a<num; a++){\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }",
"int a=0;",
"int a=0;",
"a",
"0",
"a<num",
"a",
"num",
"a++",
"a++",
"a",
"{\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }",
"{\n if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }\n }",
"if(flag+count==stk[a]){\n cap=false;\n capplus=false;\n }",
"flag+count==stk[a]",
"flag+count",
"flag",
"count",
"stk[a]",
"stk",
"a",
"{\n cap=false;\n capplus=false;\n }",
"cap=false",
"cap",
"false",
"capplus=false",
"capplus",
"false",
"if(cap){\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }",
"cap",
"{\n if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }\n tmp=false;\n }",
"if(capminus){\n ans=flag-count;\n }\n else if(capplus){\n ans=flag+count;\n }",
"capminus",
"{\n ans=flag-count;\n }",
"ans=flag-count",
"ans",
"flag-count",
"flag",
"count",
"if(capplus){\n ans=flag+count;\n }",
"capplus",
"{\n ans=flag+count;\n }",
"ans=flag+count",
"ans",
"flag+count",
"flag",
"count",
"tmp=false",
"tmp",
"false",
"count++",
"count",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
]
| import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int flag=scan.nextInt();
int num=scan.nextInt();
int[] stk=new int[num];
for(int a=0; a<num; a++){
stk[a]=scan.nextInt();
}
boolean tmp=true;
int ans=0;
int count=0;
boolean cap=true;
boolean capplus=true;
boolean capminus=true;
while(tmp){
capplus=true;
capminus=true;
cap=true;
if(flag-count>0){
for(int a=0; a<num; a++){
if(flag-count==stk[a]){
cap=false;
capminus=false;
}
}
}
if(!cap){
cap=true;
for(int a=0; a<num; a++){
if(flag+count==stk[a]){
cap=false;
capplus=false;
}
}
}
if(cap){
if(capminus){
ans=flag-count;
}
else if(capplus){
ans=flag+count;
}
tmp=false;
}
count++;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
2,
17,
17,
12,
13,
30,
41,
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,
30,
0,
18,
13,
4,
18,
13,
17,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
18,
13,
13,
9,
14,
2,
2,
13,
4,
18,
13,
2,
13,
13,
2,
2,
13,
4,
18,
13,
2,
13,
13,
2,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
4,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
6,
13,
41,
13,
12,
13,
30,
4,
13,
18,
13,
13,
12,
13,
30,
0,
18,
36,
13,
20,
23,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
4,
18,
18,
36,
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,
38,
5,
13,
30,
4,
18,
13,
29,
40,
17,
30,
41,
13,
17,
41,
13,
4,
18,
13,
42,
2,
2,
2,
2,
13,
17,
2,
17,
13,
2,
13,
17,
2,
13,
17,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
41,
13,
2,
13,
17,
42,
17,
30,
0,
13,
4,
18,
13,
14,
2,
2,
13,
17,
2,
17,
13,
29,
2,
13,
13,
0,
13,
17,
0,
13,
2,
13,
17,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
18,
13,
13,
30,
41,
13,
17,
41,
13,
4,
18,
13,
42,
2,
2,
2,
2,
13,
17,
2,
17,
13,
2,
13,
17,
2,
13,
17,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
41,
13,
2,
13,
17,
42,
17,
30,
0,
13,
4,
18,
13,
14,
2,
2,
13,
17,
2,
17,
13,
3,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
13,
17,
29,
2,
13,
13,
41,
13,
17,
0,
13,
4,
18,
13,
42,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
17,
0,
13,
4,
18,
13,
29,
2,
2,
13,
13,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
4,
18,
13,
42,
4,
18,
13,
13,
30,
0,
13,
4,
18,
13,
29,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
20,
41,
13,
4,
18,
13,
42,
4,
18,
13,
13,
30,
0,
13,
4,
18,
13,
42,
2,
2,
13,
40,
17,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
18,
13,
29,
4,
18,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
20,
41,
13,
4,
18,
13,
42,
2,
2,
13,
40,
17,
2,
13,
17,
30,
4,
18,
13,
13,
0,
13,
4,
18,
13,
29,
4,
18,
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,
2,
4,
13,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
2,
13,
17,
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,
2,
4,
13,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
2,
13,
17,
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
],
[
815,
11
],
[
815,
12
],
[
12,
13
],
[
815,
14
],
[
14,
15
],
[
815,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
18,
20
],
[
815,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
23,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
34,
35
],
[
34,
36
],
[
23,
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
],
[
54,
55
],
[
55,
56
],
[
51,
57
],
[
23,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
60,
62
],
[
23,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
23,
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
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
87,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
102,
104
],
[
96,
105
],
[
105,
106
],
[
105,
107
],
[
86,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
114,
116
],
[
108,
117
],
[
117,
118
],
[
117,
119
],
[
23,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
815,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
124,
130
],
[
130,
131
],
[
815,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
134,
141
],
[
141,
142
],
[
134,
143
],
[
143,
144
],
[
144,
145
],
[
134,
146
],
[
146,
147
],
[
147,
148
],
[
134,
149
],
[
149,
150
],
[
150,
151
],
[
815,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
152,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
152,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
164,
172
],
[
172,
173
],
[
152,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
177,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
152,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
192,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
201,
203
],
[
198,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
206,
208
],
[
197,
209
],
[
209,
210
],
[
192,
211
],
[
211,
212
],
[
152,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
219,
223
],
[
223,
224
],
[
224,
225
],
[
216,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
226,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
233,
234
],
[
226,
235
],
[
235,
236
],
[
237,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
238,
242
],
[
242,
243
],
[
242,
244
],
[
237,
245
],
[
245,
246
],
[
245,
247
],
[
237,
248
],
[
248,
249
],
[
248,
250
],
[
235,
251
],
[
251,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
255,
256
],
[
226,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
257,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
261,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
269,
270
],
[
257,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
279,
280
],
[
226,
281
],
[
281,
282
],
[
281,
283
],
[
283,
284
],
[
283,
285
],
[
226,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
291,
292
],
[
292,
293
],
[
288,
294
],
[
294,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
295,
299
],
[
299,
300
],
[
299,
301
],
[
294,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
288,
306
],
[
306,
307
],
[
306,
308
],
[
288,
309
],
[
309,
310
],
[
309,
311
],
[
311,
312
],
[
311,
313
],
[
152,
314
],
[
314,
315
],
[
314,
316
],
[
316,
317
],
[
317,
318
],
[
318,
319
],
[
318,
320
],
[
320,
321
],
[
321,
322
],
[
322,
323
],
[
320,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
317,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
328,
332
],
[
332,
333
],
[
332,
334
],
[
334,
335
],
[
335,
336
],
[
328,
337
],
[
337,
338
],
[
339,
339
],
[
339,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
340,
344
],
[
344,
345
],
[
344,
346
],
[
339,
347
],
[
347,
348
],
[
347,
349
],
[
339,
350
],
[
350,
351
],
[
350,
352
],
[
337,
353
],
[
353,
354
],
[
354,
355
],
[
354,
356
],
[
356,
357
],
[
357,
358
],
[
328,
359
],
[
359,
360
],
[
360,
361
],
[
360,
362
],
[
359,
363
],
[
363,
364
],
[
364,
365
],
[
364,
366
],
[
366,
367
],
[
363,
368
],
[
368,
369
],
[
368,
370
],
[
370,
371
],
[
371,
372
],
[
359,
373
],
[
373,
374
],
[
374,
375
],
[
374,
376
],
[
373,
377
],
[
377,
378
],
[
378,
379
],
[
378,
380
],
[
380,
381
],
[
381,
382
],
[
328,
383
],
[
383,
384
],
[
383,
385
],
[
385,
386
],
[
385,
387
],
[
328,
388
],
[
388,
389
],
[
388,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
393,
394
],
[
394,
395
],
[
390,
396
],
[
396,
397
],
[
397,
398
],
[
398,
399
],
[
398,
400
],
[
397,
401
],
[
401,
402
],
[
401,
403
],
[
396,
404
],
[
390,
405
],
[
405,
406
],
[
405,
407
],
[
390,
408
],
[
408,
409
],
[
408,
410
],
[
410,
411
],
[
410,
412
],
[
328,
413
],
[
413,
414
],
[
414,
415
],
[
414,
416
],
[
413,
417
],
[
417,
418
],
[
418,
419
],
[
418,
420
],
[
328,
421
],
[
421,
422
],
[
421,
423
],
[
328,
424
],
[
424,
425
],
[
424,
426
],
[
426,
427
],
[
427,
428
],
[
328,
429
],
[
429,
430
],
[
430,
431
],
[
431,
432
],
[
431,
433
],
[
430,
434
],
[
434,
435
],
[
434,
436
],
[
429,
437
],
[
437,
438
],
[
438,
439
],
[
438,
440
],
[
437,
441
],
[
441,
442
],
[
441,
443
],
[
443,
444
],
[
443,
445
],
[
437,
446
],
[
446,
447
],
[
446,
448
],
[
437,
449
],
[
449,
450
],
[
449,
451
],
[
451,
452
],
[
452,
453
],
[
328,
454
],
[
454,
455
],
[
455,
456
],
[
456,
457
],
[
456,
458
],
[
455,
459
],
[
152,
460
],
[
460,
461
],
[
460,
462
],
[
462,
463
],
[
463,
464
],
[
464,
465
],
[
464,
466
],
[
466,
467
],
[
467,
468
],
[
468,
469
],
[
466,
470
],
[
470,
471
],
[
463,
472
],
[
472,
473
],
[
473,
474
],
[
473,
475
],
[
475,
476
],
[
476,
477
],
[
472,
478
],
[
478,
479
],
[
479,
480
],
[
480,
481
],
[
479,
482
],
[
478,
483
],
[
483,
484
],
[
484,
485
],
[
484,
486
],
[
486,
487
],
[
487,
488
],
[
472,
489
],
[
489,
490
],
[
152,
491
],
[
491,
492
],
[
491,
493
],
[
493,
494
],
[
494,
495
],
[
495,
496
],
[
495,
497
],
[
497,
498
],
[
498,
499
],
[
499,
500
],
[
497,
501
],
[
501,
502
],
[
494,
503
],
[
503,
504
],
[
504,
505
],
[
504,
506
],
[
503,
507
],
[
507,
508
],
[
507,
509
],
[
509,
510
],
[
510,
511
],
[
503,
512
],
[
512,
513
],
[
513,
514
],
[
514,
515
],
[
513,
516
],
[
512,
517
],
[
517,
518
],
[
518,
519
],
[
518,
520
],
[
520,
521
],
[
521,
522
],
[
503,
523
],
[
523,
524
],
[
524,
525
],
[
525,
526
],
[
525,
527
],
[
527,
528
],
[
524,
529
],
[
529,
530
],
[
530,
531
],
[
531,
532
],
[
530,
533
],
[
523,
534
],
[
534,
535
],
[
535,
536
],
[
536,
537
],
[
535,
538
],
[
534,
539
],
[
539,
540
],
[
539,
541
],
[
541,
542
],
[
542,
543
],
[
503,
544
],
[
544,
545
],
[
545,
546
],
[
546,
547
],
[
152,
548
],
[
548,
549
],
[
548,
550
],
[
550,
551
],
[
551,
552
],
[
552,
553
],
[
552,
554
],
[
554,
555
],
[
555,
556
],
[
556,
557
],
[
554,
558
],
[
558,
559
],
[
551,
560
],
[
560,
561
],
[
561,
562
],
[
561,
563
],
[
560,
564
],
[
564,
565
],
[
564,
566
],
[
566,
567
],
[
567,
568
],
[
560,
569
],
[
569,
570
],
[
570,
571
],
[
571,
572
],
[
571,
573
],
[
573,
574
],
[
570,
575
],
[
575,
576
],
[
575,
577
],
[
569,
578
],
[
578,
579
],
[
579,
580
],
[
580,
581
],
[
579,
582
],
[
578,
583
],
[
583,
584
],
[
583,
585
],
[
585,
586
],
[
586,
587
],
[
560,
588
],
[
588,
589
],
[
589,
590
],
[
590,
591
],
[
152,
592
],
[
592,
593
],
[
592,
594
],
[
594,
595
],
[
595,
596
],
[
595,
597
],
[
594,
599
],
[
599,
600
],
[
600,
601
],
[
601,
602
],
[
601,
603
],
[
599,
604
],
[
604,
605
],
[
604,
606
],
[
599,
607
],
[
607,
608
],
[
608,
609
],
[
599,
610
],
[
611,
611
],
[
611,
612
],
[
612,
613
],
[
613,
614
],
[
613,
615
],
[
612,
616
],
[
616,
617
],
[
594,
618
],
[
618,
619
],
[
592,
620
],
[
620,
621
],
[
152,
622
],
[
622,
623
],
[
622,
624
],
[
624,
625
],
[
625,
626
],
[
625,
627
],
[
624,
629
],
[
629,
630
],
[
630,
631
],
[
631,
632
],
[
631,
633
],
[
629,
634
],
[
634,
635
],
[
634,
636
],
[
629,
637
],
[
637,
638
],
[
638,
639
],
[
629,
640
],
[
641,
641
],
[
641,
642
],
[
642,
643
],
[
643,
644
],
[
643,
645
],
[
642,
646
],
[
646,
647
],
[
647,
648
],
[
646,
649
],
[
624,
650
],
[
650,
651
],
[
622,
652
],
[
652,
653
],
[
152,
654
],
[
654,
655
],
[
654,
656
],
[
656,
657
],
[
657,
658
],
[
657,
659
],
[
660,
661
],
[
660,
662
],
[
656,
663
],
[
663,
664
],
[
664,
665
],
[
665,
666
],
[
665,
667
],
[
663,
668
],
[
668,
669
],
[
668,
670
],
[
663,
671
],
[
671,
672
],
[
672,
673
],
[
663,
674
],
[
675,
675
],
[
675,
676
],
[
676,
677
],
[
677,
678
],
[
677,
679
],
[
679,
680
],
[
679,
681
],
[
676,
682
],
[
682,
683
],
[
656,
684
],
[
684,
685
],
[
654,
686
],
[
686,
687
],
[
152,
688
],
[
688,
689
],
[
688,
690
],
[
690,
691
],
[
691,
692
],
[
691,
693
],
[
690,
695
],
[
695,
696
],
[
696,
697
],
[
697,
698
],
[
697,
699
],
[
695,
700
],
[
700,
701
],
[
700,
702
],
[
695,
703
],
[
703,
704
],
[
704,
705
],
[
695,
706
],
[
707,
707
],
[
707,
708
],
[
708,
709
],
[
709,
710
],
[
709,
711
],
[
708,
712
],
[
712,
713
],
[
690,
714
],
[
714,
715
],
[
688,
716
],
[
716,
717
],
[
152,
718
],
[
718,
719
],
[
718,
720
],
[
720,
721
],
[
721,
722
],
[
721,
723
],
[
720,
725
],
[
725,
726
],
[
726,
727
],
[
727,
728
],
[
727,
729
],
[
725,
730
],
[
730,
731
],
[
730,
732
],
[
725,
733
],
[
733,
734
],
[
734,
735
],
[
725,
736
],
[
737,
737
],
[
737,
738
],
[
738,
739
],
[
739,
740
],
[
739,
741
],
[
738,
742
],
[
742,
743
],
[
743,
744
],
[
742,
745
],
[
720,
746
],
[
746,
747
],
[
718,
748
],
[
748,
749
],
[
152,
750
],
[
750,
751
],
[
750,
752
],
[
752,
753
],
[
753,
754
],
[
753,
755
],
[
756,
757
],
[
756,
758
],
[
752,
759
],
[
759,
760
],
[
760,
761
],
[
761,
762
],
[
761,
763
],
[
759,
764
],
[
764,
765
],
[
764,
766
],
[
759,
767
],
[
767,
768
],
[
768,
769
],
[
759,
770
],
[
771,
771
],
[
771,
772
],
[
772,
773
],
[
773,
774
],
[
773,
775
],
[
775,
776
],
[
775,
777
],
[
772,
778
],
[
778,
779
],
[
752,
780
],
[
780,
781
],
[
750,
782
],
[
782,
783
],
[
152,
784
],
[
784,
785
],
[
784,
786
],
[
786,
787
],
[
787,
788
],
[
787,
789
],
[
786,
791
],
[
791,
792
],
[
792,
793
],
[
793,
794
],
[
793,
795
],
[
791,
796
],
[
796,
797
],
[
796,
798
],
[
791,
799
],
[
799,
800
],
[
800,
801
],
[
791,
802
],
[
803,
803
],
[
803,
804
],
[
804,
805
],
[
805,
806
],
[
805,
807
],
[
804,
808
],
[
808,
809
],
[
786,
810
],
[
810,
811
],
[
784,
812
],
[
812,
813
],
[
0,
814
],
[
814,
815
],
[
814,
816
]
]
| [
"import java.io.*;\nimport java.math.BigDecimal;\nimport java.util.*;\n\n@SuppressWarnings(\"unused\")\npublic class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int X = in.nextInt(), N = in.nextInt();\n boolean[] ex = new boolean[102];\n for(int i = 0; i < N; i++){\n ex[in.nextInt()] = true;\n }\n \n int min = Integer.MAX_VALUE, v = Integer.MAX_VALUE;\n for(int i = 0; i <= 101; i++){\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }\n out.println(v);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int X = in.nextInt(), N = in.nextInt();\n boolean[] ex = new boolean[102];\n for(int i = 0; i < N; i++){\n ex[in.nextInt()] = true;\n }\n \n int min = Integer.MAX_VALUE, v = Integer.MAX_VALUE;\n for(int i = 0; i <= 101; i++){\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }\n out.println(v);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"Main",
"FastScanner in;",
"in",
"PrintWriter out;",
"out",
"final static int MOD = (int)1e9+7;",
"MOD",
"(int)1e9+7",
"(int)1e9",
"7",
"void solve(){\n int X = in.nextInt(), N = in.nextInt();\n boolean[] ex = new boolean[102];\n for(int i = 0; i < N; i++){\n ex[in.nextInt()] = true;\n }\n \n int min = Integer.MAX_VALUE, v = Integer.MAX_VALUE;\n for(int i = 0; i <= 101; i++){\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }\n out.println(v);\n }",
"solve",
"{\n int X = in.nextInt(), N = in.nextInt();\n boolean[] ex = new boolean[102];\n for(int i = 0; i < N; i++){\n ex[in.nextInt()] = true;\n }\n \n int min = Integer.MAX_VALUE, v = Integer.MAX_VALUE;\n for(int i = 0; i <= 101; i++){\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }\n out.println(v);\n }",
"int X = in.nextInt()",
"X",
"in.nextInt()",
"in.nextInt",
"in",
"N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"boolean[] ex = new boolean[102];",
"ex",
"new boolean[102]",
"102",
"for(int i = 0; i < N; i++){\n ex[in.nextInt()] = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n ex[in.nextInt()] = true;\n }",
"{\n ex[in.nextInt()] = true;\n }",
"ex[in.nextInt()] = true",
"ex[in.nextInt()]",
"ex",
"in.nextInt()",
"in.nextInt",
"in",
"true",
"int min = Integer.MAX_VALUE",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"v = Integer.MAX_VALUE;",
"v",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for(int i = 0; i <= 101; i++){\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }",
"{\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }",
"if(ex[i]) continue;",
"ex[i]",
"ex",
"i",
"continue;",
"if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }",
"min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)",
"min > Math.abs(X - i)",
"min",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"(min == Math.abs(X - i) && v > i)",
"min == Math.abs(X - i)",
"min",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"v > i",
"v",
"i",
"{\n min = Math.abs(X - i);\n v = i;\n }",
"min = Math.abs(X - i)",
"min",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"v = i",
"v",
"i",
"out.println(v)",
"out.println",
"out",
"v",
"public static void main(String[] args) {\n new Main().m();\n }",
"main",
"{\n new Main().m();\n }",
"new Main().m()",
"new Main().m",
"new Main()",
"String[] args",
"args",
"private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }",
"m",
"{\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }",
"in = new FastScanner(System.in)",
"in",
"new FastScanner(System.in)",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"solve()",
"solve",
"out.flush()",
"out.flush",
"out",
"in.close()",
"in.close",
"in",
"out.close()",
"out.close",
"out",
"static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }",
"FastScanner",
"private Reader input;",
"input",
"public FastScanner() {this(System.in);}",
"FastScanner",
"{this(System.in);}",
"this(System.in)",
"this",
"System.in",
"System",
"System.in",
"public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}",
"FastScanner",
"{this.input = new BufferedReader(new InputStreamReader(stream));}",
"this.input = new BufferedReader(new InputStreamReader(stream))",
"this.input",
"this",
"this.input",
"new BufferedReader(new InputStreamReader(stream))",
"InputStream stream",
"stream",
"public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"close",
"{\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n this.input.close();\n }",
"this.input.close()",
"this.input.close",
"this.input",
"this",
"this.input",
"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 long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }",
"nextLong",
"{\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }",
"try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }",
"catch (IOException e) {\n e.printStackTrace();\n return -1;\n }",
"IOException e",
"{\n e.printStackTrace();\n return -1;\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return -1;",
"-1",
"1",
"{\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n }",
"int sign = 1;",
"sign",
"1",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b)",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"b != '-'",
"b",
"'-'",
"b != '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }",
"b == '-'",
"b",
"'-'",
"{\n sign = -1;\n b = input.read();\n }",
"sign = -1",
"sign",
"-1",
"1",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '+') {\n b = input.read();\n }",
"b == '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"long ret = b - '0';",
"ret",
"b - '0'",
"b",
"'0'",
"while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }",
"true",
"{\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b < '0' || '9' < b) return ret * sign;",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"return ret * sign;",
"ret * sign",
"ret",
"sign",
"ret *= 10",
"ret",
"10",
"ret += b - '0'",
"ret",
"b - '0'",
"b",
"'0'",
"public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }",
"nextDouble",
"{\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }",
"try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }",
"catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }",
"IOException e",
"{\n e.printStackTrace();\n return Double.NaN;\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return Double.NaN;",
"Double.NaN",
"Double",
"Double.NaN",
"{\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n }",
"double sign = 1;",
"sign",
"1",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b)",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"b != '-'",
"b",
"'-'",
"b != '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }",
"b == '-'",
"b",
"'-'",
"{\n sign = -1;\n b = input.read();\n }",
"sign = -1",
"sign",
"-1",
"1",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '+') {\n b = input.read();\n }",
"b == '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"double ret = b - '0';",
"ret",
"b - '0'",
"b",
"'0'",
"while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }",
"true",
"{\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b < '0' || '9' < b) break;",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"break;",
"ret *= 10",
"ret",
"10",
"ret += b - '0'",
"ret",
"b - '0'",
"b",
"'0'",
"if (b != '.') return sign * ret;",
"b != '.'",
"b",
"'.'",
"return sign * ret;",
"sign * ret",
"sign",
"ret",
"double div = 1;",
"div",
"1",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }",
"ret *= 10",
"ret",
"10",
"ret += b - '0'",
"ret",
"b - '0'",
"b",
"'0'",
"div *= 10",
"div",
"10",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return sign * ret / div;",
"sign * ret / div",
"sign * ret",
"sign",
"ret",
"div",
"public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }",
"nextChar",
"{\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }",
"try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }",
"catch (IOException e) {\n e.printStackTrace();\n return 0;\n }",
"IOException e",
"{\n e.printStackTrace();\n return 0;\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return 0;",
"0",
"{\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n }",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while (Character.isWhitespace(b)) {\n b = input.read();\n }",
"Character.isWhitespace(b)",
"Character.isWhitespace",
"Character",
"b",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return (char) b;",
"(char) b",
"public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"nextStr",
"{\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"IOException e",
"{\n e.printStackTrace();\n return \"\";\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return \"\";",
"\"\"",
"{\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while (Character.isWhitespace(b)) {\n b = input.read();\n }",
"Character.isWhitespace(b)",
"Character.isWhitespace",
"Character",
"b",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }",
"b != -1 && !Character.isWhitespace(b)",
"b != -1",
"b",
"-1",
"1",
"!Character.isWhitespace(b)",
"Character.isWhitespace(b)",
"Character.isWhitespace",
"Character",
"b",
"{\n sb.append((char) b);\n b = input.read();\n }",
"sb.append((char) b)",
"sb.append",
"sb",
"(char) b",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"nextLine",
"{\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"IOException e",
"{\n e.printStackTrace();\n return \"\";\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return \"\";",
"\"\"",
"{\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }",
"b != -1 && b != '\\n'",
"b != -1",
"b",
"-1",
"1",
"b != '\\n'",
"b",
"'\\n'",
"{\n sb.append((char) b);\n b = input.read();\n }",
"sb.append((char) b)",
"sb.append",
"sb",
"(char) b",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }",
"nextIntArray",
"{\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }",
"int[] res = new int[n];",
"res",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextInt();\n }",
"{\n res[i] = nextInt();\n }",
"res[i] = nextInt()",
"res[i]",
"res",
"i",
"nextInt()",
"nextInt",
"return res;",
"res",
"int n",
"n",
"public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }",
"nextIntArrayDec",
"{\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }",
"int[] res = new int[n];",
"res",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextInt() - 1;\n }",
"{\n res[i] = nextInt() - 1;\n }",
"res[i] = nextInt() - 1",
"res[i]",
"res",
"i",
"nextInt() - 1",
"nextInt()",
"nextInt",
"1",
"return res;",
"res",
"int n",
"n",
"public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }",
"nextIntArray1Index",
"{\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }",
"int[] res = new int[n + 1];",
"res",
"new int[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i + 1] = nextInt();\n }",
"{\n res[i + 1] = nextInt();\n }",
"res[i + 1] = nextInt()",
"res[i + 1]",
"res",
"i + 1",
"i",
"1",
"nextInt()",
"nextInt",
"return res;",
"res",
"int n",
"n",
"public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }",
"nextLongArray",
"{\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }",
"long[] res = new long[n];",
"res",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextLong();\n }",
"{\n res[i] = nextLong();\n }",
"res[i] = nextLong()",
"res[i]",
"res",
"i",
"nextLong()",
"nextLong",
"return res;",
"res",
"int n",
"n",
"public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }",
"nextLongArrayDec",
"{\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }",
"long[] res = new long[n];",
"res",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextLong() - 1;\n }",
"{\n res[i] = nextLong() - 1;\n }",
"res[i] = nextLong() - 1",
"res[i]",
"res",
"i",
"nextLong() - 1",
"nextLong()",
"nextLong",
"1",
"return res;",
"res",
"int n",
"n",
"public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }",
"nextLongArray1Index",
"{\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }",
"long[] res = new long[n + 1];",
"res",
"new long[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i + 1] = nextLong();\n }",
"{\n res[i + 1] = nextLong();\n }",
"res[i + 1] = nextLong()",
"res[i + 1]",
"res",
"i + 1",
"i",
"1",
"nextLong()",
"nextLong",
"return res;",
"res",
"int n",
"n",
"public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }",
"nextDoubleArray",
"{\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }",
"double[] res = new double[n];",
"res",
"new double[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextDouble();\n }",
"{\n res[i] = nextDouble();\n }",
"res[i] = nextDouble()",
"res[i]",
"res",
"i",
"nextDouble()",
"nextDouble",
"return res;",
"res",
"int n",
"n",
"public class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int X = in.nextInt(), N = in.nextInt();\n boolean[] ex = new boolean[102];\n for(int i = 0; i < N; i++){\n ex[in.nextInt()] = true;\n }\n \n int min = Integer.MAX_VALUE, v = Integer.MAX_VALUE;\n for(int i = 0; i <= 101; i++){\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }\n out.println(v);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"public class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int X = in.nextInt(), N = in.nextInt();\n boolean[] ex = new boolean[102];\n for(int i = 0; i < N; i++){\n ex[in.nextInt()] = true;\n }\n \n int min = Integer.MAX_VALUE, v = Integer.MAX_VALUE;\n for(int i = 0; i <= 101; i++){\n if(ex[i]) continue;\n if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){\n min = Math.abs(X - i);\n v = i;\n }\n }\n out.println(v);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"Main"
]
| import java.io.*;
import java.math.BigDecimal;
import java.util.*;
@SuppressWarnings("unused")
public class Main {
FastScanner in;
PrintWriter out;
final static int MOD = (int)1e9+7;
void solve(){
int X = in.nextInt(), N = in.nextInt();
boolean[] ex = new boolean[102];
for(int i = 0; i < N; i++){
ex[in.nextInt()] = true;
}
int min = Integer.MAX_VALUE, v = Integer.MAX_VALUE;
for(int i = 0; i <= 101; i++){
if(ex[i]) continue;
if(min > Math.abs(X - i) || (min == Math.abs(X - i) && v > i)){
min = Math.abs(X - i);
v = i;
}
}
out.println(v);
}
public static void main(String[] args) {
new Main().m();
}
private void m() {
in = new FastScanner(System.in);
out = new PrintWriter(System.out);
/*
try {
String path = "input.txt";
out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));
}catch (IOException e){
e.printStackTrace();
}
*/
solve();
out.flush();
in.close();
out.close();
}
static class FastScanner {
private Reader input;
public FastScanner() {this(System.in);}
public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}
public void close() {
try {
this.input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
return (int) nl;
}
public long nextLong() {
try {
int sign = 1;
int b = input.read();
while ((b < '0' || '9' < b) && b != '-' && b != '+') {
b = input.read();
}
if (b == '-') {
sign = -1;
b = input.read();
} else if (b == '+') {
b = input.read();
}
long ret = b - '0';
while (true) {
b = input.read();
if (b < '0' || '9' < b) return ret * sign;
ret *= 10;
ret += b - '0';
}
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
public double nextDouble() {
try {
double sign = 1;
int b = input.read();
while ((b < '0' || '9' < b) && b != '-' && b != '+') {
b = input.read();
}
if (b == '-') {
sign = -1;
b = input.read();
} else if (b == '+') {
b = input.read();
}
double ret = b - '0';
while (true) {
b = input.read();
if (b < '0' || '9' < b) break;
ret *= 10;
ret += b - '0';
}
if (b != '.') return sign * ret;
double div = 1;
b = input.read();
while ('0' <= b && b <= '9') {
ret *= 10;
ret += b - '0';
div *= 10;
b = input.read();
}
return sign * ret / div;
} catch (IOException e) {
e.printStackTrace();
return Double.NaN;
}
}
public char nextChar() {
try {
int b = input.read();
while (Character.isWhitespace(b)) {
b = input.read();
}
return (char) b;
} catch (IOException e) {
e.printStackTrace();
return 0;
}
}
public String nextStr() {
try {
StringBuilder sb = new StringBuilder();
int b = input.read();
while (Character.isWhitespace(b)) {
b = input.read();
}
while (b != -1 && !Character.isWhitespace(b)) {
sb.append((char) b);
b = input.read();
}
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
return "";
}
}
public String nextLine() {
try {
StringBuilder sb = new StringBuilder();
int b = input.read();
while (b != -1 && b != '\n') {
sb.append((char) b);
b = input.read();
}
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
return "";
}
}
public int[] nextIntArray(int n) {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = nextInt();
}
return res;
}
public int[] nextIntArrayDec(int n) {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = nextInt() - 1;
}
return res;
}
public int[] nextIntArray1Index(int n) {
int[] res = new int[n + 1];
for (int i = 0; i < n; i++) {
res[i + 1] = nextInt();
}
return res;
}
public long[] nextLongArray(int n) {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nextLong();
}
return res;
}
public long[] nextLongArrayDec(int n) {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nextLong() - 1;
}
return res;
}
public long[] nextLongArray1Index(int n) {
long[] res = new long[n + 1];
for (int i = 0; i < n; i++) {
res[i + 1] = nextLong();
}
return res;
}
public double[] nextDoubleArray(int n) {
double[] res = new double[n];
for (int i = 0; i < n; i++) {
res[i] = nextDouble();
}
return res;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
2,
13,
17,
41,
13,
2,
13,
17,
41,
13,
40,
17,
0,
13,
4,
13,
13,
13,
13,
42,
2,
13,
40,
17,
30,
0,
13,
4,
13,
13,
13,
13,
14,
2,
13,
40,
17,
3,
0,
13,
4,
13,
13,
13,
13,
40,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
13,
17,
30,
0,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
155,
5
],
[
155,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
8,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
8,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
62,
65
],
[
62,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
67,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
75,
78
],
[
75,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
80,
85
],
[
72,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
88,
92
],
[
72,
93
],
[
93,
94
],
[
72,
95
],
[
95,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
6,
103
],
[
103,
104
],
[
155,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
115,
126
],
[
127,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
107,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
107,
146
],
[
146,
147
],
[
105,
148
],
[
148,
149
],
[
105,
150
],
[
150,
151
],
[
105,
152
],
[
152,
153
],
[
0,
154
],
[
154,
155
],
[
154,
156
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\tint upper = X+1;\n\t\tint lower = X-1;\n\t\tint ans = -1;\n\n\t\tans = judge(N, p, X);\n\n\t\twhile (ans == -1) {\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int judge(int N, int[] p, int k) {\n\t\tint f = 0;\n\t\tint ans = -1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (f == 0) {\n\t\t\tans = k;\n\t\t}\n\t\treturn ans;\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\tint upper = X+1;\n\t\tint lower = X-1;\n\t\tint ans = -1;\n\n\t\tans = judge(N, p, X);\n\n\t\twhile (ans == -1) {\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int judge(int N, int[] p, int k) {\n\t\tint f = 0;\n\t\tint ans = -1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (f == 0) {\n\t\t\tans = k;\n\t\t}\n\t\treturn ans;\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\tint upper = X+1;\n\t\tint lower = X-1;\n\t\tint ans = -1;\n\n\t\tans = judge(N, p, X);\n\n\t\twhile (ans == -1) {\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\tint upper = X+1;\n\t\tint lower = X-1;\n\t\tint ans = -1;\n\n\t\tans = judge(N, p, X);\n\n\t\twhile (ans == -1) {\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int X = scan.nextInt();",
"X",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] p = new int[N];",
"p",
"new int[N]",
"N",
"for(int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tp[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tp[i] = scan.nextInt();\n\t\t}",
"p[i] = scan.nextInt()",
"p[i]",
"p",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int upper = X+1;",
"upper",
"X+1",
"X",
"1",
"int lower = X-1;",
"lower",
"X-1",
"X",
"1",
"int ans = -1;",
"ans",
"-1",
"1",
"ans = judge(N, p, X)",
"ans",
"judge(N, p, X)",
"judge",
"N",
"p",
"X",
"while (ans == -1) {\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}",
"ans == -1",
"ans",
"-1",
"1",
"{\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}",
"ans = judge(N, p, lower)",
"ans",
"judge(N, p, lower)",
"judge",
"N",
"p",
"lower",
"if (ans != -1) break;",
"ans != -1",
"ans",
"-1",
"1",
"break;",
"ans = judge(N, p, upper)",
"ans",
"judge(N, p, upper)",
"judge",
"N",
"p",
"upper",
"upper++",
"upper",
"lower--",
"lower",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public static int judge(int N, int[] p, int k) {\n\t\tint f = 0;\n\t\tint ans = -1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (f == 0) {\n\t\t\tans = k;\n\t\t}\n\t\treturn ans;\n\n\t}",
"judge",
"{\n\t\tint f = 0;\n\t\tint ans = -1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (f == 0) {\n\t\t\tans = k;\n\t\t}\n\t\treturn ans;\n\n\t}",
"int f = 0;",
"f",
"0",
"int ans = -1;",
"ans",
"-1",
"1",
"for(int i = 0; i < N; i++) {\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}",
"k == p[i]",
"k",
"p[i]",
"p",
"i",
"{\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}",
"f++",
"f",
"break;",
"if (f == 0) {\n\t\t\tans = k;\n\t\t}",
"f == 0",
"f",
"0",
"{\n\t\t\tans = k;\n\t\t}",
"ans = k",
"ans",
"k",
"return ans;",
"ans",
"int N",
"N",
"int[] p",
"p",
"int k",
"k",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\tint upper = X+1;\n\t\tint lower = X-1;\n\t\tint ans = -1;\n\n\t\tans = judge(N, p, X);\n\n\t\twhile (ans == -1) {\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int judge(int N, int[] p, int k) {\n\t\tint f = 0;\n\t\tint ans = -1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (f == 0) {\n\t\t\tans = k;\n\t\t}\n\t\treturn ans;\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\tint upper = X+1;\n\t\tint lower = X-1;\n\t\tint ans = -1;\n\n\t\tans = judge(N, p, X);\n\n\t\twhile (ans == -1) {\n\t\t\tans = judge(N, p, lower);\n\t\t\tif (ans != -1) break;\n\t\t\tans = judge(N, p, upper);\n\t\t\tupper++;\n\t\t\tlower--;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int judge(int N, int[] p, int k) {\n\t\tint f = 0;\n\t\tint ans = -1;\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif (k == p[i]) {\n\t\t\t\tf++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (f == 0) {\n\t\t\tans = k;\n\t\t}\n\t\treturn ans;\n\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int X = scan.nextInt();
int N = scan.nextInt();
int[] p = new int[N];
for(int i = 0; i < N; i++) {
p[i] = scan.nextInt();
}
int upper = X+1;
int lower = X-1;
int ans = -1;
ans = judge(N, p, X);
while (ans == -1) {
ans = judge(N, p, lower);
if (ans != -1) break;
ans = judge(N, p, upper);
upper++;
lower--;
}
System.out.println(ans);
}
public static int judge(int N, int[] p, int k) {
int f = 0;
int ans = -1;
for(int i = 0; i < N; i++) {
if (k == p[i]) {
f++;
break;
}
}
if (f == 0) {
ans = k;
}
return ans;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
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,
41,
13,
2,
17,
17,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
13,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
40,
4,
18,
13,
13,
2,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
13,
0,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
0,
18,
36,
13,
20,
23,
13,
12,
13,
30,
4,
18,
13,
12,
13,
30,
4,
18,
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,
30,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
4,
18,
13,
13,
29,
4,
13,
13,
23,
13,
12,
13,
30,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
12,
13,
30,
29,
4,
13,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
17,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
13,
29,
13,
23,
13,
23,
13,
6,
13,
12,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
34,
35
],
[
34,
36
],
[
0,
37
],
[
37,
38
],
[
37,
39
],
[
0,
40
],
[
436,
41
],
[
436,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
47,
49
],
[
44,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
44,
55
],
[
55,
56
],
[
55,
57
],
[
44,
58
],
[
58,
59
],
[
58,
60
],
[
44,
61
],
[
61,
62
],
[
61,
63
],
[
44,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
64,
68
],
[
64,
69
],
[
44,
70
],
[
70,
71
],
[
71,
72
],
[
42,
73
],
[
73,
74
],
[
436,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
75,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
84,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
95,
96
],
[
95,
97
],
[
84,
98
],
[
98,
99
],
[
98,
100
],
[
84,
101
],
[
101,
102
],
[
101,
103
],
[
84,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
116,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
118,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
126,
129
],
[
129,
130
],
[
129,
131
],
[
117,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
141,
142
],
[
141,
143
],
[
84,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
82,
148
],
[
148,
149
],
[
82,
150
],
[
150,
151
],
[
82,
152
],
[
152,
153
],
[
436,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
154,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
164,
165
],
[
154,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
166,
174
],
[
174,
175
],
[
154,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
154,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
185,
188
],
[
182,
189
],
[
189,
190
],
[
436,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
191,
195
],
[
195,
196
],
[
195,
197
],
[
191,
199
],
[
199,
200
],
[
191,
201
],
[
201,
202
],
[
191,
203
],
[
203,
204
],
[
191,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
205,
213
],
[
213,
214
],
[
191,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
218,
223
],
[
223,
224
],
[
224,
225
],
[
217,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
226,
230
],
[
230,
231
],
[
231,
232
],
[
231,
233
],
[
230,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
238,
239
],
[
234,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
243,
244
],
[
244,
245
],
[
243,
246
],
[
230,
247
],
[
247,
248
],
[
248,
249
],
[
248,
250
],
[
247,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
217,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
258,
259
],
[
191,
260
],
[
260,
261
],
[
260,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
262,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
267,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
262,
276
],
[
276,
277
],
[
276,
278
],
[
262,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
279,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
286,
287
],
[
283,
288
],
[
288,
289
],
[
288,
290
],
[
290,
291
],
[
262,
292
],
[
292,
293
],
[
292,
294
],
[
262,
295
],
[
295,
296
],
[
296,
297
],
[
297,
298
],
[
297,
299
],
[
295,
300
],
[
300,
301
],
[
301,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
302,
306
],
[
306,
307
],
[
306,
308
],
[
301,
309
],
[
309,
310
],
[
310,
311
],
[
300,
312
],
[
312,
313
],
[
312,
314
],
[
300,
315
],
[
315,
316
],
[
315,
317
],
[
317,
318
],
[
317,
319
],
[
300,
320
],
[
320,
321
],
[
320,
322
],
[
322,
323
],
[
262,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
191,
328
],
[
328,
329
],
[
328,
330
],
[
330,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
331,
335
],
[
335,
336
],
[
336,
337
],
[
337,
338
],
[
338,
339
],
[
337,
340
],
[
330,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
328,
345
],
[
345,
346
],
[
191,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
350,
351
],
[
354,
352
],
[
364,
353
],
[
361,
354
],
[
354,
355
],
[
355,
356
],
[
355,
357
],
[
354,
358
],
[
358,
359
],
[
358,
360
],
[
361,
361
],
[
361,
362
],
[
361,
363
],
[
364,
364
],
[
364,
365
],
[
364,
366
],
[
354,
367
],
[
367,
368
],
[
367,
369
],
[
369,
370
],
[
347,
371
],
[
371,
372
],
[
191,
373
],
[
373,
374
],
[
373,
375
],
[
375,
376
],
[
376,
377
],
[
377,
378
],
[
377,
379
],
[
377,
380
],
[
373,
381
],
[
381,
382
],
[
191,
383
],
[
383,
384
],
[
383,
385
],
[
385,
386
],
[
386,
387
],
[
386,
388
],
[
385,
389
],
[
389,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
389,
394
],
[
394,
395
],
[
394,
396
],
[
389,
397
],
[
397,
398
],
[
398,
399
],
[
389,
400
],
[
401,
401
],
[
401,
402
],
[
402,
403
],
[
403,
404
],
[
402,
405
],
[
385,
406
],
[
406,
407
],
[
407,
408
],
[
408,
409
],
[
408,
410
],
[
406,
411
],
[
411,
412
],
[
411,
413
],
[
406,
414
],
[
414,
415
],
[
415,
416
],
[
406,
417
],
[
417,
418
],
[
418,
419
],
[
419,
420
],
[
418,
421
],
[
421,
422
],
[
385,
423
],
[
423,
424
],
[
383,
425
],
[
425,
426
],
[
383,
427
],
[
427,
428
],
[
191,
429
],
[
429,
430
],
[
429,
431
],
[
431,
432
],
[
431,
433
],
[
433,
434
],
[
0,
435
],
[
435,
436
],
[
435,
437
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.HashSet;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.ArrayList;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n int IINF = (int) 1e9 + 331;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int min = IINF;\n int ans = 0;\n HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));\n for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }\n out.println(ans);\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public ArrayList<Integer> nextIntArrayList(int n) {\n return nextIntArrayList(n, 0);\n }\n\n public ArrayList<Integer> nextIntArrayList(int n, int startFrom) {\n ArrayList<Integer> list = new ArrayList<>(n);\n for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }\n for (int i = startFrom; i < n; ++i) list.add(nextInt());\n return list;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\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.util.HashSet;",
"HashSet",
"java.util",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.io.BufferedWriter;",
"BufferedWriter",
"java.io",
"import java.io.Writer;",
"Writer",
"java.io",
"import java.io.OutputStreamWriter;",
"OutputStreamWriter",
"java.io",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n int IINF = (int) 1e9 + 331;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int min = IINF;\n int ans = 0;\n HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));\n for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }\n out.println(ans);\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public ArrayList<Integer> nextIntArrayList(int n) {\n return nextIntArrayList(n, 0);\n }\n\n public ArrayList<Integer> nextIntArrayList(int n, int startFrom) {\n ArrayList<Integer> list = new ArrayList<>(n);\n for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }\n for (int i = startFrom; i < n; ++i) list.add(nextInt());\n return list;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"OutputWriter out = new OutputWriter(outputStream);",
"out",
"new OutputWriter(outputStream)",
"CForbiddenList solver = new CForbiddenList();",
"solver",
"new CForbiddenList()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class CForbiddenList {\n int IINF = (int) 1e9 + 331;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int min = IINF;\n int ans = 0;\n HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));\n for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }\n out.println(ans);\n }\n\n }",
"CForbiddenList",
"int IINF = (int) 1e9 + 331;",
"IINF",
"(int) 1e9 + 331",
"(int) 1e9",
"331",
"public void solve(int testNumber, InputReader in, OutputWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int min = IINF;\n int ans = 0;\n HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));\n for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }\n out.println(ans);\n }",
"solve",
"{\n int x = in.nextInt();\n int n = in.nextInt();\n int min = IINF;\n int ans = 0;\n HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));\n for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }\n out.println(ans);\n }",
"int x = in.nextInt();",
"x",
"in.nextInt()",
"in.nextInt",
"in",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int min = IINF;",
"min",
"IINF",
"int ans = 0;",
"ans",
"0",
"HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));",
"hs",
"new HashSet<>(in.nextIntArrayList(n))",
"for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }",
"{\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }",
"if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }",
"!hs.contains(i) && min > Math.abs(x - i)",
"!hs.contains(i)",
"hs.contains(i)",
"hs.contains",
"hs",
"i",
"min > Math.abs(x - i)",
"min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"{\n ans = i;\n min = Math.abs(x - i);\n }",
"ans = i",
"ans",
"i",
"min = Math.abs(x - i)",
"min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"out.println(ans)",
"out.println",
"out",
"ans",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"OutputWriter out",
"out",
"static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }",
"OutputWriter",
"private final PrintWriter writer;",
"writer",
"public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }",
"OutputWriter",
"{\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }",
"writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)))",
"writer",
"new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)))",
"OutputStream outputStream",
"outputStream",
"public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }",
"OutputWriter",
"{\n this.writer = new PrintWriter(writer);\n }",
"this.writer = new PrintWriter(writer)",
"this.writer",
"this",
"this.writer",
"new PrintWriter(writer)",
"Writer writer",
"writer",
"public void close() {\n writer.close();\n }",
"close",
"{\n writer.close();\n }",
"writer.close()",
"writer.close",
"writer",
"public void println(long i) {\n writer.println(i);\n }",
"println",
"{\n writer.println(i);\n }",
"writer.println(i)",
"writer.println",
"writer",
"i",
"long i",
"i",
"static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public ArrayList<Integer> nextIntArrayList(int n) {\n return nextIntArrayList(n, 0);\n }\n\n public ArrayList<Integer> nextIntArrayList(int n, int startFrom) {\n ArrayList<Integer> list = new ArrayList<>(n);\n for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }\n for (int i = startFrom; i < n; ++i) list.add(nextInt());\n return list;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private InputReader.SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"read",
"{\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"if (numChars == -1) {\n throw new InputMismatchException();\n }",
"numChars == -1",
"numChars",
"-1",
"1",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0) {\n return -1;\n }",
"numChars <= 0",
"numChars",
"0",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }",
"if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"isSpaceChar",
"{\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"if (filter != null) {\n return filter.isSpaceChar(c);\n }",
"filter != null",
"filter",
"null",
"{\n return filter.isSpaceChar(c);\n }",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return isWhitespace(c);",
"isWhitespace(c)",
"isWhitespace",
"c",
"int c",
"c",
"public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isWhitespace",
"{\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public ArrayList<Integer> nextIntArrayList(int n) {\n return nextIntArrayList(n, 0);\n }",
"nextIntArrayList",
"{\n return nextIntArrayList(n, 0);\n }",
"return nextIntArrayList(n, 0);",
"nextIntArrayList(n, 0)",
"nextIntArrayList",
"n",
"0",
"int n",
"n",
"public ArrayList<Integer> nextIntArrayList(int n, int startFrom) {\n ArrayList<Integer> list = new ArrayList<>(n);\n for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }\n for (int i = startFrom; i < n; ++i) list.add(nextInt());\n return list;\n }",
"nextIntArrayList",
"{\n ArrayList<Integer> list = new ArrayList<>(n);\n for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }\n for (int i = startFrom; i < n; ++i) list.add(nextInt());\n return list;\n }",
"ArrayList<Integer> list = new ArrayList<>(n);",
"list",
"new ArrayList<>(n)",
"for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < startFrom",
"i",
"startFrom",
"i++",
"i++",
"i",
"{\n list.add(0);\n }",
"{\n list.add(0);\n }",
"list.add(0)",
"list.add",
"list",
"0",
"for (int i = startFrom; i < n; ++i) list.add(nextInt());",
"int i = startFrom;",
"int i = startFrom;",
"i",
"startFrom",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"list.add(nextInt());",
"list.add(nextInt())",
"list.add",
"list",
"nextInt()",
"nextInt",
"return list;",
"list",
"int n",
"n",
"int startFrom",
"startFrom",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n int IINF = (int) 1e9 + 331;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int min = IINF;\n int ans = 0;\n HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));\n for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }\n out.println(ans);\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public ArrayList<Integer> nextIntArrayList(int n) {\n return nextIntArrayList(n, 0);\n }\n\n public ArrayList<Integer> nextIntArrayList(int n, int startFrom) {\n ArrayList<Integer> list = new ArrayList<>(n);\n for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }\n for (int i = startFrom; i < n; ++i) list.add(nextInt());\n return list;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n int IINF = (int) 1e9 + 331;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int min = IINF;\n int ans = 0;\n HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));\n for (int i = 0; i <= 101; i++) {\n if (!hs.contains(i) && min > Math.abs(x - i)) {\n ans = i;\n min = Math.abs(x - i);\n }\n }\n out.println(ans);\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public ArrayList<Integer> nextIntArrayList(int n) {\n return nextIntArrayList(n, 0);\n }\n\n public ArrayList<Integer> nextIntArrayList(int n, int startFrom) {\n ArrayList<Integer> list = new ArrayList<>(n);\n for (int i = 0; i < startFrom; i++) {\n list.add(0);\n }\n for (int i = startFrom; i < n; ++i) list.add(nextInt());\n return list;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"Main"
]
| import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
CForbiddenList solver = new CForbiddenList();
solver.solve(1, in, out);
out.close();
}
static class CForbiddenList {
int IINF = (int) 1e9 + 331;
public void solve(int testNumber, InputReader in, OutputWriter out) {
int x = in.nextInt();
int n = in.nextInt();
int min = IINF;
int ans = 0;
HashSet<Integer> hs = new HashSet<>(in.nextIntArrayList(n));
for (int i = 0; i <= 101; i++) {
if (!hs.contains(i) && min > Math.abs(x - i)) {
ans = i;
min = Math.abs(x - i);
}
}
out.println(ans);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void close() {
writer.close();
}
public void println(long i) {
writer.println(i);
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public ArrayList<Integer> nextIntArrayList(int n) {
return nextIntArrayList(n, 0);
}
public ArrayList<Integer> nextIntArrayList(int n, int startFrom) {
ArrayList<Integer> list = new ArrayList<>(n);
for (int i = 0; i < startFrom; i++) {
list.add(0);
}
for (int i = startFrom; i < n; ++i) list.add(nextInt());
return list;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
|
[
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,
4,
18,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
4,
18,
13,
17,
41,
13,
17,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
0,
13,
13,
3,
14,
2,
18,
13,
13,
17,
9,
14,
2,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
37,
20,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
369,
11
],
[
369,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
45,
51
],
[
14,
52
],
[
52,
53
],
[
52,
54
],
[
14,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
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
],
[
78,
80
],
[
77,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
82,
88
],
[
72,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
95,
97
],
[
89,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
98,
107
],
[
107,
108
],
[
107,
109
],
[
14,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
12,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
125,
127
],
[
118,
129
],
[
129,
130
],
[
129,
131
],
[
118,
132
],
[
132,
133
],
[
132,
134
],
[
118,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
138,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
149,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
145,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
168,
169
],
[
137,
170
],
[
170,
171
],
[
118,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
175,
183
],
[
183,
184
],
[
184,
185
],
[
118,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
194,
195
],
[
194,
196
],
[
186,
197
],
[
197,
198
],
[
118,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
203,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
209,
211
],
[
202,
212
],
[
212,
213
],
[
201,
214
],
[
214,
215
],
[
215,
216
],
[
118,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
220,
224
],
[
224,
225
],
[
219,
226
],
[
226,
227
],
[
226,
228
],
[
219,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
219,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
238,
241
],
[
237,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
219,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
118,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
253,
257
],
[
257,
258
],
[
252,
259
],
[
259,
260
],
[
259,
261
],
[
252,
262
],
[
262,
263
],
[
262,
264
],
[
252,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
252,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
269,
273
],
[
273,
274
],
[
274,
275
],
[
274,
276
],
[
273,
277
],
[
277,
278
],
[
277,
279
],
[
279,
280
],
[
252,
281
],
[
281,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
286,
287
],
[
286,
288
],
[
281,
289
],
[
289,
290
],
[
290,
291
],
[
252,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
295,
296
],
[
296,
297
],
[
297,
298
],
[
297,
299
],
[
296,
300
],
[
300,
301
],
[
300,
302
],
[
295,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
303,
307
],
[
307,
308
],
[
307,
309
],
[
309,
310
],
[
309,
311
],
[
295,
312
],
[
312,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
316,
317
],
[
313,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
312,
322
],
[
322,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
324,
328
],
[
312,
329
],
[
329,
330
],
[
330,
331
],
[
294,
332
],
[
332,
333
],
[
332,
334
],
[
334,
335
],
[
118,
336
],
[
336,
337
],
[
336,
338
],
[
338,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
338,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
347,
349
],
[
344,
350
],
[
350,
351
],
[
350,
352
],
[
352,
353
],
[
352,
354
],
[
343,
355
],
[
355,
356
],
[
338,
357
],
[
357,
358
],
[
118,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
362,
363
],
[
363,
364
],
[
364,
365
],
[
363,
366
],
[
366,
367
],
[
0,
368
],
[
368,
369
],
[
368,
370
]
]
| [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int X = fs.nextInt();\n int N = fs.nextInt();\n int[] arr = new int[102];\n\n for (int i = 0; i < N; ++i) {\n arr[fs.nextInt()] = 1;\n }\n\n int ans = 0;\n int tmp = Integer.MAX_VALUE;\n for (int i = 0; i <= 101; ++i) {\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }\n\n System.out.println(ans);\n }\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() { return Double.parseDouble(next());}\n}\n\n",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int X = fs.nextInt();\n int N = fs.nextInt();\n int[] arr = new int[102];\n\n for (int i = 0; i < N; ++i) {\n arr[fs.nextInt()] = 1;\n }\n\n int ans = 0;\n int tmp = Integer.MAX_VALUE;\n for (int i = 0; i <= 101; ++i) {\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int X = fs.nextInt();\n int N = fs.nextInt();\n int[] arr = new int[102];\n\n for (int i = 0; i < N; ++i) {\n arr[fs.nextInt()] = 1;\n }\n\n int ans = 0;\n int tmp = Integer.MAX_VALUE;\n for (int i = 0; i <= 101; ++i) {\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }\n\n System.out.println(ans);\n }",
"main",
"{\n FastScanner fs = new FastScanner();\n int X = fs.nextInt();\n int N = fs.nextInt();\n int[] arr = new int[102];\n\n for (int i = 0; i < N; ++i) {\n arr[fs.nextInt()] = 1;\n }\n\n int ans = 0;\n int tmp = Integer.MAX_VALUE;\n for (int i = 0; i <= 101; ++i) {\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }\n\n System.out.println(ans);\n }",
"FastScanner fs = new FastScanner();",
"fs",
"new FastScanner()",
"int X = fs.nextInt();",
"X",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int N = fs.nextInt();",
"N",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int[] arr = new int[102];",
"arr",
"new int[102]",
"102",
"for (int i = 0; i < N; ++i) {\n arr[fs.nextInt()] = 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"++i",
"++i",
"i",
"{\n arr[fs.nextInt()] = 1;\n }",
"{\n arr[fs.nextInt()] = 1;\n }",
"arr[fs.nextInt()] = 1",
"arr[fs.nextInt()]",
"arr",
"fs.nextInt()",
"fs.nextInt",
"fs",
"1",
"int ans = 0;",
"ans",
"0",
"int tmp = Integer.MAX_VALUE;",
"tmp",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for (int i = 0; i <= 101; ++i) {\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"++i",
"++i",
"i",
"{\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }",
"{\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }",
"if (N == 0) {\n ans = X;\n break;\n }",
"N == 0",
"N",
"0",
"{\n ans = X;\n break;\n }",
"ans = X",
"ans",
"X",
"break;",
"if (arr[i] == 1) continue;",
"arr[i] == 1",
"arr[i]",
"arr",
"i",
"1",
"continue;",
"if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }",
"tmp > Math.abs(X - i)",
"tmp",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"{\n tmp = Math.abs(X - i);\n ans = i;\n }",
"tmp = Math.abs(X - i)",
"tmp",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"ans = i",
"ans",
"i",
"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\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() { return Double.parseDouble(next());}\n}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"hasNextByte",
"{\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr < buflen",
"ptr",
"buflen",
"{\n return true;\n }",
"return true;",
"true",
"{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr = 0",
"ptr",
"0",
"try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}",
"readByte",
"{ if (hasNextByte()) return buffer[ptr++]; else return -1;}",
"if (hasNextByte()) return buffer[ptr++]; else return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}",
"isPrintableChar",
"{ return 33 <= c && c <= 126;}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}",
"hasNext",
"{ while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}",
"while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"next",
"{\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n sb.appendCodePoint(b);\n b = readByte();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"nextLong",
"{\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n minus = true;\n b = readByte();\n }",
"b == '-'",
"b",
"'-'",
"{\n minus = true;\n b = readByte();\n }",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"true",
"{\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n n *= 10;\n n += b - '0';\n }",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n return minus ? -n : n;\n }",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();",
"nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE",
"nl < Integer.MIN_VALUE",
"nl",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"nl > Integer.MAX_VALUE",
"nl",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public double nextDouble() { return Double.parseDouble(next());}",
"nextDouble",
"{ return Double.parseDouble(next());}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int X = fs.nextInt();\n int N = fs.nextInt();\n int[] arr = new int[102];\n\n for (int i = 0; i < N; ++i) {\n arr[fs.nextInt()] = 1;\n }\n\n int ans = 0;\n int tmp = Integer.MAX_VALUE;\n for (int i = 0; i <= 101; ++i) {\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }\n\n System.out.println(ans);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int X = fs.nextInt();\n int N = fs.nextInt();\n int[] arr = new int[102];\n\n for (int i = 0; i < N; ++i) {\n arr[fs.nextInt()] = 1;\n }\n\n int ans = 0;\n int tmp = Integer.MAX_VALUE;\n for (int i = 0; i <= 101; ++i) {\n if (N == 0) {\n ans = X;\n break;\n }\n if (arr[i] == 1) continue;\n if (tmp > Math.abs(X - i)) {\n tmp = Math.abs(X - i);\n ans = i;\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
int X = fs.nextInt();
int N = fs.nextInt();
int[] arr = new int[102];
for (int i = 0; i < N; ++i) {
arr[fs.nextInt()] = 1;
}
int ans = 0;
int tmp = Integer.MAX_VALUE;
for (int i = 0; i <= 101; ++i) {
if (N == 0) {
ans = X;
break;
}
if (arr[i] == 1) continue;
if (tmp > Math.abs(X - i)) {
tmp = Math.abs(X - i);
ans = i;
}
}
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,
4,
18,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
13,
41,
13,
18,
13,
13,
28,
13,
4,
18,
13,
30,
30,
41,
13,
4,
18,
13,
13,
14,
2,
2,
13,
13,
40,
4,
18,
13,
13,
30,
0,
13,
13,
0,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
132,
5
],
[
132,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
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
],
[
50,
53
],
[
53,
54
],
[
54,
55
],
[
33,
56
],
[
56,
57
],
[
56,
58
],
[
33,
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
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
77,
79
],
[
71,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
80,
84
],
[
33,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
33,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
90,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
96,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
8,
120
],
[
120,
121
],
[
121,
122
],
[
8,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
6,
129
],
[
129,
130
],
[
0,
131
],
[
131,
132
],
[
131,
133
]
]
| [
"import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int res = 0;\n if (N == 0) {\n res = X;\n } else {\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }\n sc.close();\n System.out.println(res);\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 X = sc.nextInt();\n int N = sc.nextInt();\n int res = 0;\n if (N == 0) {\n res = X;\n } else {\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }\n sc.close();\n System.out.println(res);\n\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int res = 0;\n if (N == 0) {\n res = X;\n } else {\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }\n sc.close();\n System.out.println(res);\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int res = 0;\n if (N == 0) {\n res = X;\n } else {\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }\n sc.close();\n System.out.println(res);\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int res = 0;",
"res",
"0",
"if (N == 0) {\n res = X;\n } else {\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }",
"N == 0",
"N",
"0",
"{\n res = X;\n }",
"res = X",
"res",
"X",
"{\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }",
"List<Integer> array = new ArrayList<>();",
"array",
"new ArrayList<>()",
"for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n array.add(sc.nextInt());\n }",
"{\n array.add(sc.nextInt());\n }",
"array.add(sc.nextInt())",
"array.add",
"array",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Map<Integer, Integer> absMap = new HashMap<>();",
"absMap",
"new HashMap<>()",
"for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 105",
"i",
"105",
"i++",
"i++",
"i",
"{\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }",
"{\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }",
"int abs = Math.abs(X - i);",
"abs",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"absMap.put(i, abs)",
"absMap.put",
"absMap",
"i",
"abs",
"int minVal = Integer.MAX_VALUE;",
"minVal",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }",
"int i",
"absMap.keySet()",
"absMap.keySet",
"absMap",
"{\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }",
"{\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }",
"int val = absMap.get(i);",
"val",
"absMap.get(i)",
"absMap.get",
"absMap",
"i",
"if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }",
"val < minVal && !array.contains(i)",
"val < minVal",
"val",
"minVal",
"!array.contains(i)",
"array.contains(i)",
"array.contains",
"array",
"i",
"{\n res = i;\n minVal = val;\n }",
"res = i",
"res",
"i",
"minVal = val",
"minVal",
"val",
"sc.close()",
"sc.close",
"sc",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int res = 0;\n if (N == 0) {\n res = X;\n } else {\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }\n sc.close();\n System.out.println(res);\n\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int res = 0;\n if (N == 0) {\n res = X;\n } else {\n List<Integer> array = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n array.add(sc.nextInt());\n }\n Map<Integer, Integer> absMap = new HashMap<>();\n for (int i = 0; i <= 105; i++) {\n int abs = Math.abs(X - i);\n absMap.put(i, abs);\n }\n\n int minVal = Integer.MAX_VALUE;\n for (int i : absMap.keySet()) {\n int val = absMap.get(i);\n if (val < minVal && !array.contains(i)) {\n res = i;\n minVal = val;\n }\n }\n }\n sc.close();\n System.out.println(res);\n\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
int res = 0;
if (N == 0) {
res = X;
} else {
List<Integer> array = new ArrayList<>();
for (int i = 0; i < N; i++) {
array.add(sc.nextInt());
}
Map<Integer, Integer> absMap = new HashMap<>();
for (int i = 0; i <= 105; i++) {
int abs = Math.abs(X - i);
absMap.put(i, abs);
}
int minVal = Integer.MAX_VALUE;
for (int i : absMap.keySet()) {
int val = absMap.get(i);
if (val < minVal && !array.contains(i)) {
res = i;
minVal = val;
}
}
}
sc.close();
System.out.println(res);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
41,
13,
40,
17,
41,
13,
4,
18,
13,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
18,
13,
13,
9,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
110,
5
],
[
110,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
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
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
8,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
55,
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
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
73,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
8,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
6,
107
],
[
107,
108
],
[
0,
109
],
[
109,
110
],
[
109,
111
]
]
| [
"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\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\t\n\t\tboolean[] isP = new boolean[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}\n\t\t\n\t\tint ans = -1;\n\t\tint minAbs = Math.abs(x + 1);\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\t}\n}\n\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\t\n\t\tboolean[] isP = new boolean[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}\n\t\t\n\t\tint ans = -1;\n\t\tint minAbs = Math.abs(x + 1);\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\t\n\t\tboolean[] isP = new boolean[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}\n\t\t\n\t\tint ans = -1;\n\t\tint minAbs = Math.abs(x + 1);\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\t\n\t\tboolean[] isP = new boolean[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}\n\t\t\n\t\tint ans = -1;\n\t\tint minAbs = Math.abs(x + 1);\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean[] isP = new boolean[102];",
"isP",
"new boolean[102]",
"102",
"for (int i = 0; i < n; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}",
"{\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}",
"int p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"isP[p] = true",
"isP[p]",
"isP",
"p",
"true",
"int ans = -1;",
"ans",
"-1",
"1",
"int minAbs = Math.abs(x + 1);",
"minAbs",
"Math.abs(x + 1)",
"Math.abs",
"Math",
"x + 1",
"x",
"1",
"for (int i = 0; i <= 101; i++) {\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}",
"if (isP[i]) continue;",
"isP[i]",
"isP",
"i",
"continue;",
"int abs = Math.abs(x - i);",
"abs",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"if (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}",
"abs < minAbs",
"abs",
"minAbs",
"{\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}",
"minAbs = abs",
"minAbs",
"abs",
"ans = i",
"ans",
"i",
"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\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\t\n\t\tboolean[] isP = new boolean[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}\n\t\t\n\t\tint ans = -1;\n\t\tint minAbs = Math.abs(x + 1);\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\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 x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\t\n\t\tboolean[] isP = new boolean[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tisP[p] = true;\n\t\t}\n\t\t\n\t\tint ans = -1;\n\t\tint minAbs = Math.abs(x + 1);\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif (isP[i]) continue;\n\t\t\t\n\t\t\tint abs = Math.abs(x - i);\n\t\t\tif (abs < minAbs) {\n\t\t\t\tminAbs = abs;\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
boolean[] isP = new boolean[102];
for (int i = 0; i < n; i++) {
int p = sc.nextInt();
isP[p] = true;
}
int ans = -1;
int minAbs = Math.abs(x + 1);
for (int i = 0; i <= 101; i++) {
if (isP[i]) continue;
int abs = Math.abs(x - i);
if (abs < minAbs) {
minAbs = abs;
ans = i;
}
}
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,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
42,
17,
30,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
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
],
[
95,
5
],
[
95,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
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
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
51,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
57,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
51,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
51,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
73,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
51,
84
],
[
84,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
6,
92
],
[
92,
93
],
[
0,
94
],
[
94,
95
],
[
94,
96
]
]
| [
"import java.util.*;\n\npublic class Main {\n \n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(scanner.nextInt());\n }\n\n int diff = 0;\n int ans;\n\n while (true) {\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }\n\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n \n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(scanner.nextInt());\n }\n\n int diff = 0;\n int ans;\n\n while (true) {\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }\n\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(scanner.nextInt());\n }\n\n int diff = 0;\n int ans;\n\n while (true) {\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }\n\n System.out.println(ans);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(scanner.nextInt());\n }\n\n int diff = 0;\n int ans;\n\n while (true) {\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }\n\n System.out.println(ans);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int x = scanner.nextInt();",
"x",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n set.add(scanner.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n set.add(scanner.nextInt());\n }",
"{\n set.add(scanner.nextInt());\n }",
"set.add(scanner.nextInt())",
"set.add",
"set",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int diff = 0;",
"diff",
"0",
"int ans;",
"ans",
"while (true) {\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }",
"true",
"{\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }",
"int left = x - diff;",
"left",
"x - diff",
"x",
"diff",
"if (!set.contains(left)) {\n ans = left;\n break;\n }",
"!set.contains(left)",
"set.contains(left)",
"set.contains",
"set",
"left",
"{\n ans = left;\n break;\n }",
"ans = left",
"ans",
"left",
"break;",
"int right = x + diff;",
"right",
"x + diff",
"x",
"diff",
"if (!set.contains(right)) {\n ans = right;\n break;\n }",
"!set.contains(right)",
"set.contains(right)",
"set.contains",
"set",
"right",
"{\n ans = right;\n break;\n }",
"ans = right",
"ans",
"right",
"break;",
"diff++",
"diff",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n \n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(scanner.nextInt());\n }\n\n int diff = 0;\n int ans;\n\n while (true) {\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }\n\n System.out.println(ans);\n }\n}",
"public class Main {\n \n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(scanner.nextInt());\n }\n\n int diff = 0;\n int ans;\n\n while (true) {\n\n int left = x - diff;\n if (!set.contains(left)) {\n ans = left;\n break;\n }\n\n int right = x + diff;\n if (!set.contains(right)) {\n ans = right;\n break;\n }\n\n diff++;\n }\n\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
int n = scanner.nextInt();
Set<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
set.add(scanner.nextInt());
}
int diff = 0;
int ans;
while (true) {
int left = x - diff;
if (!set.contains(left)) {
ans = left;
break;
}
int right = x + diff;
if (!set.contains(right)) {
ans = right;
break;
}
diff++;
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
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,
18,
13,
13,
4,
13,
13,
13,
13,
23,
13,
12,
13,
30,
14,
40,
4,
18,
13,
13,
29,
13,
41,
13,
2,
13,
17,
41,
13,
2,
13,
17,
41,
13,
17,
41,
13,
17,
42,
40,
13,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
17,
30,
40,
13,
42,
40,
13,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
17,
30,
40,
13,
14,
2,
2,
13,
13,
2,
13,
13,
30,
29,
4,
18,
13,
13,
13,
30,
29,
8,
2,
2,
13,
13,
2,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
245,
11
],
[
245,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
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
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
14,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
55,
58
],
[
55,
59
],
[
12,
60
],
[
60,
61
],
[
245,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
65,
71
],
[
71,
72
],
[
64,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
64,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
64,
83
],
[
83,
84
],
[
83,
85
],
[
64,
86
],
[
86,
87
],
[
86,
88
],
[
64,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
64,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
110,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
110,
120
],
[
120,
121
],
[
121,
122
],
[
64,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
133,
137
],
[
123,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
140,
148
],
[
140,
149
],
[
62,
150
],
[
150,
151
],
[
62,
152
],
[
152,
153
],
[
62,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
156,
160
],
[
160,
161
],
[
156,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
156,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
171,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
181,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
170,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
156,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
200,
203
],
[
203,
204
],
[
156,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
209,
212
],
[
212,
213
],
[
156,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
221,
222
],
[
156,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
225,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
229,
236
],
[
236,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
240,
241
],
[
225,
242
],
[
242,
243
],
[
0,
244
],
[
244,
245
],
[
244,
246
]
]
| [
"import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String[] args) throws IOException{\n FastReader sc = new FastReader();\n int x = sc.nextInt();\n int n = sc.nextInt();\n Set<Integer> nums = new HashSet<Integer>();\n for (int i = 0; i < n; i++){\n nums.add(sc.nextInt());\n }\n System.out.println(solve(x, n, nums));\n }\n static int solve(int x, int n, Set<Integer> nums){\n if (!(nums.contains(x))) return x;\n int cloSmall = x - 1, cloLarge = x + 1;\n boolean sml = false, lg = false;\n while (!(sml)){\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }\n while (!(lg)){\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }\n if (x - cloSmall == cloLarge - x){\n return Math.min(cloSmall, cloLarge);\n }else{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }\n }\n}\nclass FastReader{ \n BufferedReader br; \n StringTokenizer st; \n public FastReader() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n } \n String next(){ \n while (st == null || !st.hasMoreElements()) { \n try{ \n st = new StringTokenizer(br.readLine()); \n }catch (IOException e){ \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n int nextInt(){ \n return Integer.parseInt(next()); \n } \n long nextLong(){ \n return Long.parseLong(next()); \n } \n double nextDouble(){ \n return Double.parseDouble(next()); \n } \n String nextLine(){ \n String str = \"\"; \n try{ \n str = br.readLine(); \n } \n catch (IOException e){ \n e.printStackTrace(); \n } \n return str; \n } \n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n public static void main(String[] args) throws IOException{\n FastReader sc = new FastReader();\n int x = sc.nextInt();\n int n = sc.nextInt();\n Set<Integer> nums = new HashSet<Integer>();\n for (int i = 0; i < n; i++){\n nums.add(sc.nextInt());\n }\n System.out.println(solve(x, n, nums));\n }\n static int solve(int x, int n, Set<Integer> nums){\n if (!(nums.contains(x))) return x;\n int cloSmall = x - 1, cloLarge = x + 1;\n boolean sml = false, lg = false;\n while (!(sml)){\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }\n while (!(lg)){\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }\n if (x - cloSmall == cloLarge - x){\n return Math.min(cloSmall, cloLarge);\n }else{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }\n }\n}",
"Main",
"public static void main(String[] args) throws IOException{\n FastReader sc = new FastReader();\n int x = sc.nextInt();\n int n = sc.nextInt();\n Set<Integer> nums = new HashSet<Integer>();\n for (int i = 0; i < n; i++){\n nums.add(sc.nextInt());\n }\n System.out.println(solve(x, n, nums));\n }",
"main",
"{\n FastReader sc = new FastReader();\n int x = sc.nextInt();\n int n = sc.nextInt();\n Set<Integer> nums = new HashSet<Integer>();\n for (int i = 0; i < n; i++){\n nums.add(sc.nextInt());\n }\n System.out.println(solve(x, n, nums));\n }",
"FastReader sc = new FastReader();",
"sc",
"new FastReader()",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Set<Integer> nums = new HashSet<Integer>();",
"nums",
"new HashSet<Integer>()",
"for (int i = 0; i < n; i++){\n nums.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n nums.add(sc.nextInt());\n }",
"{\n nums.add(sc.nextInt());\n }",
"nums.add(sc.nextInt())",
"nums.add",
"nums",
"sc.nextInt()",
"sc.nextInt",
"sc",
"System.out.println(solve(x, n, nums))",
"System.out.println",
"System.out",
"System",
"System.out",
"solve(x, n, nums)",
"solve",
"x",
"n",
"nums",
"String[] args",
"args",
"static int solve(int x, int n, Set<Integer> nums){\n if (!(nums.contains(x))) return x;\n int cloSmall = x - 1, cloLarge = x + 1;\n boolean sml = false, lg = false;\n while (!(sml)){\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }\n while (!(lg)){\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }\n if (x - cloSmall == cloLarge - x){\n return Math.min(cloSmall, cloLarge);\n }else{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }\n }",
"solve",
"{\n if (!(nums.contains(x))) return x;\n int cloSmall = x - 1, cloLarge = x + 1;\n boolean sml = false, lg = false;\n while (!(sml)){\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }\n while (!(lg)){\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }\n if (x - cloSmall == cloLarge - x){\n return Math.min(cloSmall, cloLarge);\n }else{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }\n }",
"if (!(nums.contains(x))) return x;",
"!(nums.contains(x))",
"(nums.contains(x))",
"nums.contains",
"nums",
"x",
"return x;",
"x",
"int cloSmall = x - 1",
"cloSmall",
"x - 1",
"x",
"1",
"cloLarge = x + 1;",
"cloLarge",
"x + 1",
"x",
"1",
"boolean sml = false",
"sml",
"false",
"lg = false;",
"lg",
"false",
"while (!(sml)){\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }",
"!(sml)",
"(sml)",
"{\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }",
"if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }",
"!(nums.contains(cloSmall))",
"(nums.contains(cloSmall))",
"nums.contains",
"nums",
"cloSmall",
"{\n sml = true;\n }",
"sml = true",
"sml",
"true",
"{\n cloSmall--;\n }",
"cloSmall--",
"cloSmall",
"while (!(lg)){\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }",
"!(lg)",
"(lg)",
"{\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }",
"if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }",
"!(nums.contains(cloLarge))",
"(nums.contains(cloLarge))",
"nums.contains",
"nums",
"cloLarge",
"{\n lg = true;\n }",
"lg = true",
"lg",
"true",
"{\n cloLarge++;\n }",
"cloLarge++",
"cloLarge",
"if (x - cloSmall == cloLarge - x){\n return Math.min(cloSmall, cloLarge);\n }else{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }",
"x - cloSmall == cloLarge - x",
"x - cloSmall",
"x",
"cloSmall",
"cloLarge - x",
"cloLarge",
"x",
"{\n return Math.min(cloSmall, cloLarge);\n }",
"return Math.min(cloSmall, cloLarge);",
"Math.min(cloSmall, cloLarge)",
"Math.min",
"Math",
"cloSmall",
"cloLarge",
"{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }",
"return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);",
"(x - cloSmall < cloLarge - x ? cloSmall : cloLarge)",
"x - cloSmall < cloLarge - x",
"x - cloSmall",
"x",
"cloSmall",
"cloLarge - x",
"cloLarge",
"x",
"cloSmall",
"cloLarge",
"int x",
"x",
"int n",
"n",
"Set<Integer> nums",
"nums",
"class FastReader{ \n BufferedReader br; \n StringTokenizer st; \n public FastReader() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n } \n String next(){ \n while (st == null || !st.hasMoreElements()) { \n try{ \n st = new StringTokenizer(br.readLine()); \n }catch (IOException e){ \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n int nextInt(){ \n return Integer.parseInt(next()); \n } \n long nextLong(){ \n return Long.parseLong(next()); \n } \n double nextDouble(){ \n return Double.parseDouble(next()); \n } \n String nextLine(){ \n String str = \"\"; \n try{ \n str = br.readLine(); \n } \n catch (IOException e){ \n e.printStackTrace(); \n } \n return str; \n } \n}",
"FastReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastReader() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n }",
"FastReader",
"{ \n br = new BufferedReader(new InputStreamReader(System.in)); \n }",
"br = new BufferedReader(new InputStreamReader(System.in))",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String next(){ \n while (st == null || !st.hasMoreElements()) { \n try{ \n st = new StringTokenizer(br.readLine()); \n }catch (IOException e){ \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }",
"next",
"{ \n while (st == null || !st.hasMoreElements()) { \n try{ \n st = new StringTokenizer(br.readLine()); \n }catch (IOException e){ \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }",
"while (st == null || !st.hasMoreElements()) { \n try{ \n st = new StringTokenizer(br.readLine()); \n }catch (IOException e){ \n e.printStackTrace(); \n } \n }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{ \n try{ \n st = new StringTokenizer(br.readLine()); \n }catch (IOException e){ \n e.printStackTrace(); \n } \n }",
"try{ \n st = new StringTokenizer(br.readLine()); \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 st = new StringTokenizer(br.readLine()); \n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt(){ \n return Integer.parseInt(next()); \n }",
"nextInt",
"{ \n return Integer.parseInt(next()); \n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong(){ \n return Long.parseLong(next()); \n }",
"nextLong",
"{ \n return Long.parseLong(next()); \n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"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",
"String nextLine(){ \n String str = \"\"; \n try{ \n str = br.readLine(); \n } \n catch (IOException e){ \n e.printStackTrace(); \n } \n return str; \n }",
"nextLine",
"{ \n String str = \"\"; \n try{ \n str = br.readLine(); \n } \n catch (IOException e){ \n e.printStackTrace(); \n } \n return str; \n }",
"String str = \"\";",
"str",
"\"\"",
"try{ \n str = br.readLine(); \n } \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 str = br.readLine(); \n }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main{\n public static void main(String[] args) throws IOException{\n FastReader sc = new FastReader();\n int x = sc.nextInt();\n int n = sc.nextInt();\n Set<Integer> nums = new HashSet<Integer>();\n for (int i = 0; i < n; i++){\n nums.add(sc.nextInt());\n }\n System.out.println(solve(x, n, nums));\n }\n static int solve(int x, int n, Set<Integer> nums){\n if (!(nums.contains(x))) return x;\n int cloSmall = x - 1, cloLarge = x + 1;\n boolean sml = false, lg = false;\n while (!(sml)){\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }\n while (!(lg)){\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }\n if (x - cloSmall == cloLarge - x){\n return Math.min(cloSmall, cloLarge);\n }else{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }\n }\n}",
"public class Main{\n public static void main(String[] args) throws IOException{\n FastReader sc = new FastReader();\n int x = sc.nextInt();\n int n = sc.nextInt();\n Set<Integer> nums = new HashSet<Integer>();\n for (int i = 0; i < n; i++){\n nums.add(sc.nextInt());\n }\n System.out.println(solve(x, n, nums));\n }\n static int solve(int x, int n, Set<Integer> nums){\n if (!(nums.contains(x))) return x;\n int cloSmall = x - 1, cloLarge = x + 1;\n boolean sml = false, lg = false;\n while (!(sml)){\n if (!(nums.contains(cloSmall))){\n sml = true;\n }else{\n cloSmall--;\n }\n }\n while (!(lg)){\n if (!(nums.contains(cloLarge))){\n lg = true;\n }else{\n cloLarge++;\n }\n }\n if (x - cloSmall == cloLarge - x){\n return Math.min(cloSmall, cloLarge);\n }else{\n return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);\n }\n }\n}",
"Main"
]
| import java.util.*;
import java.lang.*;
import java.io.*;
public class Main{
public static void main(String[] args) throws IOException{
FastReader sc = new FastReader();
int x = sc.nextInt();
int n = sc.nextInt();
Set<Integer> nums = new HashSet<Integer>();
for (int i = 0; i < n; i++){
nums.add(sc.nextInt());
}
System.out.println(solve(x, n, nums));
}
static int solve(int x, int n, Set<Integer> nums){
if (!(nums.contains(x))) return x;
int cloSmall = x - 1, cloLarge = x + 1;
boolean sml = false, lg = false;
while (!(sml)){
if (!(nums.contains(cloSmall))){
sml = true;
}else{
cloSmall--;
}
}
while (!(lg)){
if (!(nums.contains(cloLarge))){
lg = true;
}else{
cloLarge++;
}
}
if (x - cloSmall == cloLarge - x){
return Math.min(cloSmall, cloLarge);
}else{
return (x - cloSmall < cloLarge - x ? cloSmall : cloLarge);
}
}
}
class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while (st == null || !st.hasMoreElements()) {
try{
st = new StringTokenizer(br.readLine());
}catch (IOException e){
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt(){
return Integer.parseInt(next());
}
long nextLong(){
return Long.parseLong(next());
}
double nextDouble(){
return Double.parseDouble(next());
}
String nextLine(){
String str = "";
try{
str = br.readLine();
}
catch (IOException e){
e.printStackTrace();
}
return str;
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
14,
2,
13,
17,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
30,
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
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
49,
50
],
[
50,
51
],
[
29,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
52,
58
],
[
58,
59
],
[
59,
60
],
[
52,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
71,
80
],
[
63,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
89,
98
],
[
25,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
9,
106
],
[
106,
107
]
]
| [
"import java.util.*;\nclass Main{\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args){\n int X=sc.nextInt(),N=sc.nextInt(),ans=0;\n if(N!=0){\n List<Integer> p = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n p.add(sc.nextInt());\n }\n for(int i=0;true;i++){\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }\n }\n else{\n System.out.println(X);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args){\n int X=sc.nextInt(),N=sc.nextInt(),ans=0;\n if(N!=0){\n List<Integer> p = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n p.add(sc.nextInt());\n }\n for(int i=0;true;i++){\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }\n }\n else{\n System.out.println(X);\n }\n }\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String[] args){\n int X=sc.nextInt(),N=sc.nextInt(),ans=0;\n if(N!=0){\n List<Integer> p = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n p.add(sc.nextInt());\n }\n for(int i=0;true;i++){\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }\n }\n else{\n System.out.println(X);\n }\n }",
"main",
"{\n int X=sc.nextInt(),N=sc.nextInt(),ans=0;\n if(N!=0){\n List<Integer> p = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n p.add(sc.nextInt());\n }\n for(int i=0;true;i++){\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }\n }\n else{\n System.out.println(X);\n }\n }",
"int X=sc.nextInt()",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"N=sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ans=0;",
"ans",
"0",
"if(N!=0){\n List<Integer> p = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n p.add(sc.nextInt());\n }\n for(int i=0;true;i++){\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }\n }\n else{\n System.out.println(X);\n }",
"N!=0",
"N",
"0",
"{\n List<Integer> p = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n p.add(sc.nextInt());\n }\n for(int i=0;true;i++){\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }\n }",
"List<Integer> p = new ArrayList<Integer>();",
"p",
"new ArrayList<Integer>()",
"for(int i=0;i<N;i++){\n p.add(sc.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n p.add(sc.nextInt());\n }",
"{\n p.add(sc.nextInt());\n }",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;true;i++){\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"true",
"i++",
"i++",
"i",
"{\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }",
"{\n if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }\n }",
"if(!p.contains(X-i)){\n System.out.println(X-i);\n break;\n }\n else if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }",
"!p.contains(X-i)",
"p.contains(X-i)",
"p.contains",
"p",
"X-i",
"X",
"i",
"{\n System.out.println(X-i);\n break;\n }",
"System.out.println(X-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X-i",
"X",
"i",
"break;",
"if(!p.contains(X+i)){\n System.out.println(X+i);\n break;\n }",
"!p.contains(X+i)",
"p.contains(X+i)",
"p.contains",
"p",
"X+i",
"X",
"i",
"{\n System.out.println(X+i);\n break;\n }",
"System.out.println(X+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X+i",
"X",
"i",
"break;",
"{\n System.out.println(X);\n }",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"String[] args",
"args"
]
| import java.util.*;
class Main{
static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
int X=sc.nextInt(),N=sc.nextInt(),ans=0;
if(N!=0){
List<Integer> p = new ArrayList<Integer>();
for(int i=0;i<N;i++){
p.add(sc.nextInt());
}
for(int i=0;true;i++){
if(!p.contains(X-i)){
System.out.println(X-i);
break;
}
else if(!p.contains(X+i)){
System.out.println(X+i);
break;
}
}
}
else{
System.out.println(X);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
9,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
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
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
33,
40
],
[
8,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
73,
80
],
[
8,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
99,
100
],
[
99,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
105,
106
],
[
105,
107
],
[
94,
108
],
[
108,
109
],
[
93,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
115,
116
],
[
115,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
93,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
142,
144
],
[
136,
145
],
[
6,
146
],
[
146,
147
],
[
0,
148
],
[
148,
149
],
[
148,
150
]
]
| [
"import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"Main",
"public static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}",
"main",
"{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int i=sc.nextInt();",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int j=sc.nextInt();",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int arr[]=new int[j];",
"arr",
"new int[j]",
"j",
"List li1=new ArrayList();",
"li1",
"new ArrayList()",
"if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }",
"j==0",
"j",
"0",
"{\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }",
"System.out.println(i)",
"System.out.println",
"System.out",
"System",
"System.out",
"i",
"return;",
"for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<j",
"k",
"j",
"k++",
"k++",
"k",
"{\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }",
"{\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }",
"arr[k]=sc.nextInt()",
"arr[k]",
"arr",
"k",
"sc.nextInt()",
"sc.nextInt",
"sc",
"li1.add(arr[k])",
"li1.add",
"li1",
"arr[k]",
"arr",
"k",
"if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }",
"!li1.contains(i)",
"li1.contains(i)",
"li1.contains",
"li1",
"i",
"{\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }",
"System.out.println(i)",
"System.out.println",
"System.out",
"System",
"System.out",
"i",
"return;",
"for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<=j",
"k",
"j",
"k++",
"k++",
"k",
"{\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }",
"{\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }",
"if((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }",
"(li1.contains(i+k))&&(li1.contains(i-k))",
"(li1.contains(i+k))",
"li1.contains",
"li1",
"i+k",
"i",
"k",
"(li1.contains(i-k))",
"li1.contains",
"li1",
"i-k",
"i",
"k",
"{ \n\t\t\t\t continue;\n\t\t\t }",
"continue;",
"if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }",
"!li1.contains(i-k)",
"li1.contains(i-k)",
"li1.contains",
"li1",
"i-k",
"i",
"k",
"{\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }",
"System.out.println(i-k)",
"System.out.println",
"System.out",
"System",
"System.out",
"i-k",
"i",
"k",
"break;",
"if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }",
"!li1.contains(i+k)",
"li1.contains(i+k)",
"li1.contains",
"li1",
"i+k",
"i",
"k",
"{\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }",
"System.out.println(i+k)",
"System.out.println",
"System.out",
"System",
"System.out",
"i+k",
"i",
"k",
"break;",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t return;\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int i=sc.nextInt();
int j=sc.nextInt();
int arr[]=new int[j];
List li1=new ArrayList();
if(j==0)
{
System.out.println(i);
return;
}
for(int k=0;k<j;k++)
{
arr[k]=sc.nextInt();
li1.add(arr[k]);
}
if(!li1.contains(i))
{
System.out.println(i);
return;
}
for(int k=0;k<=j;k++)
{
if((li1.contains(i+k))&&(li1.contains(i-k)))
{
continue;
}
if(!li1.contains(i-k))
{
System.out.println(i-k);
break;
}
if(!li1.contains(i+k))
{
System.out.println(i+k);
break;
}
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
9,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
115,
5
],
[
115,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
26,
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
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
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
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
80,
86
],
[
79,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
79,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
6,
112
],
[
112,
113
],
[
0,
114
],
[
114,
115
],
[
114,
116
]
]
| [
"import java.util.Scanner;\n\n/**\n * Main\n */\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int[] arr = new int[102];\n for (int i=0; i<n; i++) {\n int p = sc.nextInt();\n arr[p] = 1;\n }\n int min = 999, index = 0;\n for (int i=0; i<=101; i++) {\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }\n System.out.println(index);\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 x = sc.nextInt();\n int n = sc.nextInt();\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int[] arr = new int[102];\n for (int i=0; i<n; i++) {\n int p = sc.nextInt();\n arr[p] = 1;\n }\n int min = 999, index = 0;\n for (int i=0; i<=101; i++) {\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }\n System.out.println(index);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int[] arr = new int[102];\n for (int i=0; i<n; i++) {\n int p = sc.nextInt();\n arr[p] = 1;\n }\n int min = 999, index = 0;\n for (int i=0; i<=101; i++) {\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }\n System.out.println(index);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int[] arr = new int[102];\n for (int i=0; i<n; i++) {\n int p = sc.nextInt();\n arr[p] = 1;\n }\n int min = 999, index = 0;\n for (int i=0; i<=101; i++) {\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }\n System.out.println(index);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (n == 0) {\n System.out.println(x);\n return;\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int[] arr = new int[102];",
"arr",
"new int[102]",
"102",
"for (int i=0; i<n; i++) {\n int p = sc.nextInt();\n arr[p] = 1;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int p = sc.nextInt();\n arr[p] = 1;\n }",
"{\n int p = sc.nextInt();\n arr[p] = 1;\n }",
"int p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"arr[p] = 1",
"arr[p]",
"arr",
"p",
"1",
"int min = 999",
"min",
"999",
"index = 0;",
"index",
"0",
"for (int i=0; i<=101; i++) {\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }",
"{\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }",
"if (arr[i] == 1) continue;",
"arr[i] == 1",
"arr[i]",
"arr",
"i",
"1",
"continue;",
"int dif = Math.abs(x - i);",
"dif",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"if (dif < min) {\n min = dif;\n index = i;\n }",
"dif < min",
"dif",
"min",
"{\n min = dif;\n index = i;\n }",
"min = dif",
"min",
"dif",
"index = i",
"index",
"i",
"System.out.println(index)",
"System.out.println",
"System.out",
"System",
"System.out",
"index",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int[] arr = new int[102];\n for (int i=0; i<n; i++) {\n int p = sc.nextInt();\n arr[p] = 1;\n }\n int min = 999, index = 0;\n for (int i=0; i<=101; i++) {\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }\n System.out.println(index);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int[] arr = new int[102];\n for (int i=0; i<n; i++) {\n int p = sc.nextInt();\n arr[p] = 1;\n }\n int min = 999, index = 0;\n for (int i=0; i<=101; i++) {\n if (arr[i] == 1) continue;\n int dif = Math.abs(x - i);\n if (dif < min) {\n min = dif;\n index = i;\n }\n }\n System.out.println(index);\n }\n}",
"Main"
]
| import java.util.Scanner;
/**
* Main
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if (n == 0) {
System.out.println(x);
return;
}
int[] arr = new int[102];
for (int i=0; i<n; i++) {
int p = sc.nextInt();
arr[p] = 1;
}
int min = 999, index = 0;
for (int i=0; i<=101; i++) {
if (arr[i] == 1) continue;
int dif = Math.abs(x - i);
if (dif < min) {
min = dif;
index = i;
}
}
System.out.println(index);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
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
],
[
121,
8
],
[
121,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
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
],
[
47,
50
],
[
50,
51
],
[
51,
52
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
78,
80
],
[
74,
81
],
[
73,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
88,
89
],
[
88,
90
],
[
82,
91
],
[
91,
92
],
[
91,
93
],
[
11,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
94,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
94,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
9,
118
],
[
118,
119
],
[
0,
120
],
[
120,
121
],
[
120,
122
]
]
| [
"import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tint abs = 99;\n\t\tint ans = 100;\n\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i = 0;i <= 200;i++) {\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n == 0 || !(list.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tint abs = 99;\n\t\tint ans = 100;\n\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i = 0;i <= 200;i++) {\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n == 0 || !(list.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tint abs = 99;\n\t\tint ans = 100;\n\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i = 0;i <= 200;i++) {\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n == 0 || !(list.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tint abs = 99;\n\t\tint ans = 100;\n\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i = 0;i <= 200;i++) {\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n == 0 || !(list.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int x = scan.nextInt();",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"ArrayList<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"int abs = 99;",
"abs",
"99",
"int ans = 100;",
"ans",
"100",
"for(int i = 0;i < n;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlist.add(scan.nextInt());\n\t\t}",
"{\n\t\t\tlist.add(scan.nextInt());\n\t\t}",
"list.add(scan.nextInt())",
"list.add",
"list",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int i = 0;i <= 200;i++) {\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 200",
"i",
"200",
"i++",
"i++",
"i",
"{\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"if(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}",
"!(list.contains(i))",
"(list.contains(i))",
"list.contains",
"list",
"i",
"{\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}",
"if(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}",
"Math.abs(x - i) < abs",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"abs",
"{\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}",
"abs = Math.abs(x - i)",
"abs",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"ans = i",
"ans",
"i",
"if(n == 0 || !(list.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}",
"n == 0 || !(list.contains(x))",
"n == 0",
"n",
"0",
"!(list.contains(x))",
"(list.contains(x))",
"list.contains",
"list",
"x",
"{\n\t\t\tSystem.out.println(x);\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n\t\t\tSystem.out.println(ans);\n\t\t}",
"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\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tint abs = 99;\n\t\tint ans = 100;\n\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i = 0;i <= 200;i++) {\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n == 0 || !(list.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tint abs = 99;\n\t\tint ans = 100;\n\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i = 0;i <= 200;i++) {\n\t\t\tif(!(list.contains(i))) {\n\t\t\t\tif(Math.abs(x - i) < abs) {\n\t\t\t\t\tabs = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n == 0 || !(list.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int n = scan.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
int abs = 99;
int ans = 100;
for(int i = 0;i < n;i++) {
list.add(scan.nextInt());
}
for(int i = 0;i <= 200;i++) {
if(!(list.contains(i))) {
if(Math.abs(x - i) < abs) {
abs = Math.abs(x - i);
ans = i;
}
}
}
if(n == 0 || !(list.contains(x))) {
System.out.println(x);
}else {
System.out.println(ans);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
13,
41,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
3,
14,
13,
30,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
4,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
149,
8
],
[
149,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
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
],
[
11,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
11,
53
],
[
53,
54
],
[
53,
55
],
[
11,
56
],
[
56,
57
],
[
56,
58
],
[
11,
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
],
[
72,
74
],
[
71,
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
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
88,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
71,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
107,
108
],
[
107,
109
],
[
103,
110
],
[
102,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
117,
119
],
[
111,
120
],
[
120,
121
],
[
120,
122
],
[
102,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
128,
129
],
[
128,
130
],
[
124,
131
],
[
123,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
135,
139
],
[
11,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
9,
146
],
[
146,
147
],
[
0,
148
],
[
148,
149
],
[
148,
150
]
]
| [
"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n \n int best = x;\n int minDistance = n;\n for(int i = 0; i <= 101; i++){\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }\n System.out.println(best);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n \n int best = x;\n int minDistance = n;\n for(int i = 0; i <= 101; i++){\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }\n System.out.println(best);\n }\n}",
"Main",
"public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n \n int best = x;\n int minDistance = n;\n for(int i = 0; i <= 101; i++){\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }\n System.out.println(best);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n \n int best = x;\n int minDistance = n;\n for(int i = 0; i <= 101; i++){\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }\n System.out.println(best);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = sc.nextInt();\n }",
"{\n arr[i] = sc.nextInt();\n }",
"arr[i] = sc.nextInt()",
"arr[i]",
"arr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(arr)",
"Arrays.sort",
"Arrays",
"arr",
"int best = x;",
"best",
"x",
"int minDistance = n;",
"minDistance",
"n",
"for(int i = 0; i <= 101; i++){\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }",
"{\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }",
"boolean good = true;",
"good",
"true",
"for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if(arr[j] == i){\n good = false;\n break;\n }\n }",
"{\n if(arr[j] == i){\n good = false;\n break;\n }\n }",
"if(arr[j] == i){\n good = false;\n break;\n }",
"arr[j] == i",
"arr[j]",
"arr",
"j",
"i",
"{\n good = false;\n break;\n }",
"good = false",
"good",
"false",
"break;",
"if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }",
"good",
"{\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }",
"if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }",
"Math.abs(x - i) < minDistance",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"minDistance",
"{\n minDistance = Math.abs(x-i);\n best = i;\n }",
"minDistance = Math.abs(x-i)",
"minDistance",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"best = i",
"best",
"i",
"if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }",
"Math.abs(x-i) == minDistance",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"minDistance",
"{\n best = Math.min(best, i);\n }",
"best = Math.min(best, i)",
"best",
"Math.min(best, i)",
"Math.min",
"Math",
"best",
"i",
"System.out.println(best)",
"System.out.println",
"System.out",
"System",
"System.out",
"best",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n \n int best = x;\n int minDistance = n;\n for(int i = 0; i <= 101; i++){\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }\n System.out.println(best);\n }\n}",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n \n int best = x;\n int minDistance = n;\n for(int i = 0; i <= 101; i++){\n boolean good = true;\n for(int j = 0; j < n; j++){\n if(arr[j] == i){\n good = false;\n break;\n }\n }\n if(good){\n if(Math.abs(x - i) < minDistance){\n minDistance = Math.abs(x-i);\n best = i;\n } else if(Math.abs(x-i) == minDistance){\n best = Math.min(best, i);\n }\n }\n }\n System.out.println(best);\n }\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int[] arr = new int[n];
for(int i = 0; i < n; i++){
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
int best = x;
int minDistance = n;
for(int i = 0; i <= 101; i++){
boolean good = true;
for(int j = 0; j < n; j++){
if(arr[j] == i){
good = false;
break;
}
}
if(good){
if(Math.abs(x - i) < minDistance){
minDistance = Math.abs(x-i);
best = i;
} else if(Math.abs(x-i) == minDistance){
best = Math.min(best, i);
}
}
}
System.out.println(best);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
30,
41,
13,
4,
18,
13,
40,
18,
13,
13,
41,
13,
11,
1,
0,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
3,
41,
13,
11,
1,
0,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
3,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
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
],
[
122,
8
],
[
122,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
41,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
11,
51
],
[
51,
52
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
66,
72
],
[
11,
73
],
[
73,
74
],
[
11,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
75,
82
],
[
82,
83
],
[
82,
84
],
[
75,
85
],
[
85,
86
],
[
86,
87
],
[
75,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
90,
96
],
[
11,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
97,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
97,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
9,
119
],
[
119,
120
],
[
0,
121
],
[
121,
122
],
[
121,
123
]
]
| [
"import java.util.Scanner;\nimport java.util.TreeSet;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner sc=new Scanner(System.in);\n int X=sc.nextInt();\n int N=sc.nextInt();\n int pos[]=new int[102];\n for(int i=0;i<N;++i) {\n int no=sc.nextInt();\n pos[no]++;\n }\n int i;\n for(i=X;i>=0;--i) {\n if(pos[i]==0)\n break;\n }\n int j;\n for(j=X+1;j<102;++j) {\n if(pos[j]==0)\n break;\n }\n if(j-X<X-i) {\n System.out.println(j);\n } else {\n System.out.println(i);\n }\n\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.TreeSet;",
"TreeSet",
"java.util",
"public class Main {\n public static void main(String args[]) {\n Scanner sc=new Scanner(System.in);\n int X=sc.nextInt();\n int N=sc.nextInt();\n int pos[]=new int[102];\n for(int i=0;i<N;++i) {\n int no=sc.nextInt();\n pos[no]++;\n }\n int i;\n for(i=X;i>=0;--i) {\n if(pos[i]==0)\n break;\n }\n int j;\n for(j=X+1;j<102;++j) {\n if(pos[j]==0)\n break;\n }\n if(j-X<X-i) {\n System.out.println(j);\n } else {\n System.out.println(i);\n }\n\n }\n}",
"Main",
"public static void main(String args[]) {\n Scanner sc=new Scanner(System.in);\n int X=sc.nextInt();\n int N=sc.nextInt();\n int pos[]=new int[102];\n for(int i=0;i<N;++i) {\n int no=sc.nextInt();\n pos[no]++;\n }\n int i;\n for(i=X;i>=0;--i) {\n if(pos[i]==0)\n break;\n }\n int j;\n for(j=X+1;j<102;++j) {\n if(pos[j]==0)\n break;\n }\n if(j-X<X-i) {\n System.out.println(j);\n } else {\n System.out.println(i);\n }\n\n }",
"main",
"{\n Scanner sc=new Scanner(System.in);\n int X=sc.nextInt();\n int N=sc.nextInt();\n int pos[]=new int[102];\n for(int i=0;i<N;++i) {\n int no=sc.nextInt();\n pos[no]++;\n }\n int i;\n for(i=X;i>=0;--i) {\n if(pos[i]==0)\n break;\n }\n int j;\n for(j=X+1;j<102;++j) {\n if(pos[j]==0)\n break;\n }\n if(j-X<X-i) {\n System.out.println(j);\n } else {\n System.out.println(i);\n }\n\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X=sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N=sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int pos[]=new int[102];",
"pos",
"new int[102]",
"102",
"for(int i=0;i<N;++i) {\n int no=sc.nextInt();\n pos[no]++;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"++i",
"++i",
"i",
"{\n int no=sc.nextInt();\n pos[no]++;\n }",
"{\n int no=sc.nextInt();\n pos[no]++;\n }",
"int no=sc.nextInt();",
"no",
"sc.nextInt()",
"sc.nextInt",
"sc",
"pos[no]++",
"pos[no]",
"pos",
"no",
"int i;",
"i",
"for(i=X;i>=0;--i) {\n if(pos[i]==0)\n break;\n }",
"i=X;",
"i=X",
"i",
"X",
"i>=0",
"i",
"0",
"--i",
"--i",
"i",
"{\n if(pos[i]==0)\n break;\n }",
"{\n if(pos[i]==0)\n break;\n }",
"if(pos[i]==0)\n break;",
"pos[i]==0",
"pos[i]",
"pos",
"i",
"0",
"break;",
"int j;",
"j",
"for(j=X+1;j<102;++j) {\n if(pos[j]==0)\n break;\n }",
"j=X+1;",
"j=X+1",
"j",
"X+1",
"X",
"1",
"j<102",
"j",
"102",
"++j",
"++j",
"j",
"{\n if(pos[j]==0)\n break;\n }",
"{\n if(pos[j]==0)\n break;\n }",
"if(pos[j]==0)\n break;",
"pos[j]==0",
"pos[j]",
"pos",
"j",
"0",
"break;",
"if(j-X<X-i) {\n System.out.println(j);\n } else {\n System.out.println(i);\n }",
"j-X<X-i",
"j-X",
"j",
"X",
"X-i",
"X",
"i",
"{\n System.out.println(j);\n }",
"System.out.println(j)",
"System.out.println",
"System.out",
"System",
"System.out",
"j",
"{\n System.out.println(i);\n }",
"System.out.println(i)",
"System.out.println",
"System.out",
"System",
"System.out",
"i",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) {\n Scanner sc=new Scanner(System.in);\n int X=sc.nextInt();\n int N=sc.nextInt();\n int pos[]=new int[102];\n for(int i=0;i<N;++i) {\n int no=sc.nextInt();\n pos[no]++;\n }\n int i;\n for(i=X;i>=0;--i) {\n if(pos[i]==0)\n break;\n }\n int j;\n for(j=X+1;j<102;++j) {\n if(pos[j]==0)\n break;\n }\n if(j-X<X-i) {\n System.out.println(j);\n } else {\n System.out.println(i);\n }\n\n }\n}",
"public class Main {\n public static void main(String args[]) {\n Scanner sc=new Scanner(System.in);\n int X=sc.nextInt();\n int N=sc.nextInt();\n int pos[]=new int[102];\n for(int i=0;i<N;++i) {\n int no=sc.nextInt();\n pos[no]++;\n }\n int i;\n for(i=X;i>=0;--i) {\n if(pos[i]==0)\n break;\n }\n int j;\n for(j=X+1;j<102;++j) {\n if(pos[j]==0)\n break;\n }\n if(j-X<X-i) {\n System.out.println(j);\n } else {\n System.out.println(i);\n }\n\n }\n}",
"Main"
]
| import java.util.Scanner;
import java.util.TreeSet;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int X=sc.nextInt();
int N=sc.nextInt();
int pos[]=new int[102];
for(int i=0;i<N;++i) {
int no=sc.nextInt();
pos[no]++;
}
int i;
for(i=X;i>=0;--i) {
if(pos[i]==0)
break;
}
int j;
for(j=X+1;j<102;++j) {
if(pos[j]==0)
break;
}
if(j-X<X-i) {
System.out.println(j);
} else {
System.out.println(i);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
41,
13,
13,
11,
1,
41,
13,
13,
41,
13,
13,
1,
40,
13,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
3,
14,
40,
4,
18,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
111,
5
],
[
111,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
46,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
61,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
77,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
72,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
8,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
6,
108
],
[
108,
109
],
[
0,
110
],
[
110,
111
],
[
110,
112
]
]
| [
"import java.util.*;\n\npublic class Main{\npublic static void main(String[] args)\n{ \n Scanner sc=new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n Set<Integer> set =new HashSet<>();\n for(int i=0;i<n;i++)\n set.add(sc.nextInt());\n int ans=x;\n for(int i=x,j=x;;i++,j--)\n { if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }\n\n System.out.println(ans);\n}\n \n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\npublic static void main(String[] args)\n{ \n Scanner sc=new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n Set<Integer> set =new HashSet<>();\n for(int i=0;i<n;i++)\n set.add(sc.nextInt());\n int ans=x;\n for(int i=x,j=x;;i++,j--)\n { if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }\n\n System.out.println(ans);\n}\n \n}",
"Main",
"public static void main(String[] args)\n{ \n Scanner sc=new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n Set<Integer> set =new HashSet<>();\n for(int i=0;i<n;i++)\n set.add(sc.nextInt());\n int ans=x;\n for(int i=x,j=x;;i++,j--)\n { if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }\n\n System.out.println(ans);\n}",
"main",
"{ \n Scanner sc=new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n Set<Integer> set =new HashSet<>();\n for(int i=0;i<n;i++)\n set.add(sc.nextInt());\n int ans=x;\n for(int i=x,j=x;;i++,j--)\n { if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }\n\n System.out.println(ans);\n}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Set<Integer> set =new HashSet<>();",
"set",
"new HashSet<>()",
"for(int i=0;i<n;i++)\n set.add(sc.nextInt());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"set.add(sc.nextInt());",
"set.add(sc.nextInt())",
"set.add",
"set",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans=x;",
"ans",
"x",
"for(int i=x,j=x;;i++,j--)\n { if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }",
"int i=x,j=x;",
"int i=x",
"i",
"x",
"j=x;",
"j",
"x",
"i++,j--",
"i++",
"i",
"j--",
"j",
"{ if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }",
"{ if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }",
"if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}",
"!set.contains(i)",
"set.contains(i)",
"set.contains",
"set",
"i",
"{ ans=i;\n break;}",
"ans=i",
"ans",
"i",
"break;",
"if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}",
"!set.contains(j-1)",
"set.contains(j-1)",
"set.contains",
"set",
"j-1",
"j",
"1",
"{ans=j-1;\n break;}",
"ans=j-1",
"ans",
"j-1",
"j",
"1",
"break;",
"if(!set.contains(i+1))\n { ans=i+1;\n break;}",
"!set.contains(i+1)",
"set.contains(i+1)",
"set.contains",
"set",
"i+1",
"i",
"1",
"{ ans=i+1;\n break;}",
"ans=i+1",
"ans",
"i+1",
"i",
"1",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\npublic static void main(String[] args)\n{ \n Scanner sc=new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n Set<Integer> set =new HashSet<>();\n for(int i=0;i<n;i++)\n set.add(sc.nextInt());\n int ans=x;\n for(int i=x,j=x;;i++,j--)\n { if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }\n\n System.out.println(ans);\n}\n \n}",
"public class Main{\npublic static void main(String[] args)\n{ \n Scanner sc=new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n Set<Integer> set =new HashSet<>();\n for(int i=0;i<n;i++)\n set.add(sc.nextInt());\n int ans=x;\n for(int i=x,j=x;;i++,j--)\n { if(!set.contains(i))\n { ans=i;\n break;}\n \n else if(!set.contains(j-1))\n {ans=j-1;\n break;}\n \n else if(!set.contains(i+1))\n { ans=i+1;\n break;}\n \n }\n\n System.out.println(ans);\n}\n \n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
int n=sc.nextInt();
Set<Integer> set =new HashSet<>();
for(int i=0;i<n;i++)
set.add(sc.nextInt());
int ans=x;
for(int i=x,j=x;;i++,j--)
{ if(!set.contains(i))
{ ans=i;
break;}
else if(!set.contains(j-1))
{ans=j-1;
break;}
else if(!set.contains(i+1))
{ ans=i+1;
break;}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
13,
29,
0,
13,
17,
41,
13,
2,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
13,
29,
0,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
172,
8
],
[
172,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
17,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
28,
29
],
[
29,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
35
],
[
35,
36
],
[
35,
37
],
[
11,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
42,
49
],
[
38,
50
],
[
50,
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
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
72,
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
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
92,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
86,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
117,
124
],
[
86,
125
],
[
125,
126
],
[
125,
127
],
[
86,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
86,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
133,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
86,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
158,
165
],
[
86,
166
],
[
166,
167
],
[
166,
168
],
[
9,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
]
| [
"import java.util.ArrayList;\nimport java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sn = new Scanner(System.in);\n int x = Integer.parseInt(sn.next());\n int y = Integer.parseInt(sn.next());\n int[] list = new int[y];\n boolean flg = true;\n if ( y == 0){\n System.out.println(x);\n return;\n }else{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }\n for( int i = 0; i <= x ; i++ ){\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }\n \n\t}\n}\n",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sn = new Scanner(System.in);\n int x = Integer.parseInt(sn.next());\n int y = Integer.parseInt(sn.next());\n int[] list = new int[y];\n boolean flg = true;\n if ( y == 0){\n System.out.println(x);\n return;\n }else{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }\n for( int i = 0; i <= x ; i++ ){\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }\n \n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sn = new Scanner(System.in);\n int x = Integer.parseInt(sn.next());\n int y = Integer.parseInt(sn.next());\n int[] list = new int[y];\n boolean flg = true;\n if ( y == 0){\n System.out.println(x);\n return;\n }else{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }\n for( int i = 0; i <= x ; i++ ){\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }\n \n\t}",
"main",
"{\n\t\tScanner sn = new Scanner(System.in);\n int x = Integer.parseInt(sn.next());\n int y = Integer.parseInt(sn.next());\n int[] list = new int[y];\n boolean flg = true;\n if ( y == 0){\n System.out.println(x);\n return;\n }else{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }\n for( int i = 0; i <= x ; i++ ){\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }\n \n\t}",
"Scanner sn = new Scanner(System.in);",
"sn",
"new Scanner(System.in)",
"int x = Integer.parseInt(sn.next());",
"x",
"Integer.parseInt(sn.next())",
"Integer.parseInt",
"Integer",
"sn.next()",
"sn.next",
"sn",
"int y = Integer.parseInt(sn.next());",
"y",
"Integer.parseInt(sn.next())",
"Integer.parseInt",
"Integer",
"sn.next()",
"sn.next",
"sn",
"int[] list = new int[y];",
"list",
"new int[y]",
"y",
"boolean flg = true;",
"flg",
"true",
"if ( y == 0){\n System.out.println(x);\n return;\n }else{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }",
"y == 0",
"y",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }",
"for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i < y",
"i",
"y",
"i++",
"i++",
"i",
"{\n list[i] = Integer.parseInt(sn.next());\n }",
"{\n list[i] = Integer.parseInt(sn.next());\n }",
"list[i] = Integer.parseInt(sn.next())",
"list[i]",
"list",
"i",
"Integer.parseInt(sn.next())",
"Integer.parseInt",
"Integer",
"sn.next()",
"sn.next",
"sn",
"for( int i = 0; i <= x ; i++ ){\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= x",
"i",
"x",
"i++",
"i++",
"i",
"{\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }",
"{\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }",
"int d = x - i;",
"d",
"x - i",
"x",
"i",
"for (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }",
"int b =0;",
"int b =0;",
"b",
"0",
"b < y",
"b",
"y",
"b++",
"b++",
"b",
"{\n if (list[b] == d){\n flg = false;\n } \n }",
"{\n if (list[b] == d){\n flg = false;\n } \n }",
"if (list[b] == d){\n flg = false;\n }",
"list[b] == d",
"list[b]",
"list",
"b",
"d",
"{\n flg = false;\n }",
"flg = false",
"flg",
"false",
"if (flg){\n System.out.println(d);\n return;\n }",
"flg",
"{\n System.out.println(d);\n return;\n }",
"System.out.println(d)",
"System.out.println",
"System.out",
"System",
"System.out",
"d",
"return;",
"flg = true",
"flg",
"true",
"int e = x + i;",
"e",
"x + i",
"x",
"i",
"for (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }",
"int c =0;",
"int c =0;",
"c",
"0",
"c < y",
"c",
"y",
"c++",
"c++",
"c",
"{\n if (list[c] == e){\n flg = false;\n } \n }",
"{\n if (list[c] == e){\n flg = false;\n } \n }",
"if (list[c] == e){\n flg = false;\n }",
"list[c] == e",
"list[c]",
"list",
"c",
"e",
"{\n flg = false;\n }",
"flg = false",
"flg",
"false",
"if (flg){\n System.out.println(e);\n return;\n }",
"flg",
"{\n System.out.println(e);\n return;\n }",
"System.out.println(e)",
"System.out.println",
"System.out",
"System",
"System.out",
"e",
"return;",
"flg = true",
"flg",
"true",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sn = new Scanner(System.in);\n int x = Integer.parseInt(sn.next());\n int y = Integer.parseInt(sn.next());\n int[] list = new int[y];\n boolean flg = true;\n if ( y == 0){\n System.out.println(x);\n return;\n }else{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }\n for( int i = 0; i <= x ; i++ ){\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }\n \n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sn = new Scanner(System.in);\n int x = Integer.parseInt(sn.next());\n int y = Integer.parseInt(sn.next());\n int[] list = new int[y];\n boolean flg = true;\n if ( y == 0){\n System.out.println(x);\n return;\n }else{\n for(int i =0; i < y ; i++ ){\n list[i] = Integer.parseInt(sn.next());\n }\n }\n for( int i = 0; i <= x ; i++ ){\n int d = x - i;\n\t\t\tfor (int b =0; b < y ; b++ ){\n if (list[b] == d){\n flg = false;\n } \n }\n if (flg){\n System.out.println(d);\n return;\n }\n flg = true;\n int e = x + i;\n\t\t\tfor (int c =0; c < y ; c++ ){\n if (list[c] == e){\n flg = false;\n } \n }\n if (flg){\n System.out.println(e);\n return;\n }\n flg = true;\n }\n \n\t}\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sn = new Scanner(System.in);
int x = Integer.parseInt(sn.next());
int y = Integer.parseInt(sn.next());
int[] list = new int[y];
boolean flg = true;
if ( y == 0){
System.out.println(x);
return;
}else{
for(int i =0; i < y ; i++ ){
list[i] = Integer.parseInt(sn.next());
}
}
for( int i = 0; i <= x ; i++ ){
int d = x - i;
for (int b =0; b < y ; b++ ){
if (list[b] == d){
flg = false;
}
}
if (flg){
System.out.println(d);
return;
}
flg = true;
int e = x + i;
for (int c =0; c < y ; c++ ){
if (list[c] == e){
flg = false;
}
}
if (flg){
System.out.println(e);
return;
}
flg = true;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
4,
18,
13,
13,
30,
9,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
100,
5
],
[
100,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
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
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
49,
51
],
[
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
],
[
67,
68
],
[
66,
69
],
[
65,
70
],
[
70,
71
],
[
64,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
77,
79
],
[
64,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
6,
97
],
[
97,
98
],
[
0,
99
],
[
99,
100
],
[
99,
101
]
]
| [
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n HashSet<Integer> set = new HashSet<Integer>();\n \n for(int i=0; i<N; i++){\n set.add(sc.nextInt());\n }\n \n int ans = X;\n int min = Integer.MAX_VALUE;\n for(int i = 0; i<=200; i++){\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }\n System.out.println(ans);\n }\n}\n ",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n HashSet<Integer> set = new HashSet<Integer>();\n \n for(int i=0; i<N; i++){\n set.add(sc.nextInt());\n }\n \n int ans = X;\n int min = Integer.MAX_VALUE;\n for(int i = 0; i<=200; i++){\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n HashSet<Integer> set = new HashSet<Integer>();\n \n for(int i=0; i<N; i++){\n set.add(sc.nextInt());\n }\n \n int ans = X;\n int min = Integer.MAX_VALUE;\n for(int i = 0; i<=200; i++){\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n HashSet<Integer> set = new HashSet<Integer>();\n \n for(int i=0; i<N; i++){\n set.add(sc.nextInt());\n }\n \n int ans = X;\n int min = Integer.MAX_VALUE;\n for(int i = 0; i<=200; i++){\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"HashSet<Integer> set = new HashSet<Integer>();",
"set",
"new HashSet<Integer>()",
"for(int i=0; i<N; i++){\n set.add(sc.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n set.add(sc.nextInt());\n }",
"{\n set.add(sc.nextInt());\n }",
"set.add(sc.nextInt())",
"set.add",
"set",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = X;",
"ans",
"X",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for(int i = 0; i<=200; i++){\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }",
"{\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }",
"if(set.contains(i)){\n continue;\n }",
"set.contains(i)",
"set.contains",
"set",
"i",
"{\n continue;\n }",
"continue;",
"int gap = Math.abs(X - i);",
"gap",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"if(gap < min){\n ans = i;\n min = gap;\n }",
"gap < min",
"gap",
"min",
"{\n ans = i;\n min = gap;\n }",
"ans = i",
"ans",
"i",
"min = gap",
"min",
"gap",
"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 X = sc.nextInt();\n int N = sc.nextInt();\n HashSet<Integer> set = new HashSet<Integer>();\n \n for(int i=0; i<N; i++){\n set.add(sc.nextInt());\n }\n \n int ans = X;\n int min = Integer.MAX_VALUE;\n for(int i = 0; i<=200; i++){\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n HashSet<Integer> set = new HashSet<Integer>();\n \n for(int i=0; i<N; i++){\n set.add(sc.nextInt());\n }\n \n int ans = X;\n int min = Integer.MAX_VALUE;\n for(int i = 0; i<=200; i++){\n if(set.contains(i)){\n continue;\n }\n int gap = Math.abs(X - i);\n if(gap < min){\n ans = i;\n min = gap;\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
HashSet<Integer> set = new HashSet<Integer>();
for(int i=0; i<N; i++){
set.add(sc.nextInt());
}
int ans = X;
int min = Integer.MAX_VALUE;
for(int i = 0; i<=200; i++){
if(set.contains(i)){
continue;
}
int gap = Math.abs(X - i);
if(gap < min){
ans = i;
min = gap;
}
}
System.out.println(ans);
}
}
|
[
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,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
17,
4,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
4,
18,
13,
4,
18,
13,
17,
41,
13,
17,
41,
13,
17,
42,
13,
30,
14,
2,
18,
13,
4,
18,
13,
17,
2,
13,
13,
17,
30,
4,
18,
13,
2,
2,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
4,
18,
13,
17,
2,
13,
13,
17,
30,
4,
18,
13,
2,
2,
13,
13,
17,
0,
13,
17,
40,
13,
4,
18,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
137,
8
],
[
137,
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
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
11,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
34,
35
],
[
35,
36
],
[
11,
37
],
[
37,
38
],
[
37,
39
],
[
11,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
41,
45
],
[
11,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
46,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
65,
66
],
[
66,
67
],
[
59,
68
],
[
11,
69
],
[
69,
70
],
[
69,
71
],
[
11,
72
],
[
72,
73
],
[
72,
74
],
[
11,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
79,
89
],
[
78,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
90,
99
],
[
99,
100
],
[
99,
101
],
[
78,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
102,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
119,
119
],
[
119,
120
],
[
119,
121
],
[
119,
122
],
[
114,
123
],
[
123,
124
],
[
123,
125
],
[
77,
126
],
[
126,
127
],
[
11,
128
],
[
128,
129
],
[
129,
130
],
[
11,
131
],
[
131,
132
],
[
132,
133
],
[
9,
134
],
[
134,
135
],
[
0,
136
],
[
136,
137
],
[
136,
138
]
]
| [
"import java.util.*;\nimport java.io.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n Map hs = new HashMap();\n PrintWriter ou = new PrintWriter(System.out);\n int x = Integer.parseInt(sc.next());\n int n = Integer.parseInt(sc.next());\n boolean[] q = new boolean[102];\n Arrays.fill(q , true);\n for(int i = 0 ; i < n ; i++){\n q[Integer.parseInt(sc.next())] = false;\n }\n int s = 0;\n boolean ebishu = true;\n while(ebishu){\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }\n sc.close();\n ou.flush();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n Map hs = new HashMap();\n PrintWriter ou = new PrintWriter(System.out);\n int x = Integer.parseInt(sc.next());\n int n = Integer.parseInt(sc.next());\n boolean[] q = new boolean[102];\n Arrays.fill(q , true);\n for(int i = 0 ; i < n ; i++){\n q[Integer.parseInt(sc.next())] = false;\n }\n int s = 0;\n boolean ebishu = true;\n while(ebishu){\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }\n sc.close();\n ou.flush();\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n Map hs = new HashMap();\n PrintWriter ou = new PrintWriter(System.out);\n int x = Integer.parseInt(sc.next());\n int n = Integer.parseInt(sc.next());\n boolean[] q = new boolean[102];\n Arrays.fill(q , true);\n for(int i = 0 ; i < n ; i++){\n q[Integer.parseInt(sc.next())] = false;\n }\n int s = 0;\n boolean ebishu = true;\n while(ebishu){\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }\n sc.close();\n ou.flush();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n Map hs = new HashMap();\n PrintWriter ou = new PrintWriter(System.out);\n int x = Integer.parseInt(sc.next());\n int n = Integer.parseInt(sc.next());\n boolean[] q = new boolean[102];\n Arrays.fill(q , true);\n for(int i = 0 ; i < n ; i++){\n q[Integer.parseInt(sc.next())] = false;\n }\n int s = 0;\n boolean ebishu = true;\n while(ebishu){\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }\n sc.close();\n ou.flush();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"Map hs = new HashMap();",
"hs",
"new HashMap()",
"PrintWriter ou = new PrintWriter(System.out);",
"ou",
"new PrintWriter(System.out)",
"int x = Integer.parseInt(sc.next());",
"x",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"boolean[] q = new boolean[102];",
"q",
"new boolean[102]",
"102",
"Arrays.fill(q , true)",
"Arrays.fill",
"Arrays",
"q",
"true",
"for(int i = 0 ; i < n ; i++){\n q[Integer.parseInt(sc.next())] = false;\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n q[Integer.parseInt(sc.next())] = false;\n }",
"{\n q[Integer.parseInt(sc.next())] = false;\n }",
"q[Integer.parseInt(sc.next())] = false",
"q[Integer.parseInt(sc.next())]",
"q",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"false",
"int s = 0;",
"s",
"0",
"boolean ebishu = true;",
"ebishu",
"true",
"while(ebishu){\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }",
"ebishu",
"{\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }",
"if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }",
"q[Math.max(0 , x - s)] == true",
"q[Math.max(0 , x - s)]",
"q",
"Math.max(0 , x - s)",
"Math.max",
"Math",
"0",
"x - s",
"x",
"s",
"true",
"{\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }",
"ou.print(x - s + \"\\n\")",
"ou.print",
"ou",
"x - s + \"\\n\"",
"x - s",
"x",
"s",
"\"\\n\"",
"ebishu = false",
"ebishu",
"false",
"if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }",
"q[Math.min(101 , x + s)] == true",
"q[Math.min(101 , x + s)]",
"q",
"Math.min(101 , x + s)",
"Math.min",
"Math",
"101",
"x + s",
"x",
"s",
"true",
"{\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }",
"ou.print(x + s + \"\\n\")",
"ou.print",
"ou",
"x + s + \"\\n\"",
"x + s + \"\\n\"",
"x",
"s",
"\"\\n\"",
"ebishu = false",
"ebishu",
"false",
"s++",
"s",
"sc.close()",
"sc.close",
"sc",
"ou.flush()",
"ou.flush",
"ou",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n Map hs = new HashMap();\n PrintWriter ou = new PrintWriter(System.out);\n int x = Integer.parseInt(sc.next());\n int n = Integer.parseInt(sc.next());\n boolean[] q = new boolean[102];\n Arrays.fill(q , true);\n for(int i = 0 ; i < n ; i++){\n q[Integer.parseInt(sc.next())] = false;\n }\n int s = 0;\n boolean ebishu = true;\n while(ebishu){\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }\n sc.close();\n ou.flush();\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n Map hs = new HashMap();\n PrintWriter ou = new PrintWriter(System.out);\n int x = Integer.parseInt(sc.next());\n int n = Integer.parseInt(sc.next());\n boolean[] q = new boolean[102];\n Arrays.fill(q , true);\n for(int i = 0 ; i < n ; i++){\n q[Integer.parseInt(sc.next())] = false;\n }\n int s = 0;\n boolean ebishu = true;\n while(ebishu){\n if(q[Math.max(0 , x - s)] == true){\n ou.print(x - s + \"\\n\");\n ebishu = false;\n }else if(q[Math.min(101 , x + s)] == true){\n ou.print(x + s + \"\\n\");\n ebishu = false;\n }\n s++;\n }\n sc.close();\n ou.flush();\n }\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
Map hs = new HashMap();
PrintWriter ou = new PrintWriter(System.out);
int x = Integer.parseInt(sc.next());
int n = Integer.parseInt(sc.next());
boolean[] q = new boolean[102];
Arrays.fill(q , true);
for(int i = 0 ; i < n ; i++){
q[Integer.parseInt(sc.next())] = false;
}
int s = 0;
boolean ebishu = true;
while(ebishu){
if(q[Math.max(0 , x - s)] == true){
ou.print(x - s + "\n");
ebishu = false;
}else if(q[Math.min(101 , x + s)] == true){
ou.print(x + s + "\n");
ebishu = false;
}
s++;
}
sc.close();
ou.flush();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
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,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
0,
13,
17,
14,
40,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
2,
13,
4,
18,
13,
13,
14,
2,
13,
17,
0,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
176,
5
],
[
176,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
26,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
8,
37
],
[
37,
38
],
[
37,
39
],
[
8,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
80,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
101,
103
],
[
76,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
8,
111
],
[
111,
112
],
[
111,
113
],
[
8,
114
],
[
114,
115
],
[
114,
116
],
[
8,
117
],
[
117,
118
],
[
117,
119
],
[
8,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
120,
130
],
[
130,
131
],
[
131,
132
],
[
120,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
134,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
150,
152
],
[
134,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
8,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
6,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++) {\n p[i] = sc.nextInt();\n }\n\n ArrayList<Integer> ep = new ArrayList<>();\n for(int i=0; i<=101; i++) {\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<ep.size(); i++) {\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++) {\n p[i] = sc.nextInt();\n }\n\n ArrayList<Integer> ep = new ArrayList<>();\n for(int i=0; i<=101; i++) {\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<ep.size(); i++) {\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++) {\n p[i] = sc.nextInt();\n }\n\n ArrayList<Integer> ep = new ArrayList<>();\n for(int i=0; i<=101; i++) {\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<ep.size(); i++) {\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++) {\n p[i] = sc.nextInt();\n }\n\n ArrayList<Integer> ep = new ArrayList<>();\n for(int i=0; i<=101; i++) {\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<ep.size(); i++) {\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n System.exit(0);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"for(int i=0; i<n; i++) {\n p[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i] = sc.nextInt();\n }",
"{\n p[i] = sc.nextInt();\n }",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ArrayList<Integer> ep = new ArrayList<>();",
"ep",
"new ArrayList<>()",
"for(int i=0; i<=101; i++) {\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }",
"{\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }",
"boolean isFound = false;",
"isFound",
"false",
"for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<p.length",
"j",
"p.length",
"p",
"p.length",
"j++",
"j++",
"j",
"{\n if(i == p[j]) isFound = true;\n }",
"{\n if(i == p[j]) isFound = true;\n }",
"if(i == p[j]) isFound = true;",
"i == p[j]",
"i",
"p[j]",
"p",
"j",
"isFound = true",
"isFound",
"true",
"if(!isFound) ep.add(i);",
"!isFound",
"isFound",
"ep.add(i)",
"ep.add",
"ep",
"i",
"int diff = 0;",
"diff",
"0",
"int comp = 0;",
"comp",
"0",
"int ans = 0;",
"ans",
"0",
"for(int i=0; i<ep.size(); i++) {\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ep.size()",
"i",
"ep.size()",
"ep.size",
"ep",
"i++",
"i++",
"i",
"{\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }",
"{\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }",
"diff = Math.abs(x-ep.get(i))",
"diff",
"Math.abs(x-ep.get(i))",
"Math.abs",
"Math",
"x-ep.get(i)",
"x",
"ep.get(i)",
"ep.get",
"ep",
"i",
"if(i == 0) comp = diff;",
"i == 0",
"i",
"0",
"comp = diff",
"comp",
"diff",
"if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }",
"comp > diff",
"comp",
"diff",
"{\n comp = diff;\n ans = ep.get(i);\n }",
"comp = diff",
"comp",
"diff",
"ans = ep.get(i)",
"ans",
"ep.get(i)",
"ep.get",
"ep",
"i",
"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\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++) {\n p[i] = sc.nextInt();\n }\n\n ArrayList<Integer> ep = new ArrayList<>();\n for(int i=0; i<=101; i++) {\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<ep.size(); i++) {\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++) {\n p[i] = sc.nextInt();\n }\n\n ArrayList<Integer> ep = new ArrayList<>();\n for(int i=0; i<=101; i++) {\n boolean isFound = false;\n for(int j=0; j<p.length; j++) {\n if(i == p[j]) isFound = true;\n }\n if(!isFound) ep.add(i);\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<ep.size(); i++) {\n diff = Math.abs(x-ep.get(i));\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = ep.get(i);\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if(n == 0) {
System.out.println(x);
System.exit(0);
}
int[] p = new int[n];
for(int i=0; i<n; i++) {
p[i] = sc.nextInt();
}
ArrayList<Integer> ep = new ArrayList<>();
for(int i=0; i<=101; i++) {
boolean isFound = false;
for(int j=0; j<p.length; j++) {
if(i == p[j]) isFound = true;
}
if(!isFound) ep.add(i);
}
int diff = 0;
int comp = 0;
int ans = 0;
for(int i=0; i<ep.size(); i++) {
diff = Math.abs(x-ep.get(i));
if(i == 0) comp = diff;
if(comp > diff) {
comp = diff;
ans = ep.get(i);
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
17,
41,
13,
20,
17,
41,
13,
20,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
2,
13,
13,
0,
18,
13,
13,
2,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
17,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
4,
18,
13,
18,
13,
13,
18,
13,
13,
3,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
18,
13,
13,
3,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
18,
13,
13,
3,
30,
0,
13,
17,
0,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
232,
5
],
[
232,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
8,
38
],
[
38,
39
],
[
38,
40
],
[
8,
42
],
[
42,
43
],
[
42,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
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
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
80,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
95,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
116,
118
],
[
107,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
127,
129
],
[
107,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
130,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
130,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
107,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
146,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
80,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
167,
169
],
[
162,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
176,
177
],
[
177,
178
],
[
176,
179
],
[
179,
180
],
[
179,
181
],
[
176,
182
],
[
182,
183
],
[
182,
184
],
[
170,
185
],
[
162,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
191,
192
],
[
191,
193
],
[
186,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
195,
200
],
[
200,
201
],
[
200,
202
],
[
194,
203
],
[
186,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
209,
210
],
[
209,
211
],
[
204,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
218,
219
],
[
218,
220
],
[
212,
221
],
[
204,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
226,
227
],
[
226,
228
],
[
6,
229
],
[
229,
230
],
[
0,
231
],
[
231,
232
],
[
231,
233
]
]
| [
"import java.util.Scanner; \n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] px = new int[101];\n int[] nx = new int[101];\n int[] dpx = new int[N];\n int[] dnx = new int[N];\n int cp = 0;\n int cn = 0;\n for (int i = 0; i < N; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = 0 ; i < 101; i++) {\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }\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 X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] px = new int[101];\n int[] nx = new int[101];\n int[] dpx = new int[N];\n int[] dnx = new int[N];\n int cp = 0;\n int cn = 0;\n for (int i = 0; i < N; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = 0 ; i < 101; i++) {\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] px = new int[101];\n int[] nx = new int[101];\n int[] dpx = new int[N];\n int[] dnx = new int[N];\n int cp = 0;\n int cn = 0;\n for (int i = 0; i < N; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = 0 ; i < 101; i++) {\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] px = new int[101];\n int[] nx = new int[101];\n int[] dpx = new int[N];\n int[] dnx = new int[N];\n int cp = 0;\n int cn = 0;\n for (int i = 0; i < N; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = 0 ; i < 101; i++) {\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] p = new int[N];",
"p",
"new int[N]",
"N",
"int[] px = new int[101];",
"px",
"new int[101]",
"101",
"int[] nx = new int[101];",
"nx",
"new int[101]",
"101",
"int[] dpx = new int[N];",
"dpx",
"new int[N]",
"N",
"int[] dnx = new int[N];",
"dnx",
"new int[N]",
"N",
"int cp = 0;",
"cp",
"0",
"int cn = 0;",
"cn",
"0",
"for (int i = 0; i < N; i++) {\n p[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n p[i] = sc.nextInt();\n }",
"{\n p[i] = sc.nextInt();\n }",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0 ; i < 101; i++) {\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }",
"{\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }",
"px[i] = X + i",
"px[i]",
"px",
"i",
"X + i",
"X",
"i",
"nx[i] = X - i",
"nx[i]",
"nx",
"i",
"X - i",
"X",
"i",
"for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < N",
"j",
"N",
"j++",
"j++",
"j",
"{\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }",
"{\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }",
"dpx[j] = px[i] - p[j]",
"dpx[j]",
"dpx",
"j",
"px[i] - p[j]",
"px[i]",
"px",
"i",
"p[j]",
"p",
"j",
"dnx[j] = nx[i] - p[j]",
"dnx[j]",
"dnx",
"j",
"nx[i] - p[j]",
"nx[i]",
"nx",
"i",
"p[j]",
"p",
"j",
"if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }",
"dpx[j] == 0",
"dpx[j]",
"dpx",
"j",
"0",
"{\n cp = cp;\n }",
"cp = cp",
"cp",
"cp",
"{\n cp = cp+1;\n }",
"cp = cp+1",
"cp",
"cp+1",
"cp",
"1",
"if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }",
"dnx[j] == 0",
"dnx[j]",
"dnx",
"j",
"0",
"{\n cn = cn;\n }",
"cn = cn",
"cn",
"cn",
"{\n cn =cn + 1;\n }",
"cn =cn + 1",
"cn",
"cn + 1",
"cn",
"1",
"if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }",
"cp == N && cn == N",
"cp == N",
"cp",
"N",
"cn == N",
"cn",
"N",
"{\n System.out.println(Math.min(px[i],nx[i]));\n break;\n }",
"System.out.println(Math.min(px[i],nx[i]))",
"System.out.println",
"System.out",
"System",
"System.out",
"Math.min(px[i],nx[i])",
"Math.min",
"Math",
"px[i]",
"px",
"i",
"nx[i]",
"nx",
"i",
"break;",
"if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }",
"cp == N && cn != N",
"cp == N",
"cp",
"N",
"cn != N",
"cn",
"N",
"{\n System.out.println(px[i]);\n break;\n }",
"System.out.println(px[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"px[i]",
"px",
"i",
"break;",
"if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }",
"cn == N && cp != N",
"cn == N",
"cn",
"N",
"cp != N",
"cp",
"N",
"{\n System.out.println(nx[i]);\n break;\n }",
"System.out.println(nx[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"nx[i]",
"nx",
"i",
"break;",
"{\n cp = 0;\n cn = 0;\n }",
"cp = 0",
"cp",
"0",
"cn = 0",
"cn",
"0",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] px = new int[101];\n int[] nx = new int[101];\n int[] dpx = new int[N];\n int[] dnx = new int[N];\n int cp = 0;\n int cn = 0;\n for (int i = 0; i < N; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = 0 ; i < 101; i++) {\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] px = new int[101];\n int[] nx = new int[101];\n int[] dpx = new int[N];\n int[] dnx = new int[N];\n int cp = 0;\n int cn = 0;\n for (int i = 0; i < N; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = 0 ; i < 101; i++) {\n px[i] = X + i;\n nx[i] = X - i;\n for (int j = 0; j < N; j++) {\n dpx[j] = px[i] - p[j];\n dnx[j] = nx[i] - p[j];\n if (dpx[j] == 0) {\n cp = cp;\n } else {\n cp = cp+1;\n }\n if (dnx[j] == 0) {\n cn = cn;\n } else {\n cn =cn + 1;\n }\n }\n if ( cp == N && cn == N) {\n System.out.println(Math.min(px[i],nx[i]));\n break;\n } else if (cp == N && cn != N){\n System.out.println(px[i]);\n break;\n } else if (cn == N && cp != N) {\n System.out.println(nx[i]);\n break;\n } else {\n cp = 0;\n cn = 0;\n }\n }\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
int[] p = new int[N];
int[] px = new int[101];
int[] nx = new int[101];
int[] dpx = new int[N];
int[] dnx = new int[N];
int cp = 0;
int cn = 0;
for (int i = 0; i < N; i++) {
p[i] = sc.nextInt();
}
for (int i = 0 ; i < 101; i++) {
px[i] = X + i;
nx[i] = X - i;
for (int j = 0; j < N; j++) {
dpx[j] = px[i] - p[j];
dnx[j] = nx[i] - p[j];
if (dpx[j] == 0) {
cp = cp;
} else {
cp = cp+1;
}
if (dnx[j] == 0) {
cn = cn;
} else {
cn =cn + 1;
}
}
if ( cp == N && cn == N) {
System.out.println(Math.min(px[i],nx[i]));
break;
} else if (cp == N && cn != N){
System.out.println(px[i]);
break;
} else if (cn == N && cp != N) {
System.out.println(nx[i]);
break;
} else {
cp = 0;
cn = 0;
}
}
}
} |
[
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,
4,
18,
13,
41,
13,
17,
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,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
40,
13,
14,
2,
18,
13,
13,
13,
40,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
3,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
3,
4,
18,
18,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
151,
14
],
[
151,
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
],
[
28,
29
],
[
29,
30
],
[
17,
31
],
[
31,
32
],
[
31,
33
],
[
17,
34
],
[
34,
35
],
[
34,
36
],
[
17,
37
],
[
37,
38
],
[
37,
39
],
[
17,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
17,
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
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
73,
84
],
[
84,
85
],
[
84,
86
],
[
73,
87
],
[
87,
88
],
[
87,
89
],
[
73,
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
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
103,
109
],
[
109,
110
],
[
102,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
111,
117
],
[
117,
118
],
[
73,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
123,
130
],
[
119,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
135,
142
],
[
17,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
15,
148
],
[
148,
149
],
[
0,
150
],
[
150,
151
],
[
150,
152
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\nimport java.lang.*;\nimport java.io.*;\n\npublic class Main\n{\n\tpublic static void main(String args[]) throws java.lang.Exception,FileNotFoundException\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// PrintStream obj = new PrintStream(new File(\"Output.txt\"));\n\t\t// PrintStream console = System.out;\n\t\t// System.setOut(obj);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tint min = 0;\n\t\tint max = 101;\n\n\t\tint[] arr = new int[N];\n\n\t\tfor(int i = 0;i<N;i++)\n\t\t{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0;i<=100;i++)\n\t\t{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.flush();\n\t}\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main\n{\n\tpublic static void main(String args[]) throws java.lang.Exception,FileNotFoundException\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// PrintStream obj = new PrintStream(new File(\"Output.txt\"));\n\t\t// PrintStream console = System.out;\n\t\t// System.setOut(obj);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tint min = 0;\n\t\tint max = 101;\n\n\t\tint[] arr = new int[N];\n\n\t\tfor(int i = 0;i<N;i++)\n\t\t{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0;i<=100;i++)\n\t\t{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.flush();\n\t}\n}",
"Main",
"public static void main(String args[]) throws java.lang.Exception,FileNotFoundException\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// PrintStream obj = new PrintStream(new File(\"Output.txt\"));\n\t\t// PrintStream console = System.out;\n\t\t// System.setOut(obj);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tint min = 0;\n\t\tint max = 101;\n\n\t\tint[] arr = new int[N];\n\n\t\tfor(int i = 0;i<N;i++)\n\t\t{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0;i<=100;i++)\n\t\t{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.flush();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// PrintStream obj = new PrintStream(new File(\"Output.txt\"));\n\t\t// PrintStream console = System.out;\n\t\t// System.setOut(obj);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tint min = 0;\n\t\tint max = 101;\n\n\t\tint[] arr = new int[N];\n\n\t\tfor(int i = 0;i<N;i++)\n\t\t{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0;i<=100;i++)\n\t\t{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.flush();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int min = 0;",
"min",
"0",
"int max = 101;",
"max",
"101",
"int[] arr = new int[N];",
"arr",
"new int[N]",
"N",
"for(int i = 0;i<N;i++)\n\t\t{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}",
"arr[i] = sc.nextInt()",
"arr[i]",
"arr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0;i<=100;i++)\n\t\t{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<=100",
"i",
"100",
"i++",
"i++",
"i",
"{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int num1 = X - i;",
"num1",
"X - i",
"X",
"i",
"int num2 = X + i;",
"num2",
"X + i",
"X",
"i",
"int count1 = 0;",
"count1",
"0",
"int count2 = 0;",
"count2",
"0",
"for(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j<N",
"j",
"N",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}",
"{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}",
"if(arr[j] == num1)\n\t\t\t\t\tcount1++;",
"arr[j] == num1",
"arr[j]",
"arr",
"j",
"num1",
"count1++",
"count1",
"if(arr[j] == num2)\n\t\t\t\t\tcount2++;",
"arr[j] == num2",
"arr[j]",
"arr",
"j",
"num2",
"count2++",
"count2",
"if(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}",
"count1 == 0",
"count1",
"0",
"{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(num1)",
"System.out.println",
"System.out",
"System",
"System.out",
"num1",
"break;",
"if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}",
"count2 == 0",
"count2",
"0",
"{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(num2)",
"System.out.println",
"System.out",
"System",
"System.out",
"num2",
"break;",
"System.out.flush()",
"System.out.flush",
"System.out",
"System",
"System.out",
"String args[]",
"args",
"public class Main\n{\n\tpublic static void main(String args[]) throws java.lang.Exception,FileNotFoundException\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// PrintStream obj = new PrintStream(new File(\"Output.txt\"));\n\t\t// PrintStream console = System.out;\n\t\t// System.setOut(obj);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tint min = 0;\n\t\tint max = 101;\n\n\t\tint[] arr = new int[N];\n\n\t\tfor(int i = 0;i<N;i++)\n\t\t{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0;i<=100;i++)\n\t\t{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.flush();\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String args[]) throws java.lang.Exception,FileNotFoundException\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// PrintStream obj = new PrintStream(new File(\"Output.txt\"));\n\t\t// PrintStream console = System.out;\n\t\t// System.setOut(obj);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tint min = 0;\n\t\tint max = 101;\n\n\t\tint[] arr = new int[N];\n\n\t\tfor(int i = 0;i<N;i++)\n\t\t{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0;i<=100;i++)\n\t\t{\n\t\t\tint num1 = X - i;\n\t\t\tint num2 = X + i;\n\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\n\t\t\tfor(int j = 0;j<N;j++)\n\t\t\t{\n\t\t\t\tif(arr[j] == num1)\n\t\t\t\t\tcount1++;\n\n\t\t\t\tif(arr[j] == num2)\n\t\t\t\t\tcount2++;\n\t\t\t}\n\n\t\t\tif(count1 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse if(count2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println(num2);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.flush();\n\t}\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main(String args[]) throws java.lang.Exception,FileNotFoundException
{
Scanner sc = new Scanner(System.in);
// PrintStream obj = new PrintStream(new File("Output.txt"));
// PrintStream console = System.out;
// System.setOut(obj);
int X = sc.nextInt();
int N = sc.nextInt();
int min = 0;
int max = 101;
int[] arr = new int[N];
for(int i = 0;i<N;i++)
{
arr[i] = sc.nextInt();
}
for(int i = 0;i<=100;i++)
{
int num1 = X - i;
int num2 = X + i;
int count1 = 0;
int count2 = 0;
for(int j = 0;j<N;j++)
{
if(arr[j] == num1)
count1++;
if(arr[j] == num2)
count2++;
}
if(count1 == 0)
{
System.out.println(num1);
break;
}
else if(count2 == 0)
{
System.out.println(num2);
break;
}
}
System.out.flush();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
3,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
0,
13,
2,
13,
13,
3,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
0,
13,
2,
13,
13,
3,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
175,
5
],
[
175,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
8,
32
],
[
32,
33
],
[
32,
34
],
[
8,
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
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
8,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
83,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
83,
124
],
[
124,
125
],
[
124,
126
],
[
83,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
127,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
140,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
83,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
157,
163
],
[
83,
164
],
[
164,
165
],
[
8,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
6,
172
],
[
172,
173
],
[
0,
174
],
[
174,
175
],
[
174,
176
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint x = scanner.nextInt();\n\t\tint n = scanner.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tint dif = 1;\n\t\tint flag = 1;\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile (flag == 0) {\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint x = scanner.nextInt();\n\t\tint n = scanner.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tint dif = 1;\n\t\tint flag = 1;\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile (flag == 0) {\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint x = scanner.nextInt();\n\t\tint n = scanner.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tint dif = 1;\n\t\tint flag = 1;\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile (flag == 0) {\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint x = scanner.nextInt();\n\t\tint n = scanner.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tint dif = 1;\n\t\tint flag = 1;\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile (flag == 0) {\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int x = scanner.nextInt();",
"x",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"int ans = x;",
"ans",
"x",
"int dif = 1;",
"dif",
"1",
"int flag = 1;",
"flag",
"1",
"for (int i = 0; i < n; i++) {\n\t\t\tp[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tp[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tp[i] = scanner.nextInt();\n\t\t}",
"p[i] = scanner.nextInt()",
"p[i]",
"p",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"for (int i = 0; i < n; i++) {\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"p[i] == x",
"p[i]",
"p",
"i",
"x",
"{\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}",
"flag = 0",
"flag",
"0",
"break;",
"while (flag == 0) {\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}",
"flag == 0",
"flag",
"0",
"{\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}",
"flag = 1",
"flag",
"1",
"for (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"p[i] == x - dif",
"p[i]",
"p",
"i",
"x - dif",
"x",
"dif",
"{\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"flag = 0",
"flag",
"0",
"break;",
"if (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = x - dif",
"ans",
"x - dif",
"x",
"dif",
"break;",
"flag = 1",
"flag",
"1",
"for (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"p[i] == x + dif",
"p[i]",
"p",
"i",
"x + dif",
"x",
"dif",
"{\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"flag = 0",
"flag",
"0",
"break;",
"if (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = x + dif",
"ans",
"x + dif",
"x",
"dif",
"break;",
"dif++",
"dif",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint x = scanner.nextInt();\n\t\tint n = scanner.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tint dif = 1;\n\t\tint flag = 1;\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile (flag == 0) {\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint x = scanner.nextInt();\n\t\tint n = scanner.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tint dif = 1;\n\t\tint flag = 1;\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (p[i] == x) {\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile (flag == 0) {\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x - dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tflag = 1;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (p[i] == x + dif) {\n\t\t\t\t\tflag = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (flag == 1) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdif++;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
int n = scanner.nextInt();
int[] p = new int[n];
int ans = x;
int dif = 1;
int flag = 1;
for (int i = 0; i < n; i++) {
p[i] = scanner.nextInt();
}
for (int i = 0; i < n; i++) {
if (p[i] == x) {
flag = 0;
break;
}
}
while (flag == 0) {
flag = 1;
for (int i = 0; i < n; i++) {
if (p[i] == x - dif) {
flag = 0;
break;
}
}
if (flag == 1) {
ans = x - dif;
break;
}
flag = 1;
for (int i = 0; i < n; i++) {
if (p[i] == x + dif) {
flag = 0;
break;
}
}
if (flag == 1) {
ans = x + dif;
break;
}
dif++;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
41,
13,
20,
17,
4,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
9,
14,
2,
2,
13,
13,
17,
9,
14,
2,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
4,
18,
13,
17,
14,
2,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
4,
18,
13,
17,
4,
18,
18,
13,
13,
17,
23,
13,
6,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
152,
8
],
[
152,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
29,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
11,
40
],
[
40,
41
],
[
40,
42
],
[
11,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
44,
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
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
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
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
85,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
92,
98
],
[
84,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
100,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
107,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
84,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
128,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
11,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
9,
147
],
[
147,
148
],
[
0,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
]
| [
"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n==0){\n System.out.println(x);\n System.exit(0);\n }\n int number[] = new int[201];\n Arrays.fill(number,1);\n for(int i=0;i<n;i++){\n int p = sc.nextInt();\n number[p]=0;\n }\n for(int i=0;i<=200;i++){\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }\n System.out.println(0);//配列全て0で埋まっている\n }\n}\n\nclass Monmo {\n \n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n==0){\n System.out.println(x);\n System.exit(0);\n }\n int number[] = new int[201];\n Arrays.fill(number,1);\n for(int i=0;i<n;i++){\n int p = sc.nextInt();\n number[p]=0;\n }\n for(int i=0;i<=200;i++){\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }\n System.out.println(0);//配列全て0で埋まっている\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n==0){\n System.out.println(x);\n System.exit(0);\n }\n int number[] = new int[201];\n Arrays.fill(number,1);\n for(int i=0;i<n;i++){\n int p = sc.nextInt();\n number[p]=0;\n }\n for(int i=0;i<=200;i++){\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }\n System.out.println(0);//配列全て0で埋まっている\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n==0){\n System.out.println(x);\n System.exit(0);\n }\n int number[] = new int[201];\n Arrays.fill(number,1);\n for(int i=0;i<n;i++){\n int p = sc.nextInt();\n number[p]=0;\n }\n for(int i=0;i<=200;i++){\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }\n System.out.println(0);//配列全て0で埋まっている\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n==0){\n System.out.println(x);\n System.exit(0);\n }",
"n==0",
"n",
"0",
"{\n System.out.println(x);\n System.exit(0);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"int number[] = new int[201];",
"number",
"new int[201]",
"201",
"Arrays.fill(number,1)",
"Arrays.fill",
"Arrays",
"number",
"1",
"for(int i=0;i<n;i++){\n int p = sc.nextInt();\n number[p]=0;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int p = sc.nextInt();\n number[p]=0;\n }",
"{\n int p = sc.nextInt();\n number[p]=0;\n }",
"int p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"number[p]=0",
"number[p]",
"number",
"p",
"0",
"for(int i=0;i<=200;i++){\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }",
"{\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }",
"if(x-i <= 0)continue;",
"x-i <= 0",
"x-i",
"x",
"i",
"0",
"continue;",
"if(x+i > 200)continue;",
"x+i > 200",
"x+i",
"x",
"i",
"200",
"continue;",
"if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }",
"number[x-i]==1",
"number[x-i]",
"number",
"x-i",
"x",
"i",
"1",
"{\n System.out.println(x-i);\n System.exit(0);\n }",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"System.exit(0)",
"System.exit",
"System",
"0",
"if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }",
"number[x+i]==1",
"number[x+i]",
"number",
"x+i",
"x",
"i",
"1",
"{\n System.out.println(x+i);\n System.exit(0);\n }",
"System.out.println(x+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"String[] args",
"args",
"class Monmo {\n \n}",
"Monmo",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n==0){\n System.out.println(x);\n System.exit(0);\n }\n int number[] = new int[201];\n Arrays.fill(number,1);\n for(int i=0;i<n;i++){\n int p = sc.nextInt();\n number[p]=0;\n }\n for(int i=0;i<=200;i++){\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }\n System.out.println(0);//配列全て0で埋まっている\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n==0){\n System.out.println(x);\n System.exit(0);\n }\n int number[] = new int[201];\n Arrays.fill(number,1);\n for(int i=0;i<n;i++){\n int p = sc.nextInt();\n number[p]=0;\n }\n for(int i=0;i<=200;i++){\n if(x-i <= 0)continue;\n if(x+i > 200)continue;\n if(number[x-i]==1){\n System.out.println(x-i);\n System.exit(0);\n }\n if(number[x+i]==1){\n System.out.println(x+i);\n System.exit(0);\n }\n }\n System.out.println(0);//配列全て0で埋まっている\n }\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if(n==0){
System.out.println(x);
System.exit(0);
}
int number[] = new int[201];
Arrays.fill(number,1);
for(int i=0;i<n;i++){
int p = sc.nextInt();
number[p]=0;
}
for(int i=0;i<=200;i++){
if(x-i <= 0)continue;
if(x+i > 200)continue;
if(number[x-i]==1){
System.out.println(x-i);
System.exit(0);
}
if(number[x+i]==1){
System.out.println(x+i);
System.exit(0);
}
}
System.out.println(0);//配列全て0で埋まっている
}
}
class Monmo {
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
17,
41,
13,
13,
41,
13,
17,
42,
17,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
13,
3,
14,
2,
4,
18,
13,
13,
17,
30,
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
],
[
99,
5
],
[
99,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
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
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
53,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
53,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
65,
70
],
[
64,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
53,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
77,
82
],
[
76,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
53,
88
],
[
88,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
6,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
]
]
| [
"import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n HashMap<Integer, Integer> data = new HashMap<>();\n \n for(int i = 0; i<n;i++) {\n data.put(sc.nextInt(), 1);\n }\n \n int output = x;\n int diff = 0;\n \n while(true) {\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }\n \n System.out.println(output);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n HashMap<Integer, Integer> data = new HashMap<>();\n \n for(int i = 0; i<n;i++) {\n data.put(sc.nextInt(), 1);\n }\n \n int output = x;\n int diff = 0;\n \n while(true) {\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }\n \n System.out.println(output);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n HashMap<Integer, Integer> data = new HashMap<>();\n \n for(int i = 0; i<n;i++) {\n data.put(sc.nextInt(), 1);\n }\n \n int output = x;\n int diff = 0;\n \n while(true) {\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }\n \n System.out.println(output);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n HashMap<Integer, Integer> data = new HashMap<>();\n \n for(int i = 0; i<n;i++) {\n data.put(sc.nextInt(), 1);\n }\n \n int output = x;\n int diff = 0;\n \n while(true) {\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }\n \n System.out.println(output);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"HashMap<Integer, Integer> data = new HashMap<>();",
"data",
"new HashMap<>()",
"for(int i = 0; i<n;i++) {\n data.put(sc.nextInt(), 1);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n data.put(sc.nextInt(), 1);\n }",
"{\n data.put(sc.nextInt(), 1);\n }",
"data.put(sc.nextInt(), 1)",
"data.put",
"data",
"sc.nextInt()",
"sc.nextInt",
"sc",
"1",
"int output = x;",
"output",
"x",
"int diff = 0;",
"diff",
"0",
"while(true) {\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }",
"true",
"{\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }",
"int val = x-diff;",
"val",
"x-diff",
"x",
"diff",
"int val2 = x+diff;",
"val2",
"x+diff",
"x",
"diff",
"if(data.get(val) == null) {\n output = val;\n break;\n }",
"data.get(val) == null",
"data.get(val)",
"data.get",
"data",
"val",
"null",
"{\n output = val;\n break;\n }",
"output = val",
"output",
"val",
"break;",
"if(data.get(val2) == null) {\n output = val2;\n break;\n }",
"data.get(val2) == null",
"data.get(val2)",
"data.get",
"data",
"val2",
"null",
"{\n output = val2;\n break;\n }",
"output = val2",
"output",
"val2",
"break;",
"diff++",
"diff",
"System.out.println(output)",
"System.out.println",
"System.out",
"System",
"System.out",
"output",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n HashMap<Integer, Integer> data = new HashMap<>();\n \n for(int i = 0; i<n;i++) {\n data.put(sc.nextInt(), 1);\n }\n \n int output = x;\n int diff = 0;\n \n while(true) {\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }\n \n System.out.println(output);\n }\n}",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n HashMap<Integer, Integer> data = new HashMap<>();\n \n for(int i = 0; i<n;i++) {\n data.put(sc.nextInt(), 1);\n }\n \n int output = x;\n int diff = 0;\n \n while(true) {\n int val = x-diff;\n int val2 = x+diff;\n if(data.get(val) == null) {\n output = val;\n break;\n }\n \n if(data.get(val2) == null) {\n output = val2;\n break;\n }\n diff++;\n }\n \n System.out.println(output);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
HashMap<Integer, Integer> data = new HashMap<>();
for(int i = 0; i<n;i++) {
data.put(sc.nextInt(), 1);
}
int output = x;
int diff = 0;
while(true) {
int val = x-diff;
int val2 = x+diff;
if(data.get(val) == null) {
output = val;
break;
}
if(data.get(val2) == null) {
output = val2;
break;
}
diff++;
}
System.out.println(output);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
13,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
2,
13,
13,
0,
13,
13,
3,
11,
1,
41,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
2,
13,
13,
0,
13,
13,
3,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
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
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
30,
37
],
[
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
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
67,
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
],
[
89,
93
],
[
88,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
116,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
117,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
123,
129
],
[
129,
130
],
[
129,
131
],
[
123,
132
],
[
8,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
133,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
6,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
]
| [
"import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] v = new int[102];\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n int p = sc.nextInt();\n v[p] = 1;\n }\n\n int left = 0, right = 0, ans_le = 0, ans_ri = 0;\n for (int i = x; i < v.length; i++) {\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }\n\n for (int i = x; i >= 0; i--) {\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }\n\n if (left > right) {\n System.out.println(ans_ri);\n } else {\n System.out.println(ans_le);\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 x = sc.nextInt();\n int n = sc.nextInt();\n int[] v = new int[102];\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n int p = sc.nextInt();\n v[p] = 1;\n }\n\n int left = 0, right = 0, ans_le = 0, ans_ri = 0;\n for (int i = x; i < v.length; i++) {\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }\n\n for (int i = x; i >= 0; i--) {\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }\n\n if (left > right) {\n System.out.println(ans_ri);\n } else {\n System.out.println(ans_le);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] v = new int[102];\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n int p = sc.nextInt();\n v[p] = 1;\n }\n\n int left = 0, right = 0, ans_le = 0, ans_ri = 0;\n for (int i = x; i < v.length; i++) {\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }\n\n for (int i = x; i >= 0; i--) {\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }\n\n if (left > right) {\n System.out.println(ans_ri);\n } else {\n System.out.println(ans_le);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] v = new int[102];\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n int p = sc.nextInt();\n v[p] = 1;\n }\n\n int left = 0, right = 0, ans_le = 0, ans_ri = 0;\n for (int i = x; i < v.length; i++) {\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }\n\n for (int i = x; i >= 0; i--) {\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }\n\n if (left > right) {\n System.out.println(ans_ri);\n } else {\n System.out.println(ans_le);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] v = new int[102];",
"v",
"new int[102]",
"102",
"if (n == 0) {\n System.out.println(x);\n return;\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"for (int i = 0; i < n; i++) {\n int p = sc.nextInt();\n v[p] = 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int p = sc.nextInt();\n v[p] = 1;\n }",
"{\n int p = sc.nextInt();\n v[p] = 1;\n }",
"int p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"v[p] = 1",
"v[p]",
"v",
"p",
"1",
"int left = 0",
"left",
"0",
"right = 0",
"right",
"0",
"ans_le = 0",
"ans_le",
"0",
"ans_ri = 0;",
"ans_ri",
"0",
"for (int i = x; i < v.length; i++) {\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }",
"int i = x;",
"int i = x;",
"i",
"x",
"i < v.length",
"i",
"v.length",
"v",
"v.length",
"i++",
"i++",
"i",
"{\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }",
"{\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }",
"if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }",
"v[i] == 0",
"v[i]",
"v",
"i",
"0",
"{\n right = i - x;\n ans_ri = i;\n break;\n }",
"right = i - x",
"right",
"i - x",
"i",
"x",
"ans_ri = i",
"ans_ri",
"i",
"break;",
"for (int i = x; i >= 0; i--) {\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }",
"int i = x;",
"int i = x;",
"i",
"x",
"i >= 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }",
"{\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }",
"if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }",
"v[i] == 0",
"v[i]",
"v",
"i",
"0",
"{\n left = x - i;\n ans_le = i;\n break;\n }",
"left = x - i",
"left",
"x - i",
"x",
"i",
"ans_le = i",
"ans_le",
"i",
"break;",
"if (left > right) {\n System.out.println(ans_ri);\n } else {\n System.out.println(ans_le);\n }",
"left > right",
"left",
"right",
"{\n System.out.println(ans_ri);\n }",
"System.out.println(ans_ri)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans_ri",
"{\n System.out.println(ans_le);\n }",
"System.out.println(ans_le)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans_le",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] v = new int[102];\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n int p = sc.nextInt();\n v[p] = 1;\n }\n\n int left = 0, right = 0, ans_le = 0, ans_ri = 0;\n for (int i = x; i < v.length; i++) {\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }\n\n for (int i = x; i >= 0; i--) {\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }\n\n if (left > right) {\n System.out.println(ans_ri);\n } else {\n System.out.println(ans_le);\n }\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] v = new int[102];\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n for (int i = 0; i < n; i++) {\n int p = sc.nextInt();\n v[p] = 1;\n }\n\n int left = 0, right = 0, ans_le = 0, ans_ri = 0;\n for (int i = x; i < v.length; i++) {\n if (v[i] == 0) {\n right = i - x;\n ans_ri = i;\n break;\n }\n }\n\n for (int i = x; i >= 0; i--) {\n if (v[i] == 0) {\n left = x - i;\n ans_le = i;\n break;\n }\n }\n\n if (left > right) {\n System.out.println(ans_ri);\n } else {\n System.out.println(ans_le);\n }\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int[] v = new int[102];
if (n == 0) {
System.out.println(x);
return;
}
for (int i = 0; i < n; i++) {
int p = sc.nextInt();
v[p] = 1;
}
int left = 0, right = 0, ans_le = 0, ans_ri = 0;
for (int i = x; i < v.length; i++) {
if (v[i] == 0) {
right = i - x;
ans_ri = i;
break;
}
}
for (int i = x; i >= 0; i--) {
if (v[i] == 0) {
left = x - i;
ans_le = i;
break;
}
}
if (left > right) {
System.out.println(ans_ri);
} else {
System.out.println(ans_le);
}
}
} |
[
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,
4,
18,
13,
41,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
0,
13,
17,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
4,
18,
13,
13,
2,
17,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
0,
13,
17,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
0,
13,
17,
3,
14,
40,
13,
30,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
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
],
[
156,
11
],
[
156,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
35,
42
],
[
42,
43
],
[
42,
44
],
[
31,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
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
],
[
62,
65
],
[
65,
66
],
[
66,
67
],
[
45,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
76,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
68,
84
],
[
84,
85
],
[
85,
86
],
[
68,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
97,
106
],
[
106,
107
],
[
106,
108
],
[
97,
109
],
[
89,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
115,
116
],
[
115,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
127,
128
],
[
127,
129
],
[
118,
130
],
[
45,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
135,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
12,
153
],
[
153,
154
],
[
0,
155
],
[
155,
156
],
[
155,
157
]
]
| [
"import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n boolean flag=false;\n if(N==0) {\n System.out.println(X);\n flag=true;\n }else {\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }\n\t}\n\n}",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n boolean flag=false;\n if(N==0) {\n System.out.println(X);\n flag=true;\n }else {\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n boolean flag=false;\n if(N==0) {\n System.out.println(X);\n flag=true;\n }else {\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }\n\t}",
"main",
"{\n\t Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n boolean flag=false;\n if(N==0) {\n System.out.println(X);\n flag=true;\n }else {\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean flag=false;",
"flag",
"false",
"if(N==0) {\n System.out.println(X);\n flag=true;\n }else {\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }",
"N==0",
"N",
"0",
"{\n System.out.println(X);\n flag=true;\n }",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"flag=true",
"flag",
"true",
"{\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }",
"Set<Integer> nums = new HashSet<Integer>();",
"nums",
"new HashSet<Integer>()",
"for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n nums.add(sc.nextInt());\n }",
"{\n nums.add(sc.nextInt());\n }",
"nums.add(sc.nextInt())",
"nums.add",
"nums",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<Math.min(X,101-X)+1",
"i",
"Math.min(X,101-X)+1",
"Math.min(X,101-X)",
"Math.min",
"Math",
"X",
"101-X",
"101",
"X",
"1",
"i++",
"i++",
"i",
"{\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }",
"{\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }",
"if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }",
"!nums.contains(X-i)",
"nums.contains(X-i)",
"nums.contains",
"nums",
"X-i",
"X",
"i",
"{\n System.out.println(X-i);\n flag=true;\n break;\n }",
"System.out.println(X-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X-i",
"X",
"i",
"flag=true",
"flag",
"true",
"break;",
"if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }",
"!nums.contains(X+i)",
"nums.contains(X+i)",
"nums.contains",
"nums",
"X+i",
"X",
"i",
"{\n System.out.println(X+i);\n flag=true;\n break;\n }",
"System.out.println(X+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X+i",
"X",
"i",
"flag=true",
"flag",
"true",
"break;",
"if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }",
"!flag",
"flag",
"{\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }",
"if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }",
"X<=50",
"X",
"50",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n System.out.println(101);\n }",
"System.out.println(101)",
"System.out.println",
"System.out",
"System",
"System.out",
"101",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n boolean flag=false;\n if(N==0) {\n System.out.println(X);\n flag=true;\n }else {\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n boolean flag=false;\n if(N==0) {\n System.out.println(X);\n flag=true;\n }else {\n Set<Integer> nums = new HashSet<Integer>();\n for(int i=0; i<N; i++) {\n nums.add(sc.nextInt());\n }\n\n for(int i=0; i<Math.min(X,101-X)+1;i++) {\n if(!nums.contains(X-i)) {\n System.out.println(X-i);\n flag=true;\n break;\n }else if(!nums.contains(X+i)){\n System.out.println(X+i);\n flag=true;\n break;\n }\n }\n if(!flag) {\n if(X<=50) {\n System.out.println(0);\n }else {\n System.out.println(101);\n }\n }\n\n }\n\t}\n\n}",
"Main"
]
| import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
boolean flag=false;
if(N==0) {
System.out.println(X);
flag=true;
}else {
Set<Integer> nums = new HashSet<Integer>();
for(int i=0; i<N; i++) {
nums.add(sc.nextInt());
}
for(int i=0; i<Math.min(X,101-X)+1;i++) {
if(!nums.contains(X-i)) {
System.out.println(X-i);
flag=true;
break;
}else if(!nums.contains(X+i)){
System.out.println(X+i);
flag=true;
break;
}
}
if(!flag) {
if(X<=50) {
System.out.println(0);
}else {
System.out.println(101);
}
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
13,
30,
4,
18,
13,
13,
0,
13,
17,
3,
14,
40,
13,
30,
4,
18,
18,
13,
13,
13,
3,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
2,
13,
13,
30,
0,
13,
17,
4,
18,
13,
13,
40,
13,
14,
2,
4,
18,
13,
13,
2,
13,
13,
30,
0,
13,
17,
4,
18,
13,
13,
40,
13,
14,
2,
13,
13,
30,
3,
14,
40,
2,
13,
13,
30,
14,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
231,
8
],
[
231,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
11,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
47,
58
],
[
58,
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
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
80,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
96,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
102,
107
],
[
107,
108
],
[
107,
109
],
[
102,
110
],
[
76,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
114,
121
],
[
72,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
126,
128
],
[
122,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
129,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
145,
150
],
[
150,
151
],
[
150,
152
],
[
144,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
153,
161
],
[
161,
162
],
[
144,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
165,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
163,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
177,
178
],
[
176,
179
],
[
172,
180
],
[
180,
181
],
[
143,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
186,
187
],
[
122,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
188,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
197,
202
],
[
202,
203
],
[
202,
204
],
[
196,
205
],
[
194,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
209,
214
],
[
214,
215
],
[
214,
216
],
[
208,
217
],
[
206,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
219,
224
],
[
224,
225
],
[
224,
226
],
[
218,
227
],
[
9,
228
],
[
228,
229
],
[
0,
230
],
[
230,
231
],
[
230,
232
]
]
| [
"import java.util.Scanner;\nimport java.util.ArrayList;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n //input\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> intArray = new ArrayList<Integer>();\n for(int i = 0; i < n; i++){\n intArray.add(sc.nextInt());\n }\n\n //output\n if( n == 0 ){\n System.out.println(x);\n }else{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }\n\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n //input\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> intArray = new ArrayList<Integer>();\n for(int i = 0; i < n; i++){\n intArray.add(sc.nextInt());\n }\n\n //output\n if( n == 0 ){\n System.out.println(x);\n }else{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }\n\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n //input\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> intArray = new ArrayList<Integer>();\n for(int i = 0; i < n; i++){\n intArray.add(sc.nextInt());\n }\n\n //output\n if( n == 0 ){\n System.out.println(x);\n }else{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n //input\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> intArray = new ArrayList<Integer>();\n for(int i = 0; i < n; i++){\n intArray.add(sc.nextInt());\n }\n\n //output\n if( n == 0 ){\n System.out.println(x);\n }else{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ArrayList<Integer> intArray = new ArrayList<Integer>();",
"intArray",
"new ArrayList<Integer>()",
"for(int i = 0; i < n; i++){\n intArray.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n intArray.add(sc.nextInt());\n }",
"{\n intArray.add(sc.nextInt());\n }",
"intArray.add(sc.nextInt())",
"intArray.add",
"intArray",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if( n == 0 ){\n System.out.println(x);\n }else{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }",
"for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 1000",
"i",
"1000",
"i++",
"i++",
"i",
"{\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }",
"{\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }",
"if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }",
"i == 0",
"i",
"0",
"{\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }",
"boolean found = false;",
"found",
"false",
"for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < intArray.size()",
"j",
"intArray.size()",
"intArray.size",
"intArray",
"j++",
"j++",
"j",
"{\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }",
"{\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }",
"if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }",
"intArray.get(j) == x",
"intArray.get(j)",
"intArray.get",
"intArray",
"j",
"x",
"{\n intArray.remove(j);\n found = true;\n break;\n }",
"intArray.remove(j)",
"intArray.remove",
"intArray",
"j",
"found = true",
"found",
"true",
"break;",
"if( !found ){\n System.out.println(x);\n break;\n }",
"!found",
"found",
"{\n System.out.println(x);\n break;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"break;",
"{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }",
"boolean highExist = false;",
"highExist",
"false",
"boolean lowExist = false;",
"lowExist",
"false",
"for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < intArray.size()",
"j",
"intArray.size()",
"intArray.size",
"intArray",
"j++",
"j++",
"j",
"{\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }",
"{\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }",
"if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }",
"intArray.get(j) == x+i",
"intArray.get(j)",
"intArray.get",
"intArray",
"j",
"x+i",
"x",
"i",
"{\n highExist = true;\n intArray.remove(j);\n j--;\n }",
"highExist = true",
"highExist",
"true",
"intArray.remove(j)",
"intArray.remove",
"intArray",
"j",
"j--",
"j",
"if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }",
"intArray.get(j) == x-i",
"intArray.get(j)",
"intArray.get",
"intArray",
"j",
"x-i",
"x",
"i",
"{\n lowExist = true;\n intArray.remove(j);\n j--;\n }",
"lowExist = true",
"lowExist",
"true",
"intArray.remove(j)",
"intArray.remove",
"intArray",
"j",
"j--",
"j",
"if( highExist && lowExist ){\n break;\n }",
"highExist && lowExist",
"highExist",
"lowExist",
"{\n break;\n }",
"break;",
"if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }",
"!(highExist && lowExist)",
"(highExist && lowExist)",
"highExist",
"lowExist",
"{\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }",
"if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }",
"highExist",
"{\n System.out.println(x-i);\n break;\n }",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"break;",
"if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }",
"lowExist",
"{\n System.out.println(x+i);\n break;\n }",
"System.out.println(x+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"break;",
"{\n System.out.println(x-i);\n break;\n }",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"break;",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n //input\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> intArray = new ArrayList<Integer>();\n for(int i = 0; i < n; i++){\n intArray.add(sc.nextInt());\n }\n\n //output\n if( n == 0 ){\n System.out.println(x);\n }else{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }\n\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n //input\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> intArray = new ArrayList<Integer>();\n for(int i = 0; i < n; i++){\n intArray.add(sc.nextInt());\n }\n\n //output\n if( n == 0 ){\n System.out.println(x);\n }else{\n\n for(int i = 0; i < 1000; i++){\n\n if( i == 0 ){\n boolean found = false;\n for(int j = 0; j < intArray.size(); j++){\n if( intArray.get(j) == x ){\n intArray.remove(j);\n found = true;\n break;\n }\n }\n if( !found ){\n System.out.println(x);\n break;\n }\n }else{\n boolean highExist = false;\n boolean lowExist = false;\n for(int j = 0; j < intArray.size(); j++){\n\n if( intArray.get(j) == x+i ){\n highExist = true;\n intArray.remove(j);\n j--;\n }else if( intArray.get(j) == x-i ){\n lowExist = true;\n intArray.remove(j);\n j--;\n }\n\n if( highExist && lowExist ){\n break;\n }\n\n }\n if( !(highExist && lowExist) ){\n if( highExist ){\n System.out.println(x-i);\n break;\n }else if( lowExist ){\n System.out.println(x+i);\n break;\n }else{\n System.out.println(x-i);\n break;\n }\n }\n }\n\n }\n\n }\n\n }\n}",
"Main"
]
| import java.util.Scanner;
import java.util.ArrayList;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
//input
int x = sc.nextInt();
int n = sc.nextInt();
ArrayList<Integer> intArray = new ArrayList<Integer>();
for(int i = 0; i < n; i++){
intArray.add(sc.nextInt());
}
//output
if( n == 0 ){
System.out.println(x);
}else{
for(int i = 0; i < 1000; i++){
if( i == 0 ){
boolean found = false;
for(int j = 0; j < intArray.size(); j++){
if( intArray.get(j) == x ){
intArray.remove(j);
found = true;
break;
}
}
if( !found ){
System.out.println(x);
break;
}
}else{
boolean highExist = false;
boolean lowExist = false;
for(int j = 0; j < intArray.size(); j++){
if( intArray.get(j) == x+i ){
highExist = true;
intArray.remove(j);
j--;
}else if( intArray.get(j) == x-i ){
lowExist = true;
intArray.remove(j);
j--;
}
if( highExist && lowExist ){
break;
}
}
if( !(highExist && lowExist) ){
if( highExist ){
System.out.println(x-i);
break;
}else if( lowExist ){
System.out.println(x+i);
break;
}else{
System.out.println(x-i);
break;
}
}
}
}
}
}
}
|
[
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,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
42,
13,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
17,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
17,
4,
18,
18,
13,
13,
2,
13,
13,
3,
40,
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
],
[
121,
11
],
[
121,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
32,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
14,
43
],
[
43,
44
],
[
43,
45
],
[
14,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
46,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
63,
64
],
[
14,
65
],
[
65,
66
],
[
65,
67
],
[
14,
68
],
[
68,
69
],
[
68,
70
],
[
14,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
82,
94
],
[
73,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
103,
115
],
[
73,
116
],
[
116,
117
],
[
12,
118
],
[
118,
119
],
[
0,
120
],
[
120,
121
],
[
120,
122
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tList<Integer> list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tboolean bool = true;\n\t\tint i = 0;\n\t\twhile (bool) {\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tList<Integer> list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tboolean bool = true;\n\t\tint i = 0;\n\t\twhile (bool) {\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tList<Integer> list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tboolean bool = true;\n\t\tint i = 0;\n\t\twhile (bool) {\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tList<Integer> list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tboolean bool = true;\n\t\tint i = 0;\n\t\twhile (bool) {\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"List<Integer> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"list.add(sc.nextInt())",
"list.add",
"list",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean bool = true;",
"bool",
"true",
"int i = 0;",
"i",
"0",
"while (bool) {\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"bool",
"{\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"if (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x - i)",
"list.contains(x - i)",
"list.contains",
"list",
"x - i",
"x",
"i",
"{\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}",
"bool = false",
"bool",
"false",
"System.out.println(x - i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x - i",
"x",
"i",
"break;",
"if (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x + i)",
"list.contains(x + i)",
"list.contains",
"list",
"x + i",
"x",
"i",
"{\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}",
"bool = false",
"bool",
"false",
"System.out.println(x + i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x + i",
"x",
"i",
"break;",
"i++",
"i",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tList<Integer> list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tboolean bool = true;\n\t\tint i = 0;\n\t\twhile (bool) {\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\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\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tList<Integer> list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tboolean bool = true;\n\t\tint i = 0;\n\t\twhile (bool) {\n\t\t\tif (!list.contains(x - i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!list.contains(x + i)) {\n\t\t\t\tbool = false;\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if (n == 0) {
System.out.println(x);
System.exit(0);
}
List<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
boolean bool = true;
int i = 0;
while (bool) {
if (!list.contains(x - i)) {
bool = false;
System.out.println(x - i);
break;
}
if (!list.contains(x + i)) {
bool = false;
System.out.println(x + i);
break;
}
i++;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
14,
2,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
100,
5
],
[
100,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
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
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
63,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
76,
77
],
[
76,
78
],
[
70,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
85,
86
],
[
85,
87
],
[
79,
88
],
[
88,
89
],
[
88,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
6,
97
],
[
97,
98
],
[
0,
99
],
[
99,
100
],
[
99,
101
]
]
| [
"import java.util.*;\n\n\npublic class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 102;\n\t\tint re = 0;\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i =0; i<n; i++) {\n\t\t p.add(sc.nextInt());\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=101;i>=0;i--) {\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}\n\t\tSystem.out.println(re);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 102;\n\t\tint re = 0;\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i =0; i<n; i++) {\n\t\t p.add(sc.nextInt());\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=101;i>=0;i--) {\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}\n\t\tSystem.out.println(re);\n }\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 102;\n\t\tint re = 0;\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i =0; i<n; i++) {\n\t\t p.add(sc.nextInt());\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=101;i>=0;i--) {\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}\n\t\tSystem.out.println(re);\n }",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 102;\n\t\tint re = 0;\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i =0; i<n; i++) {\n\t\t p.add(sc.nextInt());\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=101;i>=0;i--) {\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}\n\t\tSystem.out.println(re);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 102;",
"ans",
"102",
"int re = 0;",
"re",
"0",
"List<Integer> p = new ArrayList<Integer>();",
"p",
"new ArrayList<Integer>()",
"for(int i =0; i<n; i++) {\n\t\t p.add(sc.nextInt());\n\t\t}",
"int i =0;",
"int i =0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t p.add(sc.nextInt());\n\t\t}",
"{\n\t\t p.add(sc.nextInt());\n\t\t}",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=101;i>=0;i--) {\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}",
"int i=101;",
"int i=101;",
"i",
"101",
"i>=0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}",
"{\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}",
"if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }",
"!p.contains(i)",
"p.contains(i)",
"p.contains",
"p",
"i",
"{\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }",
"if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }",
"ans>=Math.abs(x-i)",
"ans",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"{\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }",
"ans=Math.abs(x-i)",
"ans",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"re = i",
"re",
"i",
"System.out.println(re)",
"System.out.println",
"System.out",
"System",
"System.out",
"re",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 102;\n\t\tint re = 0;\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i =0; i<n; i++) {\n\t\t p.add(sc.nextInt());\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=101;i>=0;i--) {\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}\n\t\tSystem.out.println(re);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 102;\n\t\tint re = 0;\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i =0; i<n; i++) {\n\t\t p.add(sc.nextInt());\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=101;i>=0;i--) {\n\t\t if(!p.contains(i)) {\n\t\t if(ans>=Math.abs(x-i)) {\n\t\t ans=Math.abs(x-i);\n\t\t re = i;\n\t\t }\n\t\t }\n\t\t}\n\t\tSystem.out.println(re);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int ans = 102;
int re = 0;
List<Integer> p = new ArrayList<Integer>();
for(int i =0; i<n; i++) {
p.add(sc.nextInt());
}
for(int i=101;i>=0;i--) {
if(!p.contains(i)) {
if(ans>=Math.abs(x-i)) {
ans=Math.abs(x-i);
re = i;
}
}
}
System.out.println(re);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
17,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
13,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
17,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
4,
18,
18,
13,
13,
13,
12,
13,
30,
0,
13,
20,
41,
13,
4,
18,
13,
17,
14,
2,
13,
17,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
4,
13,
41,
13,
17,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
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,
4,
18,
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,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
267,
8
],
[
267,
9
],
[
9,
10
],
[
267,
11
],
[
11,
12
],
[
11,
13
],
[
267,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
16,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
16,
25
],
[
25,
26
],
[
25,
27
],
[
16,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
43,
44
],
[
16,
45
],
[
45,
46
],
[
45,
47
],
[
16,
48
],
[
48,
49
],
[
48,
50
],
[
48,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
52,
56
],
[
16,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
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
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
73,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
73,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
95,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
16,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
267,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
114,
139
],
[
139,
140
],
[
114,
141
],
[
141,
142
],
[
141,
143
],
[
112,
144
],
[
144,
145
],
[
267,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
149,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
159,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
148,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
267,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
180,
181
],
[
267,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
186,
189
],
[
189,
190
],
[
267,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
195,
198
],
[
198,
199
],
[
267,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
202,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
207,
212
],
[
212,
213
],
[
212,
214
],
[
207,
215
],
[
215,
216
],
[
216,
217
],
[
207,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
219,
223
],
[
223,
224
],
[
202,
225
],
[
225,
226
],
[
200,
227
],
[
227,
228
],
[
267,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
267,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
240,
241
],
[
240,
242
],
[
239,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
244,
249
],
[
249,
250
],
[
249,
251
],
[
244,
252
],
[
252,
253
],
[
253,
254
],
[
244,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
257,
259
],
[
256,
260
],
[
260,
261
],
[
239,
262
],
[
262,
263
],
[
237,
264
],
[
264,
265
],
[
0,
266
],
[
266,
267
],
[
266,
268
]
]
| [
"import java.util.*;\nimport java.io.*;\n\npublic class Main {\t\n\n\tprivate static void solve(){\n\t\t//Implement solution here.\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i = 0; i < N; i++)p.add(ni());\n\t\tMap<Integer,Boolean> map = new HashMap<>();\n\t\tfor(int i:p)map.put(i,true);\n\t\tint result = -1;\n\t\tfor(int dist = 0; dist <= 100; dist++) {\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n//\t\tfor(int i = 1 ; i < 101; i++) {\n//\t\t\tSystem.out.print(i + \" \");\n//\t\t}\n\t}\n\n\t//Switch input source (stdin/file)\n\tprivate static BufferedReader br;\n\tpublic static void main(String[] args){\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tString debugDataPath = System.getenv(\"DD_PATH\"); \n\t\tif(debugDataPath != null){\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\tsolve();\n\t\tboolean hasNext = true;\n//\t\twhile(hasNext){\n//\t\t\tsolve();\t\n//\t\t\ttry{\n//\t\t\t\tbr.mark(1);\n//\t\t\t\tif(br.read() > 0){\n//\t\t\t\t\tbr.reset();\t\t\t\n//\t\t\t\t\tSystem.out.println(\"---\");\n//\t\t\t\t} else {\n//\t\t\t\t\thasNext = false;\n//\t\t\t\t}\n//\t\t\t}catch(Exception e){\n//\t\t\t\tthrow new RuntimeException(e);\n//\t\t\t} \n//\t\t}\n\t}\n\n\t//Input read utility\n\tprivate static StringTokenizer tokenizer = null;\n\tpublic static String next() {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\t//Get next single int\n\tprivate static int ni() {\n\t\treturn Integer.parseInt(next());\n\t}\n\t//Get next single long\n\tprivate static long nl() {\n\t\treturn Long.parseLong(next());\n\t}\n\t//Get next single double\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(next());\n\t}\n\t//Get next int array from one line\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\t//Get next char array from one line\n\tprivate static char[] ns() {\n\t\treturn next().toCharArray();\n\t}\n\t//Get next long array from one line\n\tprivate static long[] nal(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\t\n\n\tprivate static void solve(){\n\t\t//Implement solution here.\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i = 0; i < N; i++)p.add(ni());\n\t\tMap<Integer,Boolean> map = new HashMap<>();\n\t\tfor(int i:p)map.put(i,true);\n\t\tint result = -1;\n\t\tfor(int dist = 0; dist <= 100; dist++) {\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n//\t\tfor(int i = 1 ; i < 101; i++) {\n//\t\t\tSystem.out.print(i + \" \");\n//\t\t}\n\t}\n\n\t//Switch input source (stdin/file)\n\tprivate static BufferedReader br;\n\tpublic static void main(String[] args){\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tString debugDataPath = System.getenv(\"DD_PATH\"); \n\t\tif(debugDataPath != null){\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\tsolve();\n\t\tboolean hasNext = true;\n//\t\twhile(hasNext){\n//\t\t\tsolve();\t\n//\t\t\ttry{\n//\t\t\t\tbr.mark(1);\n//\t\t\t\tif(br.read() > 0){\n//\t\t\t\t\tbr.reset();\t\t\t\n//\t\t\t\t\tSystem.out.println(\"---\");\n//\t\t\t\t} else {\n//\t\t\t\t\thasNext = false;\n//\t\t\t\t}\n//\t\t\t}catch(Exception e){\n//\t\t\t\tthrow new RuntimeException(e);\n//\t\t\t} \n//\t\t}\n\t}\n\n\t//Input read utility\n\tprivate static StringTokenizer tokenizer = null;\n\tpublic static String next() {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\t//Get next single int\n\tprivate static int ni() {\n\t\treturn Integer.parseInt(next());\n\t}\n\t//Get next single long\n\tprivate static long nl() {\n\t\treturn Long.parseLong(next());\n\t}\n\t//Get next single double\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(next());\n\t}\n\t//Get next int array from one line\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\t//Get next char array from one line\n\tprivate static char[] ns() {\n\t\treturn next().toCharArray();\n\t}\n\t//Get next long array from one line\n\tprivate static long[] nal(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n}",
"Main",
"//Switch input source (stdin/file)\n\tprivate static BufferedReader br;",
"br",
"//Input read utility\n\tprivate static StringTokenizer tokenizer = null;",
"tokenizer",
"null",
"private static void solve(){\n\t\t//Implement solution here.\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i = 0; i < N; i++)p.add(ni());\n\t\tMap<Integer,Boolean> map = new HashMap<>();\n\t\tfor(int i:p)map.put(i,true);\n\t\tint result = -1;\n\t\tfor(int dist = 0; dist <= 100; dist++) {\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n//\t\tfor(int i = 1 ; i < 101; i++) {\n//\t\t\tSystem.out.print(i + \" \");\n//\t\t}\n\t}",
"solve",
"{\n\t\t//Implement solution here.\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i = 0; i < N; i++)p.add(ni());\n\t\tMap<Integer,Boolean> map = new HashMap<>();\n\t\tfor(int i:p)map.put(i,true);\n\t\tint result = -1;\n\t\tfor(int dist = 0; dist <= 100; dist++) {\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n//\t\tfor(int i = 1 ; i < 101; i++) {\n//\t\t\tSystem.out.print(i + \" \");\n//\t\t}\n\t}",
"int X = ni();",
"X",
"ni()",
"ni",
"int N = ni();",
"N",
"ni()",
"ni",
"List<Integer> p = new ArrayList<Integer>();",
"p",
"new ArrayList<Integer>()",
"for(int i = 0; i < N; i++)p.add(ni());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"p.add(ni());",
"p.add(ni())",
"p.add",
"p",
"ni()",
"ni",
"Map<Integer,Boolean> map = new HashMap<>();",
"map",
"new HashMap<>()",
"for(int i:p)map.put(i,true);",
"int i",
"p",
"map.put(i,true);",
"map.put(i,true)",
"map.put",
"map",
"i",
"true",
"int result = -1;",
"result",
"-1",
"1",
"for(int dist = 0; dist <= 100; dist++) {\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int dist = 0;",
"int dist = 0;",
"dist",
"0",
"dist <= 100",
"dist",
"100",
"dist++",
"dist++",
"dist",
"{\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int bpos = X - dist;",
"bpos",
"X - dist",
"X",
"dist",
"int fpos = X + dist;",
"fpos",
"X + dist",
"X",
"dist",
"if(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}",
"!map.containsKey(bpos)",
"map.containsKey(bpos)",
"map.containsKey",
"map",
"bpos",
"{\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}",
"result = bpos",
"result",
"bpos",
"break;",
"if(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}",
"!map.containsKey(fpos)",
"map.containsKey(fpos)",
"map.containsKey",
"map",
"fpos",
"{\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}",
"result = fpos",
"result",
"fpos",
"break;",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"public static void main(String[] args){\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tString debugDataPath = System.getenv(\"DD_PATH\"); \n\t\tif(debugDataPath != null){\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\tsolve();\n\t\tboolean hasNext = true;\n//\t\twhile(hasNext){\n//\t\t\tsolve();\t\n//\t\t\ttry{\n//\t\t\t\tbr.mark(1);\n//\t\t\t\tif(br.read() > 0){\n//\t\t\t\t\tbr.reset();\t\t\t\n//\t\t\t\t\tSystem.out.println(\"---\");\n//\t\t\t\t} else {\n//\t\t\t\t\thasNext = false;\n//\t\t\t\t}\n//\t\t\t}catch(Exception e){\n//\t\t\t\tthrow new RuntimeException(e);\n//\t\t\t} \n//\t\t}\n\t}",
"main",
"{\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tString debugDataPath = System.getenv(\"DD_PATH\"); \n\t\tif(debugDataPath != null){\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\tsolve();\n\t\tboolean hasNext = true;\n//\t\twhile(hasNext){\n//\t\t\tsolve();\t\n//\t\t\ttry{\n//\t\t\t\tbr.mark(1);\n//\t\t\t\tif(br.read() > 0){\n//\t\t\t\t\tbr.reset();\t\t\t\n//\t\t\t\t\tSystem.out.println(\"---\");\n//\t\t\t\t} else {\n//\t\t\t\t\thasNext = false;\n//\t\t\t\t}\n//\t\t\t}catch(Exception e){\n//\t\t\t\tthrow new RuntimeException(e);\n//\t\t\t} \n//\t\t}\n\t}",
"br = new BufferedReader(new InputStreamReader(System.in))",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String debugDataPath = System.getenv(\"DD_PATH\");",
"debugDataPath",
"System.getenv(\"DD_PATH\")",
"System.getenv",
"System",
"\"DD_PATH\"",
"if(debugDataPath != null){\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}",
"debugDataPath != null",
"debugDataPath",
"null",
"{\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}",
"try{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"Exception e",
"{\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}",
"br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))))",
"br",
"new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))))",
"solve()",
"solve",
"boolean hasNext = true;",
"hasNext",
"true",
"String[] args",
"args",
"public static String next() {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}",
"next",
"{\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}",
"try {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"Exception e",
"{\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t}",
"tokenizer = new StringTokenizer(br.readLine())",
"tokenizer",
"new StringTokenizer(br.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"//Get next single int\n\tprivate static int ni() {\n\t\treturn Integer.parseInt(next());\n\t}",
"ni",
"{\n\t\treturn Integer.parseInt(next());\n\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"//Get next single long\n\tprivate static long nl() {\n\t\treturn Long.parseLong(next());\n\t}",
"nl",
"{\n\t\treturn Long.parseLong(next());\n\t}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"//Get next single double\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(next());\n\t}",
"nd",
"{\n\t\treturn Double.parseDouble(next());\n\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"//Get next int array from one line\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}",
"na",
"{\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = ni();",
"a[i] = ni()",
"a[i]",
"a",
"i",
"ni()",
"ni",
"return a;",
"a",
"int n",
"n",
"//Get next char array from one line\n\tprivate static char[] ns() {\n\t\treturn next().toCharArray();\n\t}",
"ns",
"{\n\t\treturn next().toCharArray();\n\t}",
"return next().toCharArray();",
"next().toCharArray()",
"next().toCharArray",
"next()",
"next",
"//Get next long array from one line\n\tprivate static long[] nal(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}",
"nal",
"{\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nl();",
"a[i] = nl()",
"a[i]",
"a",
"i",
"nl()",
"nl",
"return a;",
"a",
"int n",
"n",
"public class Main {\t\n\n\tprivate static void solve(){\n\t\t//Implement solution here.\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i = 0; i < N; i++)p.add(ni());\n\t\tMap<Integer,Boolean> map = new HashMap<>();\n\t\tfor(int i:p)map.put(i,true);\n\t\tint result = -1;\n\t\tfor(int dist = 0; dist <= 100; dist++) {\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n//\t\tfor(int i = 1 ; i < 101; i++) {\n//\t\t\tSystem.out.print(i + \" \");\n//\t\t}\n\t}\n\n\t//Switch input source (stdin/file)\n\tprivate static BufferedReader br;\n\tpublic static void main(String[] args){\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tString debugDataPath = System.getenv(\"DD_PATH\"); \n\t\tif(debugDataPath != null){\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\tsolve();\n\t\tboolean hasNext = true;\n//\t\twhile(hasNext){\n//\t\t\tsolve();\t\n//\t\t\ttry{\n//\t\t\t\tbr.mark(1);\n//\t\t\t\tif(br.read() > 0){\n//\t\t\t\t\tbr.reset();\t\t\t\n//\t\t\t\t\tSystem.out.println(\"---\");\n//\t\t\t\t} else {\n//\t\t\t\t\thasNext = false;\n//\t\t\t\t}\n//\t\t\t}catch(Exception e){\n//\t\t\t\tthrow new RuntimeException(e);\n//\t\t\t} \n//\t\t}\n\t}\n\n\t//Input read utility\n\tprivate static StringTokenizer tokenizer = null;\n\tpublic static String next() {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\t//Get next single int\n\tprivate static int ni() {\n\t\treturn Integer.parseInt(next());\n\t}\n\t//Get next single long\n\tprivate static long nl() {\n\t\treturn Long.parseLong(next());\n\t}\n\t//Get next single double\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(next());\n\t}\n\t//Get next int array from one line\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\t//Get next char array from one line\n\tprivate static char[] ns() {\n\t\treturn next().toCharArray();\n\t}\n\t//Get next long array from one line\n\tprivate static long[] nal(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n}",
"public class Main {\t\n\n\tprivate static void solve(){\n\t\t//Implement solution here.\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i = 0; i < N; i++)p.add(ni());\n\t\tMap<Integer,Boolean> map = new HashMap<>();\n\t\tfor(int i:p)map.put(i,true);\n\t\tint result = -1;\n\t\tfor(int dist = 0; dist <= 100; dist++) {\n\t\t\tint bpos = X - dist;\n\t\t\tint fpos = X + dist;\n\n\t\t\tif(!map.containsKey(bpos)) {\n\t\t\t\tresult = bpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!map.containsKey(fpos)) {\n\t\t\t\tresult = fpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n//\t\tfor(int i = 1 ; i < 101; i++) {\n//\t\t\tSystem.out.print(i + \" \");\n//\t\t}\n\t}\n\n\t//Switch input source (stdin/file)\n\tprivate static BufferedReader br;\n\tpublic static void main(String[] args){\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tString debugDataPath = System.getenv(\"DD_PATH\"); \n\t\tif(debugDataPath != null){\n\t\t\ttry{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));\n\t\t\t}catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\tsolve();\n\t\tboolean hasNext = true;\n//\t\twhile(hasNext){\n//\t\t\tsolve();\t\n//\t\t\ttry{\n//\t\t\t\tbr.mark(1);\n//\t\t\t\tif(br.read() > 0){\n//\t\t\t\t\tbr.reset();\t\t\t\n//\t\t\t\t\tSystem.out.println(\"---\");\n//\t\t\t\t} else {\n//\t\t\t\t\thasNext = false;\n//\t\t\t\t}\n//\t\t\t}catch(Exception e){\n//\t\t\t\tthrow new RuntimeException(e);\n//\t\t\t} \n//\t\t}\n\t}\n\n\t//Input read utility\n\tprivate static StringTokenizer tokenizer = null;\n\tpublic static String next() {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\t//Get next single int\n\tprivate static int ni() {\n\t\treturn Integer.parseInt(next());\n\t}\n\t//Get next single long\n\tprivate static long nl() {\n\t\treturn Long.parseLong(next());\n\t}\n\t//Get next single double\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(next());\n\t}\n\t//Get next int array from one line\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\t//Get next char array from one line\n\tprivate static char[] ns() {\n\t\treturn next().toCharArray();\n\t}\n\t//Get next long array from one line\n\tprivate static long[] nal(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main {
private static void solve(){
//Implement solution here.
int X = ni();
int N = ni();
List<Integer> p = new ArrayList<Integer>();
for(int i = 0; i < N; i++)p.add(ni());
Map<Integer,Boolean> map = new HashMap<>();
for(int i:p)map.put(i,true);
int result = -1;
for(int dist = 0; dist <= 100; dist++) {
int bpos = X - dist;
int fpos = X + dist;
if(!map.containsKey(bpos)) {
result = bpos;
break;
}
if(!map.containsKey(fpos)) {
result = fpos;
break;
}
}
System.out.println(result);
// for(int i = 1 ; i < 101; i++) {
// System.out.print(i + " ");
// }
}
//Switch input source (stdin/file)
private static BufferedReader br;
public static void main(String[] args){
br = new BufferedReader(new InputStreamReader(System.in));
String debugDataPath = System.getenv("DD_PATH");
if(debugDataPath != null){
try{
br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
}catch(Exception e){
throw new RuntimeException(e);
}
}
solve();
boolean hasNext = true;
// while(hasNext){
// solve();
// try{
// br.mark(1);
// if(br.read() > 0){
// br.reset();
// System.out.println("---");
// } else {
// hasNext = false;
// }
// }catch(Exception e){
// throw new RuntimeException(e);
// }
// }
}
//Input read utility
private static StringTokenizer tokenizer = null;
public static String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(br.readLine());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
//Get next single int
private static int ni() {
return Integer.parseInt(next());
}
//Get next single long
private static long nl() {
return Long.parseLong(next());
}
//Get next single double
private static double nd() {
return Double.parseDouble(next());
}
//Get next int array from one line
private static int[] na(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
//Get next char array from one line
private static char[] ns() {
return next().toCharArray();
}
//Get next long array from one line
private static long[] nal(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nl();
return a;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
116,
8
],
[
116,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
40,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
40,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
11,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
50,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
85,
94
],
[
77,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
103,
112
],
[
9,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
]
| [
"import java.util.*;\nimport java.math.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tList<Integer> arr = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }\n\t\t\t\n\t\t\tif(!arr.contains(X))\n\t\t\t{System.out.println(X);}\n\t\telse{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}\n}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tList<Integer> arr = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }\n\t\t\t\n\t\t\tif(!arr.contains(X))\n\t\t\t{System.out.println(X);}\n\t\telse{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}\n}\n}",
"Main",
"public static void main(String[] args){\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tList<Integer> arr = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }\n\t\t\t\n\t\t\tif(!arr.contains(X))\n\t\t\t{System.out.println(X);}\n\t\telse{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}\n}",
"main",
"{\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tList<Integer> arr = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }\n\t\t\t\n\t\t\tif(!arr.contains(X))\n\t\t\t{System.out.println(X);}\n\t\telse{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}\n}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer> arr = new ArrayList<>();",
"arr",
"new ArrayList<>()",
"for (int i = 0; i < N; i++) {\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }",
"{\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }",
"int d = sc.nextInt();",
"d",
"sc.nextInt()",
"sc.nextInt",
"sc",
"arr.add(d)",
"arr.add",
"arr",
"d",
"if(!arr.contains(X))\n\t\t\t{System.out.println(X);}\n\t\telse{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}",
"!arr.contains(X)",
"arr.contains(X)",
"arr.contains",
"arr",
"X",
"{System.out.println(X);}",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}",
"for(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}",
"{\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}",
"if(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}",
"!arr.contains(X-i)",
"arr.contains(X-i)",
"arr.contains",
"arr",
"X-i",
"X",
"i",
"{System.out.println(X-i);break;}",
"System.out.println(X-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X-i",
"X",
"i",
"break;",
"if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}",
"!arr.contains(X+i)",
"arr.contains(X+i)",
"arr.contains",
"arr",
"X+i",
"X",
"i",
"{System.out.println(X+i);break;}",
"System.out.println(X+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X+i",
"X",
"i",
"break;",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tList<Integer> arr = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }\n\t\t\t\n\t\t\tif(!arr.contains(X))\n\t\t\t{System.out.println(X);}\n\t\telse{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}\n}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tList<Integer> arr = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n int d = sc.nextInt();\n\t\t\tarr.add(d);\n }\n\t\t\t\n\t\t\tif(!arr.contains(X))\n\t\t\t{System.out.println(X);}\n\t\telse{\n\t\tfor(int i = 0; i < 101; i++){\n\t\t\tif(!arr.contains(X-i))\n\t\t\t{System.out.println(X-i);break;}\n\t\telse if(!arr.contains(X+i))\n\t\t\t{System.out.println(X+i);break;}\n\t\t}\n\t\t\n\t\n\t}\n}\n}",
"Main"
]
| import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
List<Integer> arr = new ArrayList<>();
for (int i = 0; i < N; i++) {
int d = sc.nextInt();
arr.add(d);
}
if(!arr.contains(X))
{System.out.println(X);}
else{
for(int i = 0; i < 101; i++){
if(!arr.contains(X-i))
{System.out.println(X-i);break;}
else if(!arr.contains(X+i))
{System.out.println(X+i);break;}
}
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
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,
42,
17,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
40,
13,
40,
13,
14,
2,
13,
13,
30,
3,
42,
17,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
40,
13,
40,
13,
14,
2,
13,
13,
30,
3,
0,
13,
2,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
186,
8
],
[
186,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
34
],
[
34,
35
],
[
34,
36
],
[
11,
37
],
[
37,
38
],
[
37,
39
],
[
11,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
40,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
56,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
51,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
81,
91
],
[
91,
92
],
[
92,
93
],
[
81,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
80,
107
],
[
107,
108
],
[
80,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
51,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
118,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
117,
144
],
[
144,
145
],
[
117,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
51,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
51,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
167,
168
],
[
167,
169
],
[
157,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
180,
181
],
[
180,
182
],
[
9,
183
],
[
183,
184
],
[
0,
185
],
[
185,
186
],
[
185,
187
]
]
| [
"import java.util.Scanner;\nimport java.math.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n int count1=0;\n int count2=0;\n int plus=0;\n int minus=0;\n int flg=0;\n if(n==0){\n System.out.println(x);\n }else{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }\n}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.math.*;",
"math.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n int count1=0;\n int count2=0;\n int plus=0;\n int minus=0;\n int flg=0;\n if(n==0){\n System.out.println(x);\n }else{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }\n}\n}",
"Main",
"public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n int count1=0;\n int count2=0;\n int plus=0;\n int minus=0;\n int flg=0;\n if(n==0){\n System.out.println(x);\n }else{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }\n}",
"main",
"{\n Scanner sc =new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n int count1=0;\n int count2=0;\n int plus=0;\n int minus=0;\n int flg=0;\n if(n==0){\n System.out.println(x);\n }else{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }\n}",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count1=0;",
"count1",
"0",
"int count2=0;",
"count2",
"0",
"int plus=0;",
"plus",
"0",
"int minus=0;",
"minus",
"0",
"int flg=0;",
"flg",
"0",
"if(n==0){\n System.out.println(x);\n }else{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }",
"n==0",
"n",
"0",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }",
"int[] list = new int[n];",
"list",
"new int[n]",
"n",
"for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<list.length",
"i",
"list.length",
"list",
"list.length",
"i++",
"i++",
"i",
"{\n list[i]=sc.nextInt();\n }",
"{\n list[i]=sc.nextInt();\n }",
"list[i]=sc.nextInt()",
"list[i]",
"list",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }",
"true",
"{\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }",
"for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<list.length",
"i",
"list.length",
"list",
"list.length",
"i++",
"i++",
"i",
"{\n if(list[i]==x+plus){\n plus++;\n }\n }",
"{\n if(list[i]==x+plus){\n plus++;\n }\n }",
"if(list[i]==x+plus){\n plus++;\n }",
"list[i]==x+plus",
"list[i]",
"list",
"i",
"x+plus",
"x",
"plus",
"{\n plus++;\n }",
"plus++",
"plus",
"count1++",
"count1",
"if(count1>plus){\n break;\n }",
"count1>plus",
"count1",
"plus",
"{\n break;\n }",
"break;",
"while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }",
"true",
"{\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }",
"for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<list.length",
"i",
"list.length",
"list",
"list.length",
"i++",
"i++",
"i",
"{\n if(list[i]==x+minus){\n minus--;\n }\n }",
"{\n if(list[i]==x+minus){\n minus--;\n }\n }",
"if(list[i]==x+minus){\n minus--;\n }",
"list[i]==x+minus",
"list[i]",
"list",
"i",
"x+minus",
"x",
"minus",
"{\n minus--;\n }",
"minus--",
"minus",
"count2--",
"count2",
"if(count2<minus){\n break;\n }",
"count2<minus",
"count2",
"minus",
"{\n break;\n }",
"break;",
"flg=plus+minus",
"flg",
"plus+minus",
"plus",
"minus",
"if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }",
"flg>=0",
"flg",
"0",
"{\n System.out.println(x+minus);\n }",
"System.out.println(x+minus)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+minus",
"x",
"minus",
"if(flg<0){\n System.out.println(x+plus);\n }",
"flg<0",
"flg",
"0",
"{\n System.out.println(x+plus);\n }",
"System.out.println(x+plus)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+plus",
"x",
"plus",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n int count1=0;\n int count2=0;\n int plus=0;\n int minus=0;\n int flg=0;\n if(n==0){\n System.out.println(x);\n }else{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }\n}\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int x=sc.nextInt();\n int n=sc.nextInt();\n int count1=0;\n int count2=0;\n int plus=0;\n int minus=0;\n int flg=0;\n if(n==0){\n System.out.println(x);\n }else{\n int[] list = new int[n];\n for(int i=0; i<list.length; i++){\n list[i]=sc.nextInt();\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+plus){\n plus++;\n }\n }\n count1++;\n if(count1>plus){\n break;\n }\n }\n while(true){\n for(int i=0; i<list.length; i++){\n if(list[i]==x+minus){\n minus--;\n }\n }\n count2--;\n if(count2<minus){\n break;\n }\n }\n flg=plus+minus;\n if(flg>=0){\n System.out.println(x+minus);\n }else if(flg<0){\n System.out.println(x+plus);\n }\n }\n}\n}",
"Main"
]
| import java.util.Scanner;
import java.math.*;
public class Main{
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int x=sc.nextInt();
int n=sc.nextInt();
int count1=0;
int count2=0;
int plus=0;
int minus=0;
int flg=0;
if(n==0){
System.out.println(x);
}else{
int[] list = new int[n];
for(int i=0; i<list.length; i++){
list[i]=sc.nextInt();
}
while(true){
for(int i=0; i<list.length; i++){
if(list[i]==x+plus){
plus++;
}
}
count1++;
if(count1>plus){
break;
}
}
while(true){
for(int i=0; i<list.length; i++){
if(list[i]==x+minus){
minus--;
}
}
count2--;
if(count2<minus){
break;
}
}
flg=plus+minus;
if(flg>=0){
System.out.println(x+minus);
}else if(flg<0){
System.out.println(x+plus);
}
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
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,
14,
2,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
4,
18,
13,
13,
13,
30,
0,
13,
8,
2,
2,
13,
13,
2,
13,
13,
13,
13,
0,
13,
8,
2,
2,
13,
13,
2,
13,
13,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
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
],
[
145,
8
],
[
145,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
11,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
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
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
75,
81
],
[
73,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
85,
94
],
[
82,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
97,
105
],
[
97,
106
],
[
59,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
112,
113
],
[
112,
114
],
[
108,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
118,
119
],
[
118,
120
],
[
107,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
107,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
55,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
9,
142
],
[
142,
143
],
[
0,
144
],
[
144,
145
],
[
144,
146
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 101;\n\t\tInteger[] p = new Integer[N];\n\t\tfor(int i=0; i<N ;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\tif(N != 0) {\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}else {\n\t\tSystem.out.println(X);\n\t}\n\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\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 101;\n\t\tInteger[] p = new Integer[N];\n\t\tfor(int i=0; i<N ;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\tif(N != 0) {\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}else {\n\t\tSystem.out.println(X);\n\t}\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 101;\n\t\tInteger[] p = new Integer[N];\n\t\tfor(int i=0; i<N ;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\tif(N != 0) {\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}else {\n\t\tSystem.out.println(X);\n\t}\n\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 101;\n\t\tInteger[] p = new Integer[N];\n\t\tfor(int i=0; i<N ;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\tif(N != 0) {\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}else {\n\t\tSystem.out.println(X);\n\t}\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int min = 0;",
"min",
"0",
"int max = 101;",
"max",
"101",
"Integer[] p = new Integer[N];",
"p",
"new Integer[N]",
"N",
"for(int i=0; i<N ;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tp[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tp[i] = sc.nextInt();\n\t\t}",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(N != 0) {\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}else {\n\t\tSystem.out.println(X);\n\t}",
"N != 0",
"N",
"0",
"{\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}",
"for(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}",
"{\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}",
"if(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}",
"!Arrays.asList(p).contains(i)",
"Arrays.asList(p).contains(i)",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"i",
"{\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}",
"min = min<=i && i<=X? i:min",
"min",
"min<=i && i<=X? i:min",
"min<=i && i<=X",
"min<=i",
"min",
"i",
"i<=X",
"i",
"X",
"i",
"min",
"max = i<=max && i>=X? i:max",
"max",
"i<=max && i>=X? i:max",
"i<=max && i>=X",
"i<=max",
"i",
"max",
"i>=X",
"i",
"X",
"i",
"max",
"if(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}",
"Math.abs(min-X) <= Math.abs(max-X)",
"Math.abs(min-X)",
"Math.abs",
"Math",
"min-X",
"min",
"X",
"Math.abs(max-X)",
"Math.abs",
"Math",
"max-X",
"max",
"X",
"{\n\t\t\tSystem.out.println(min);\n\t\t}",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"{\n\t\t\tSystem.out.println(max);\n\t\t}",
"System.out.println(max)",
"System.out.println",
"System.out",
"System",
"System.out",
"max",
"{\n\t\tSystem.out.println(X);\n\t}",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 101;\n\t\tInteger[] p = new Integer[N];\n\t\tfor(int i=0; i<N ;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\tif(N != 0) {\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}else {\n\t\tSystem.out.println(X);\n\t}\n\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 101;\n\t\tInteger[] p = new Integer[N];\n\t\tfor(int i=0; i<N ;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\tif(N != 0) {\n\t\tfor(int i = 1; i <=101; i++) {\n\t\t\t//配列内に要素が存在していなければ入る\n\t\t\tif(!Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = min<=i && i<=X? i:min;\n\t\t\t\tmax = i<=max && i>=X? i:max;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(min-X) <= Math.abs(max-X)){\n\t\t\tSystem.out.println(min);\n\t\t}else {\n\t\t\tSystem.out.println(max);\n\t\t}\n\n\t}else {\n\t\tSystem.out.println(X);\n\t}\n\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 X = sc.nextInt();
int N = sc.nextInt();
int min = 0;
int max = 101;
Integer[] p = new Integer[N];
for(int i=0; i<N ;i++) {
p[i] = sc.nextInt();
}
if(N != 0) {
for(int i = 1; i <=101; i++) {
//配列内に要素が存在していなければ入る
if(!Arrays.asList(p).contains(i)) {
min = min<=i && i<=X? i:min;
max = i<=max && i>=X? i:max;
}
}
if(Math.abs(min-X) <= Math.abs(max-X)){
System.out.println(min);
}else {
System.out.println(max);
}
}else {
System.out.println(X);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
17,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
42,
17,
30,
14,
4,
18,
13,
2,
13,
13,
30,
14,
2,
13,
17,
30,
0,
13,
40,
13,
30,
0,
13,
2,
2,
13,
17,
40,
17,
30,
0,
13,
2,
13,
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
],
[
113,
11
],
[
113,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
32,
39
],
[
14,
40
],
[
40,
41
],
[
40,
42
],
[
14,
43
],
[
43,
44
],
[
43,
45
],
[
14,
46
],
[
46,
47
],
[
46,
48
],
[
14,
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
],
[
62,
65
],
[
65,
66
],
[
66,
67
],
[
14,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
75,
76
],
[
75,
77
],
[
71,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
79,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
71,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
14,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
12,
110
],
[
110,
111
],
[
0,
112
],
[
112,
113
],
[
112,
114
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n == 0){\n System.out.println(x);\n return;\n }\n int distance = 0;\n int answer = 0;\n List<Integer> list = new ArrayList();\n for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }\n while(true){\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }\n System.out.println(answer);\n }\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n == 0){\n System.out.println(x);\n return;\n }\n int distance = 0;\n int answer = 0;\n List<Integer> list = new ArrayList();\n for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }\n while(true){\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }\n System.out.println(answer);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n == 0){\n System.out.println(x);\n return;\n }\n int distance = 0;\n int answer = 0;\n List<Integer> list = new ArrayList();\n for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }\n while(true){\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }\n System.out.println(answer);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n == 0){\n System.out.println(x);\n return;\n }\n int distance = 0;\n int answer = 0;\n List<Integer> list = new ArrayList();\n for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }\n while(true){\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }\n System.out.println(answer);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n == 0){\n System.out.println(x);\n return;\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int distance = 0;",
"distance",
"0",
"int answer = 0;",
"answer",
"0",
"List<Integer> list = new ArrayList();",
"list",
"new ArrayList()",
"for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n list.add(sc.nextInt());\n }",
"{\n list.add(sc.nextInt());\n }",
"list.add(sc.nextInt())",
"list.add",
"list",
"sc.nextInt()",
"sc.nextInt",
"sc",
"while(true){\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }",
"true",
"{\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }",
"if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }",
"list.contains(x + distance)",
"list.contains",
"list",
"x + distance",
"x",
"distance",
"{\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n }",
"if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }",
"distance < 0",
"distance",
"0",
"{\n distance = - distance;\n }",
"distance = - distance",
"distance",
"- distance",
"distance",
"{\n distance = (distance + 1) * -1;\n }",
"distance = (distance + 1) * -1",
"distance",
"(distance + 1) * -1",
"(distance + 1)",
"distance",
"1",
"-1",
"1",
"{\n answer = x + distance;\n break;\n }",
"answer = x + distance",
"answer",
"x + distance",
"x",
"distance",
"break;",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n == 0){\n System.out.println(x);\n return;\n }\n int distance = 0;\n int answer = 0;\n List<Integer> list = new ArrayList();\n for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }\n while(true){\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }\n System.out.println(answer);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n == 0){\n System.out.println(x);\n return;\n }\n int distance = 0;\n int answer = 0;\n List<Integer> list = new ArrayList();\n for(int i = 0; i < n; i++){\n list.add(sc.nextInt());\n }\n while(true){\n if(list.contains(x + distance)){\n if(distance < 0){\n distance = - distance;\n } else {\n distance = (distance + 1) * -1;\n }\n } else {\n answer = x + distance;\n break;\n }\n }\n System.out.println(answer);\n }\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if(n == 0){
System.out.println(x);
return;
}
int distance = 0;
int answer = 0;
List<Integer> list = new ArrayList();
for(int i = 0; i < n; i++){
list.add(sc.nextInt());
}
while(true){
if(list.contains(x + distance)){
if(distance < 0){
distance = - distance;
} else {
distance = (distance + 1) * -1;
}
} else {
answer = x + distance;
break;
}
}
System.out.println(answer);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
18,
13,
13,
30,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
14,
2,
13,
13,
30,
0,
13,
4,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
114,
5
],
[
114,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
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
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
73,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
82,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
100,
104
],
[
8,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
6,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
]
| [
"import java.util.*;\npublic class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n boolean[] ok = new boolean[201];\n for(int i =0;i<n;i++){\n int c = sc.nextInt();\n ok[c] =true;\n }\n int result = 500;\n int diff = 500;\n for(int i =0;i<=200;i++){\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }\n System.out.println(result);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n boolean[] ok = new boolean[201];\n for(int i =0;i<n;i++){\n int c = sc.nextInt();\n ok[c] =true;\n }\n int result = 500;\n int diff = 500;\n for(int i =0;i<=200;i++){\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }\n System.out.println(result);\n }\n}",
"Main",
"public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n boolean[] ok = new boolean[201];\n for(int i =0;i<n;i++){\n int c = sc.nextInt();\n ok[c] =true;\n }\n int result = 500;\n int diff = 500;\n for(int i =0;i<=200;i++){\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }\n System.out.println(result);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n boolean[] ok = new boolean[201];\n for(int i =0;i<n;i++){\n int c = sc.nextInt();\n ok[c] =true;\n }\n int result = 500;\n int diff = 500;\n for(int i =0;i<=200;i++){\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }\n System.out.println(result);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean[] ok = new boolean[201];",
"ok",
"new boolean[201]",
"201",
"for(int i =0;i<n;i++){\n int c = sc.nextInt();\n ok[c] =true;\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int c = sc.nextInt();\n ok[c] =true;\n }",
"{\n int c = sc.nextInt();\n ok[c] =true;\n }",
"int c = sc.nextInt();",
"c",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ok[c] =true",
"ok[c]",
"ok",
"c",
"true",
"int result = 500;",
"result",
"500",
"int diff = 500;",
"diff",
"500",
"for(int i =0;i<=200;i++){\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }",
"{\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }",
"if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }",
"!ok[i]",
"ok[i]",
"ok",
"i",
"{\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }",
"int abs = Math.abs(x-i);",
"abs",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }",
"abs<diff",
"abs",
"diff",
"{\n result =i;\n diff = abs;\n }",
"result =i",
"result",
"i",
"diff = abs",
"diff",
"abs",
"if(abs == diff){\n result = Math.min(result, i);\n }",
"abs == diff",
"abs",
"diff",
"{\n result = Math.min(result, i);\n }",
"result = Math.min(result, i)",
"result",
"Math.min(result, i)",
"Math.min",
"Math",
"result",
"i",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n boolean[] ok = new boolean[201];\n for(int i =0;i<n;i++){\n int c = sc.nextInt();\n ok[c] =true;\n }\n int result = 500;\n int diff = 500;\n for(int i =0;i<=200;i++){\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }\n System.out.println(result);\n }\n}",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n boolean[] ok = new boolean[201];\n for(int i =0;i<n;i++){\n int c = sc.nextInt();\n ok[c] =true;\n }\n int result = 500;\n int diff = 500;\n for(int i =0;i<=200;i++){\n if(!ok[i]){\n int abs = Math.abs(x-i);\n if(abs<diff){\n result =i;\n diff = abs;\n }else if(abs == diff){\n result = Math.min(result, i);\n }\n }\n }\n System.out.println(result);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
boolean[] ok = new boolean[201];
for(int i =0;i<n;i++){
int c = sc.nextInt();
ok[c] =true;
}
int result = 500;
int diff = 500;
for(int i =0;i<=200;i++){
if(!ok[i]){
int abs = Math.abs(x-i);
if(abs<diff){
result =i;
diff = abs;
}else if(abs == diff){
result = Math.min(result, i);
}
}
}
System.out.println(result);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
4,
18,
13,
18,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
41,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
41,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
152,
11
],
[
152,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
20,
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
],
[
39,
41
],
[
14,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
47,
48
],
[
47,
49
],
[
14,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
50,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
82,
83
],
[
61,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
84,
97
],
[
98,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
102,
104
],
[
61,
105
],
[
105,
106
],
[
105,
107
],
[
61,
108
],
[
108,
109
],
[
108,
110
],
[
61,
111
],
[
111,
112
],
[
111,
113
],
[
111,
114
],
[
115,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
115,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
127,
128
],
[
127,
129
],
[
123,
130
],
[
122,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
137,
138
],
[
137,
139
],
[
131,
140
],
[
140,
141
],
[
140,
142
],
[
61,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
12,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String[] str1 = sc.nextLine().split(\" \");\n String[] str2 = sc.nextLine().split(\" \");\n int x = Integer.parseInt(str1[0]);\n int n = Integer.parseInt(str1[1]);\n if(n==0) {\n System.out.println(x);\n }\n else {\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }\n }\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String[] str1 = sc.nextLine().split(\" \");\n String[] str2 = sc.nextLine().split(\" \");\n int x = Integer.parseInt(str1[0]);\n int n = Integer.parseInt(str1[1]);\n if(n==0) {\n System.out.println(x);\n }\n else {\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String[] str1 = sc.nextLine().split(\" \");\n String[] str2 = sc.nextLine().split(\" \");\n int x = Integer.parseInt(str1[0]);\n int n = Integer.parseInt(str1[1]);\n if(n==0) {\n System.out.println(x);\n }\n else {\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n String[] str1 = sc.nextLine().split(\" \");\n String[] str2 = sc.nextLine().split(\" \");\n int x = Integer.parseInt(str1[0]);\n int n = Integer.parseInt(str1[1]);\n if(n==0) {\n System.out.println(x);\n }\n else {\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String[] str1 = sc.nextLine().split(\" \");",
"str1",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"String[] str2 = sc.nextLine().split(\" \");",
"str2",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int x = Integer.parseInt(str1[0]);",
"x",
"Integer.parseInt(str1[0])",
"Integer.parseInt",
"Integer",
"str1[0]",
"str1",
"0",
"int n = Integer.parseInt(str1[1]);",
"n",
"Integer.parseInt(str1[1])",
"Integer.parseInt",
"Integer",
"str1[1]",
"str1",
"1",
"if(n==0) {\n System.out.println(x);\n }\n else {\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }",
"n==0",
"n",
"0",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }",
"List<String> list = new ArrayList<String>();",
"list",
"new ArrayList<String>()",
"for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < 102",
"i",
"102",
"i++",
"i++",
"i",
"{\n list.add((((Integer)i).toString()));\n }",
"{\n list.add((((Integer)i).toString()));\n }",
"list.add((((Integer)i).toString()))",
"list.add",
"list",
"(((Integer)i).toString())",
"((Integer)i).toString",
"((Integer)i)",
"for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < str2.length",
"i",
"str2.length",
"str2",
"str2.length",
"i++",
"i++",
"i",
"{\n list.remove (str2[i]);\n }",
"{\n list.remove (str2[i]);\n }",
"list.remove (str2[i])",
"list.remove",
"list",
"str2[i]",
"str2",
"i",
"int cnt=9999;",
"cnt",
"9999",
"int ansX=9999;",
"ansX",
"9999",
"for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }",
"String num2",
"list",
"{\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }",
"{\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }",
"int num = Integer.parseInt(num2);",
"num",
"Integer.parseInt(num2)",
"Integer.parseInt",
"Integer",
"num2",
"if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }",
"Math.abs(num-x) <cnt",
"Math.abs(num-x)",
"Math.abs",
"Math",
"num-x",
"num",
"x",
"cnt",
"{\n cnt = Math.abs(num-x);\n ansX = num;\n }",
"cnt = Math.abs(num-x)",
"cnt",
"Math.abs(num-x)",
"Math.abs",
"Math",
"num-x",
"num",
"x",
"ansX = num",
"ansX",
"num",
"System.out.println(ansX)",
"System.out.println",
"System.out",
"System",
"System.out",
"ansX",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String[] str1 = sc.nextLine().split(\" \");\n String[] str2 = sc.nextLine().split(\" \");\n int x = Integer.parseInt(str1[0]);\n int n = Integer.parseInt(str1[1]);\n if(n==0) {\n System.out.println(x);\n }\n else {\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String[] str1 = sc.nextLine().split(\" \");\n String[] str2 = sc.nextLine().split(\" \");\n int x = Integer.parseInt(str1[0]);\n int n = Integer.parseInt(str1[1]);\n if(n==0) {\n System.out.println(x);\n }\n else {\n List<String> list = new ArrayList<String>();\n for(int i = 0 ; i < 102;i++) {\n list.add((((Integer)i).toString()));\n }\n for(int i = 0 ; i < str2.length;i++) {\n list.remove (str2[i]);\n }\n int cnt=9999;\n int ansX=9999;\n for(String num2 : list) {\n int num = Integer.parseInt(num2);\n if(Math.abs(num-x) <cnt) {\n cnt = Math.abs(num-x);\n ansX = num;\n }\n }\n System.out.println(ansX);\n }\n }\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] str1 = sc.nextLine().split(" ");
String[] str2 = sc.nextLine().split(" ");
int x = Integer.parseInt(str1[0]);
int n = Integer.parseInt(str1[1]);
if(n==0) {
System.out.println(x);
}
else {
List<String> list = new ArrayList<String>();
for(int i = 0 ; i < 102;i++) {
list.add((((Integer)i).toString()));
}
for(int i = 0 ; i < str2.length;i++) {
list.remove (str2[i]);
}
int cnt=9999;
int ansX=9999;
for(String num2 : list) {
int num = Integer.parseInt(num2);
if(Math.abs(num-x) <cnt) {
cnt = Math.abs(num-x);
ansX = num;
}
}
System.out.println(ansX);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
99,
5
],
[
99,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
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
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
37,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
68,
77
],
[
60,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
86,
95
],
[
6,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
]
]
| [
"import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<100;i++) {\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\t\n\t\n\t\n\t\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\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<100;i++) {\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\t\n\t\n\t\n\t\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<100;i++) {\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<100;i++) {\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int x = scan.nextInt();",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"List<Integer> p = new ArrayList<Integer>();",
"p",
"new ArrayList<Integer>()",
"for(int i=0;i<n;i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}",
"{\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}",
"int a = scan.nextInt();",
"a",
"scan.nextInt()",
"scan.nextInt",
"scan",
"p.add(a)",
"p.add",
"p",
"a",
"for(int i=0;i<100;i++) {\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<100",
"i",
"100",
"i++",
"i++",
"i",
"{\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}",
"{\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}",
"if(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}",
"!p.contains(x-i)",
"p.contains(x-i)",
"p.contains",
"p",
"x-i",
"x",
"i",
"{\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"break;",
"if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}",
"!p.contains(x+i)",
"p.contains(x+i)",
"p.contains",
"p",
"x+i",
"x",
"i",
"{\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"break;",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<100;i++) {\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\t\n\t\n\t\n\t\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<100;i++) {\n\t\t\tif(!p.contains(x-i)) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tbreak;\n\t\t\t}else if(!p.contains(x+i)){\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\t\n\t\n\t\n\t\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int n = scan.nextInt();
List<Integer> p = new ArrayList<Integer>();
for(int i=0;i<n;i++) {
int a = scan.nextInt();
p.add(a);
}
for(int i=0;i<100;i++) {
if(!p.contains(x-i)) {
System.out.println(x-i);
break;
}else if(!p.contains(x+i)){
System.out.println(x+i);
break;
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
4,
18,
13,
17,
17,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
20,
17,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
40,
18,
13,
4,
18,
13,
2,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
14,
2,
18,
13,
17,
17,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
3,
14,
2,
4,
18,
13,
13,
40,
17,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
30,
14,
2,
13,
4,
18,
13,
13,
4,
18,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
14,
2,
4,
18,
4,
13,
13,
17,
29,
17,
29,
17,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
14,
2,
13,
17,
29,
13,
14,
2,
13,
13,
29,
13,
14,
2,
13,
13,
29,
4,
13,
2,
13,
13,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
2,
4,
18,
13,
17,
17,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
2,
4,
18,
13,
13,
17,
0,
18,
13,
2,
2,
4,
18,
13,
13,
17,
13,
41,
13,
20,
29,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
13,
17,
29,
13,
30,
41,
13,
4,
13,
13,
2,
13,
17,
14,
2,
2,
13,
17,
17,
30,
29,
2,
13,
13,
30,
29,
2,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
13,
17,
29,
2,
13,
13,
30,
41,
13,
2,
4,
13,
13,
2,
13,
17,
13,
0,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
17,
30,
0,
13,
13,
0,
13,
13,
29,
2,
13,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
461,
8
],
[
461,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
12,
15
],
[
12,
16
],
[
11,
17
],
[
461,
18
],
[
18,
19
],
[
18,
20
],
[
461,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
23,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
30,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
35,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
35,
50
],
[
50,
51
],
[
50,
52
],
[
35,
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
],
[
66,
69
],
[
69,
70
],
[
70,
71
],
[
65,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
35,
84
],
[
84,
85
],
[
84,
86
],
[
35,
87
],
[
87,
88
],
[
87,
89
],
[
35,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
90,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
90,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
103,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
124,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
124,
135
],
[
102,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
137,
142
],
[
142,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
136,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
23,
156
],
[
156,
157
],
[
157,
158
],
[
21,
159
],
[
159,
160
],
[
461,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
174,
177
],
[
167,
178
],
[
178,
179
],
[
179,
180
],
[
167,
181
],
[
182,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
184,
188
],
[
183,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
193,
196
],
[
190,
197
],
[
197,
198
],
[
198,
199
],
[
197,
200
],
[
190,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
202,
205
],
[
201,
206
],
[
206,
207
],
[
207,
208
],
[
206,
209
],
[
209,
210
],
[
209,
211
],
[
163,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
163,
216
],
[
216,
217
],
[
161,
218
],
[
218,
219
],
[
461,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
224,
230
],
[
223,
231
],
[
231,
232
],
[
223,
233
],
[
233,
234
],
[
220,
235
],
[
235,
236
],
[
461,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
244,
245
],
[
239,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
246,
250
],
[
250,
251
],
[
239,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
256
],
[
256,
257
],
[
239,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
258,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
265,
267
],
[
263,
268
],
[
239,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
270,
273
],
[
273,
274
],
[
273,
275
],
[
237,
276
],
[
276,
277
],
[
237,
278
],
[
278,
279
],
[
461,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
285,
287
],
[
284,
288
],
[
288,
289
],
[
288,
290
],
[
288,
291
],
[
280,
292
],
[
292,
293
],
[
280,
294
],
[
294,
295
],
[
461,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
299,
300
],
[
299,
301
],
[
301,
302
],
[
302,
303
],
[
298,
304
],
[
304,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
304,
309
],
[
309,
310
],
[
309,
311
],
[
311,
312
],
[
312,
313
],
[
313,
314
],
[
314,
315
],
[
312,
316
],
[
311,
317
],
[
304,
318
],
[
318,
319
],
[
319,
320
],
[
304,
321
],
[
322,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
325,
326
],
[
325,
327
],
[
322,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
328,
332
],
[
332,
333
],
[
332,
334
],
[
335,
335
],
[
335,
336
],
[
336,
337
],
[
337,
338
],
[
335,
339
],
[
335,
340
],
[
322,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
345,
345
],
[
345,
346
],
[
346,
347
],
[
347,
348
],
[
345,
349
],
[
345,
350
],
[
341,
351
],
[
298,
352
],
[
352,
353
],
[
352,
354
],
[
298,
355
],
[
355,
356
],
[
296,
357
],
[
357,
358
],
[
461,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
362,
363
],
[
363,
364
],
[
363,
365
],
[
362,
366
],
[
366,
367
],
[
362,
368
],
[
368,
369
],
[
369,
370
],
[
369,
371
],
[
368,
372
],
[
372,
373
],
[
368,
374
],
[
374,
375
],
[
375,
376
],
[
375,
377
],
[
377,
378
],
[
377,
379
],
[
377,
380
],
[
380,
381
],
[
380,
382
],
[
374,
383
],
[
383,
384
],
[
384,
385
],
[
385,
386
],
[
385,
387
],
[
384,
388
],
[
383,
389
],
[
389,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
383,
394
],
[
394,
395
],
[
395,
396
],
[
397,
397
],
[
397,
398
],
[
397,
399
],
[
397,
400
],
[
359,
401
],
[
401,
402
],
[
359,
403
],
[
403,
404
],
[
461,
405
],
[
405,
406
],
[
405,
407
],
[
407,
408
],
[
408,
409
],
[
409,
410
],
[
409,
411
],
[
408,
412
],
[
412,
413
],
[
408,
414
],
[
414,
415
],
[
415,
416
],
[
415,
417
],
[
414,
418
],
[
418,
419
],
[
419,
420
],
[
419,
421
],
[
414,
422
],
[
422,
423
],
[
423,
424
],
[
423,
425
],
[
425,
426
],
[
426,
427
],
[
426,
428
],
[
426,
429
],
[
429,
430
],
[
429,
431
],
[
425,
432
],
[
422,
433
],
[
433,
434
],
[
433,
435
],
[
422,
436
],
[
436,
437
],
[
436,
438
],
[
422,
439
],
[
439,
440
],
[
440,
441
],
[
441,
442
],
[
441,
443
],
[
440,
444
],
[
439,
445
],
[
445,
446
],
[
446,
447
],
[
446,
448
],
[
445,
449
],
[
449,
450
],
[
449,
451
],
[
422,
452
],
[
452,
453
],
[
453,
454
],
[
453,
455
],
[
405,
456
],
[
456,
457
],
[
405,
458
],
[
458,
459
],
[
0,
460
],
[
460,
461
],
[
460,
462
]
]
| [
"import java.util.*;\nimport java.io.* ;\n/*\nNOTES:\n-more than 10 digits (10^10), use long\n-prefix sum of 1's and -1's to control flow of highlighting a region\n-log(a)/log(b) = log base b of a\n-create a position array if trying to see if elements show up next to each other sequentially\n i.e. elements 1,2,3 are within 3 spots of each other in an array\n arr[scannedInt - 1] = i; (position of i at p[i] in original)\n- use a freq array when counting instances of an element occurring\n- increment the counter first before simulating anything turn-based (two player game)\n\n */\n\npublic class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0) {\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }\n scan.close();\n\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.* ;",
"io.*",
"java",
"public class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0) {\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }\n scan.close();\n\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"Main",
"static long mod = (long)(Math.pow(10, 9) + 7);",
"mod",
"(long)(Math.pow(10, 9) + 7)",
"Math.pow(10, 9)",
"Math.pow",
"Math",
"10",
"9",
"7",
"public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";",
"alpha",
"\"zabcdefghijklmnopqrstuvwxy\"",
"public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0) {\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }\n scan.close();\n\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0) {\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }\n scan.close();\n\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"long t = 1;",
"t",
"1",
"while (t-- > 0) {\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }",
"t-- > 0",
"t--",
"t",
"0",
"{\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }",
"int[] diff = new int[1000];",
"diff",
"new int[1000]",
"1000",
"int x= scan.nextInt();",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"ArrayList<Integer> arr = new ArrayList<>();",
"arr",
"new ArrayList<>()",
"for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }",
"{\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }",
"arr.add(scan.nextInt())",
"arr.add",
"arr",
"scan.nextInt()",
"scan.nextInt",
"scan",
"diff[Math.abs(x-arr.get(i))]++",
"diff[Math.abs(x-arr.get(i))]",
"diff",
"Math.abs(x-arr.get(i))",
"Math.abs",
"Math",
"x-arr.get(i)",
"x",
"arr.get(i)",
"arr.get",
"arr",
"i",
"int small = 0",
"small",
"0",
"big = 0;",
"big",
"0",
"if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }",
"diff[0] != 1",
"diff[0]",
"diff",
"0",
"1",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }",
"for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i<diff.length",
"i",
"diff.length",
"diff",
"diff.length",
"i++",
"i++",
"i",
"{\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }",
"{\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }",
"if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }",
"diff[i] <2",
"diff[i]",
"diff",
"i",
"2",
"{\n small = x-i;\n big = x+i;\n break;\n }",
"small = x-i",
"small",
"x-i",
"x",
"i",
"big = x+i",
"big",
"x+i",
"x",
"i",
"break;",
"if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);",
"arr.indexOf(small) > -1",
"arr.indexOf(small)",
"arr.indexOf",
"arr",
"small",
"-1",
"1",
"System.out.println(big)",
"System.out.println",
"System.out",
"System",
"System.out",
"big",
"System.out.println(small)",
"System.out.println",
"System.out",
"System",
"System.out",
"small",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }",
"factors",
"{\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }",
"ArrayList<Integer> facts = new ArrayList<>();",
"facts",
"new ArrayList<>()",
"for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i<=(int)Math.sqrt(n)",
"i",
"(int)Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"i++",
"i++",
"i",
"{\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }",
"{\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }",
"if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }",
"n%i == 0",
"n%i",
"n",
"i",
"0",
"{\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }",
"if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }",
"i == Math.sqrt(n)",
"i",
"Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"facts.add(i)",
"facts.add",
"facts",
"i",
"{\n facts.add(i);\n facts.add(n/i);\n }",
"facts.add(i)",
"facts.add",
"facts",
"i",
"facts.add(n/i)",
"facts.add",
"facts",
"n/i",
"n",
"i",
"Collections.sort(facts)",
"Collections.sort",
"Collections",
"facts",
"return facts;",
"facts",
"int n",
"n",
"static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }",
"isPrime",
"{\n if(factors(n).size() ==2) return true;\n else return false;\n }",
"if(factors(n).size() ==2) return true;\n else return false;",
"factors(n).size() ==2",
"factors(n).size()",
"factors(n).size",
"factors(n)",
"factors",
"n",
"2",
"return true;",
"true",
"return false;",
"false",
"int n",
"n",
"static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }",
"GCD",
"{\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }",
"if (a == 0) return b;",
"a == 0",
"a",
"0",
"return b;",
"b",
"if (b == 0) return a;",
"b == 0",
"b",
"0",
"return a;",
"a",
"if (a == b) return a;",
"a == b",
"a",
"b",
"return a;",
"a",
"if (a > b) return GCD(a-b, b);",
"a > b",
"a",
"b",
"return GCD(a-b, b);",
"GCD(a-b, b)",
"GCD",
"a-b",
"a",
"b",
"b",
"return GCD(a, b-a);",
"GCD(a, b-a)",
"GCD",
"a",
"b-a",
"b",
"a",
"long a",
"a",
"long b",
"b",
"static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }",
"LCM",
"{\n return (a*b)/(GCD(a,b));\n }",
"return (a*b)/(GCD(a,b));",
"(a*b)/(GCD(a,b))",
"(a*b)",
"a",
"b",
"(GCD(a,b))",
"GCD",
"a",
"b",
"long a",
"a",
"long b",
"b",
"static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }",
"rev",
"{\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }",
"char[] arr = s.toCharArray();",
"arr",
"s.toCharArray()",
"s.toCharArray",
"s",
"for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<(s.length()+1)/2",
"i",
"(s.length()+1)/2",
"(s.length()+1)",
"s.length()",
"s.length",
"s",
"1",
"2",
"i++",
"i++",
"i",
"{\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }",
"{\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }",
"char temp = arr[i];",
"temp",
"arr[i]",
"arr",
"i",
"arr[i] = arr[s.length()-i-1]",
"arr[i]",
"arr",
"i",
"arr[s.length()-i-1]",
"arr",
"s.length()-i-1",
"s.length()-i-1",
"s.length()",
"s.length",
"s",
"i",
"1",
"arr[s.length()-i-1] = temp",
"arr[s.length()-i-1]",
"arr",
"s.length()-i-1",
"s.length()-i-1",
"s.length()",
"s.length",
"s",
"i",
"1",
"temp",
"String fin = new String(arr);",
"fin",
"new String(arr)",
"return fin;",
"fin",
"String s",
"s",
"static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }",
"pow",
"{\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }",
"if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }",
"N == 0",
"N",
"0",
"return 1;",
"1",
"if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }",
"N == 1",
"N",
"1",
"return a;",
"a",
"{\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }",
"long R = pow(a,N/2);",
"R",
"pow(a,N/2)",
"pow",
"a",
"N/2",
"N",
"2",
"if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }",
"N % 2 == 0",
"N % 2",
"N",
"2",
"0",
"{\n return R*R;\n }",
"return R*R;",
"R*R",
"R",
"R",
"{\n return R*R*a;\n }",
"return R*R*a;",
"R*R*a",
"R*R*a",
"R",
"R",
"a",
"long a",
"a",
"long N",
"N",
"static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }",
"powMod",
"{\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }",
"if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }",
"N == 0",
"N",
"0",
"return 1;",
"1",
"if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }",
"N == 1",
"N",
"1",
"return a % mod;",
"a % mod",
"a",
"mod",
"{\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }",
"long R = powMod(a,N/2) % mod;",
"R",
"powMod(a,N/2) % mod",
"powMod(a,N/2)",
"powMod",
"a",
"N/2",
"N",
"2",
"mod",
"R *= R",
"R",
"R",
"R %= mod",
"R",
"mod",
"if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }",
"N % 2 == 1",
"N % 2",
"N",
"2",
"1",
"{\n R *= a;\n R %= mod;\n }",
"R *= a",
"R",
"a",
"R %= mod",
"R",
"mod",
"return R % mod;",
"R % mod",
"R",
"mod",
"long a",
"a",
"long N",
"N",
"public class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0) {\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }\n scan.close();\n\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"public class Main {\n static long mod = (long)(Math.pow(10, 9) + 7);\n public static String alpha = \"zabcdefghijklmnopqrstuvwxy\";\n public static void main(String[] args) throws IOException{\n Scanner scan = new Scanner(System.in);\n long t = 1;\n while (t-- > 0) {\n int[] diff = new int[1000];\n int x= scan.nextInt();\n int n = scan.nextInt();\n ArrayList<Integer> arr = new ArrayList<>();\n for(int i = 0; i<n; i++){\n arr.add(scan.nextInt());\n diff[Math.abs(x-arr.get(i))]++;\n }\n int small = 0, big = 0;\n if(diff[0] != 1) System.out.println(x);\n else{\n for(int i = 1; i<diff.length; i++){\n if(diff[i] <2){\n small = x-i;\n big = x+i;\n break;\n }\n }\n if(arr.indexOf(small) > -1) System.out.println(big);\n else System.out.println(small);\n }\n //System.out.println(small+\" \"+big);\n\n }\n scan.close();\n\n }\n\n static ArrayList factors(int n ){\n ArrayList<Integer> facts = new ArrayList<>();\n for(int i = 1; i<=(int)Math.sqrt(n); i++){\n if(n%i == 0){\n if( i == Math.sqrt(n)) facts.add(i);\n else{\n facts.add(i);\n facts.add(n/i);\n }\n }\n }\n Collections.sort(facts);\n return facts;\n }\n\n static boolean isPrime (int n){\n if(factors(n).size() ==2) return true;\n else return false;\n }\n\n\n\n\n\n static long GCD(long a, long b) {\n // Everything divides 0\n if (a == 0) return b;\n if (b == 0) return a;\n\n // base case\n if (a == b) return a;\n\n // a is greater\n if (a > b) return GCD(a-b, b);\n return GCD(a, b-a);\n }\n static long LCM(long a, long b){\n return (a*b)/(GCD(a,b));\n }\n static String rev(String s){\n char[] arr = s.toCharArray();\n for(int i = 0; i<(s.length()+1)/2; i++){\n char temp = arr[i];\n arr[i] = arr[s.length()-i-1];\n arr[s.length()-i-1] = temp;\n }\n String fin = new String(arr);\n return fin;\n }\n static long pow(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a;\n else {\n long R = pow(a,N/2);\n if (N % 2 == 0) {\n return R*R;\n }\n else {\n return R*R*a;\n }\n }\n }\n\n static long powMod(long a, long N) {\n if (N == 0) return 1;\n else if (N == 1) return a % mod;\n else {\n long R = powMod(a,N/2) % mod;\n R *= R;\n R %= mod;\n if (N % 2 == 1) {\n R *= a;\n R %= mod;\n }\n return R % mod;\n }\n }\n\n}",
"Main"
]
| import java.util.*;
import java.io.* ;
/*
NOTES:
-more than 10 digits (10^10), use long
-prefix sum of 1's and -1's to control flow of highlighting a region
-log(a)/log(b) = log base b of a
-create a position array if trying to see if elements show up next to each other sequentially
i.e. elements 1,2,3 are within 3 spots of each other in an array
arr[scannedInt - 1] = i; (position of i at p[i] in original)
- use a freq array when counting instances of an element occurring
- increment the counter first before simulating anything turn-based (two player game)
*/
public class Main {
static long mod = (long)(Math.pow(10, 9) + 7);
public static String alpha = "zabcdefghijklmnopqrstuvwxy";
public static void main(String[] args) throws IOException{
Scanner scan = new Scanner(System.in);
long t = 1;
while (t-- > 0) {
int[] diff = new int[1000];
int x= scan.nextInt();
int n = scan.nextInt();
ArrayList<Integer> arr = new ArrayList<>();
for(int i = 0; i<n; i++){
arr.add(scan.nextInt());
diff[Math.abs(x-arr.get(i))]++;
}
int small = 0, big = 0;
if(diff[0] != 1) System.out.println(x);
else{
for(int i = 1; i<diff.length; i++){
if(diff[i] <2){
small = x-i;
big = x+i;
break;
}
}
if(arr.indexOf(small) > -1) System.out.println(big);
else System.out.println(small);
}
//System.out.println(small+" "+big);
}
scan.close();
}
static ArrayList factors(int n ){
ArrayList<Integer> facts = new ArrayList<>();
for(int i = 1; i<=(int)Math.sqrt(n); i++){
if(n%i == 0){
if( i == Math.sqrt(n)) facts.add(i);
else{
facts.add(i);
facts.add(n/i);
}
}
}
Collections.sort(facts);
return facts;
}
static boolean isPrime (int n){
if(factors(n).size() ==2) return true;
else return false;
}
static long GCD(long a, long b) {
// Everything divides 0
if (a == 0) return b;
if (b == 0) return a;
// base case
if (a == b) return a;
// a is greater
if (a > b) return GCD(a-b, b);
return GCD(a, b-a);
}
static long LCM(long a, long b){
return (a*b)/(GCD(a,b));
}
static String rev(String s){
char[] arr = s.toCharArray();
for(int i = 0; i<(s.length()+1)/2; i++){
char temp = arr[i];
arr[i] = arr[s.length()-i-1];
arr[s.length()-i-1] = temp;
}
String fin = new String(arr);
return fin;
}
static long pow(long a, long N) {
if (N == 0) return 1;
else if (N == 1) return a;
else {
long R = pow(a,N/2);
if (N % 2 == 0) {
return R*R;
}
else {
return R*R*a;
}
}
}
static long powMod(long a, long N) {
if (N == 0) return 1;
else if (N == 1) return a % mod;
else {
long R = powMod(a,N/2) % mod;
R *= R;
R %= mod;
if (N % 2 == 1) {
R *= a;
R %= mod;
}
return R % mod;
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
17,
17,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
41,
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,
30,
41,
13,
4,
18,
13,
0,
18,
13,
2,
13,
17,
17,
41,
13,
13,
41,
13,
13,
41,
13,
13,
14,
18,
13,
2,
13,
17,
30,
42,
2,
2,
13,
40,
17,
2,
13,
17,
30,
14,
2,
13,
40,
17,
30,
40,
13,
14,
40,
18,
13,
2,
13,
17,
30,
0,
13,
13,
3,
14,
2,
13,
17,
30,
40,
13,
14,
40,
18,
13,
2,
13,
17,
30,
0,
13,
13,
3,
41,
13,
20,
41,
13,
20,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
12,
13,
30,
41,
13,
17,
14,
2,
2,
13,
17,
17,
30,
0,
13,
17,
0,
13,
17,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
17,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
17,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
17,
29,
2,
13,
2,
13,
17,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
40,
17,
41,
13,
18,
13,
13,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
13,
14,
2,
13,
40,
17,
29,
17,
0,
13,
13,
11,
1,
0,
13,
2,
13,
17,
2,
2,
13,
13,
2,
18,
13,
13,
18,
13,
13,
1,
40,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
11,
1,
41,
13,
2,
13,
17,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
40,
13,
30,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
29,
17,
23,
13,
12,
13,
30,
0,
13,
20,
2,
13,
17,
0,
13,
20,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
11,
1,
41,
13,
2,
13,
13,
2,
13,
13,
1,
0,
13,
13,
30,
30,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
2,
13,
17,
1,
0,
13,
17,
30,
30,
14,
2,
2,
13,
17,
17,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
28,
13,
13,
30,
0,
13,
2,
2,
2,
13,
13,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
17,
28,
13,
13,
30,
0,
13,
2,
2,
13,
2,
2,
13,
13,
13,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
13,
13,
2,
13,
17,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
29,
4,
13,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
4,
13,
18,
13,
13,
12,
13,
30,
0,
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,
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,
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,
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,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
12,
13,
30,
29,
2,
2,
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
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
34,
35
],
[
34,
36
],
[
0,
37
],
[
37,
38
],
[
37,
39
],
[
0,
40
],
[
40,
41
],
[
40,
42
],
[
0,
43
],
[
43,
44
],
[
43,
45
],
[
0,
46
],
[
913,
47
],
[
913,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
913,
53
],
[
53,
54
],
[
913,
55
],
[
55,
56
],
[
913,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
59,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
59,
73
],
[
73,
74
],
[
73,
75
],
[
59,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
59,
102
],
[
102,
103
],
[
102,
104
],
[
59,
105
],
[
105,
106
],
[
105,
107
],
[
59,
108
],
[
108,
109
],
[
108,
110
],
[
59,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
128,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
136,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
127,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
155,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
59,
167
],
[
167,
168
],
[
167,
169
],
[
59,
170
],
[
170,
171
],
[
170,
172
],
[
59,
173
],
[
173,
174
],
[
174,
175
],
[
173,
176
],
[
59,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
59,
181
],
[
181,
182
],
[
182,
183
],
[
57,
184
],
[
184,
185
],
[
913,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
186,
190
],
[
190,
191
],
[
190,
192
],
[
186,
194
],
[
194,
195
],
[
186,
196
],
[
196,
197
],
[
186,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
204,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
214,
215
],
[
214,
216
],
[
200,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
217,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
221,
225
],
[
225,
226
],
[
225,
227
],
[
200,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
228,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
236,
238
],
[
200,
239
],
[
239,
240
],
[
240,
241
],
[
240,
242
],
[
239,
243
],
[
243,
244
],
[
244,
245
],
[
244,
246
],
[
243,
247
],
[
247,
248
],
[
247,
249
],
[
200,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
253,
255
],
[
198,
256
],
[
256,
257
],
[
186,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
260,
264
],
[
264,
265
],
[
264,
266
],
[
260,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
260,
271
],
[
271,
272
],
[
271,
273
],
[
273,
274
],
[
273,
275
],
[
260,
276
],
[
276,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
276,
281
],
[
281,
282
],
[
281,
283
],
[
283,
284
],
[
283,
285
],
[
276,
286
],
[
286,
287
],
[
287,
288
],
[
276,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
291,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
297,
299
],
[
290,
300
],
[
300,
301
],
[
300,
302
],
[
260,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
303,
308
],
[
308,
309
],
[
260,
310
],
[
310,
311
],
[
310,
312
],
[
260,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
317,
318
],
[
317,
319
],
[
313,
320
],
[
320,
321
],
[
321,
322
],
[
321,
323
],
[
320,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
324,
328
],
[
328,
329
],
[
328,
330
],
[
313,
331
],
[
331,
332
],
[
332,
333
],
[
313,
334
],
[
260,
335
],
[
335,
336
],
[
335,
337
],
[
337,
338
],
[
337,
339
],
[
260,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
340,
344
],
[
344,
345
],
[
344,
346
],
[
346,
347
],
[
346,
348
],
[
260,
349
],
[
349,
350
],
[
350,
351
],
[
350,
352
],
[
352,
353
],
[
352,
354
],
[
349,
355
],
[
260,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
358,
360
],
[
360,
361
],
[
360,
362
],
[
357,
363
],
[
363,
364
],
[
363,
365
],
[
365,
366
],
[
365,
367
],
[
356,
368
],
[
368,
369
],
[
368,
370
],
[
356,
371
],
[
371,
372
],
[
372,
373
],
[
371,
374
],
[
374,
375
],
[
356,
376
],
[
377,
377
],
[
377,
378
],
[
378,
379
],
[
378,
380
],
[
380,
381
],
[
380,
382
],
[
377,
383
],
[
383,
384
],
[
384,
385
],
[
384,
386
],
[
383,
387
],
[
387,
388
],
[
387,
389
],
[
377,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
390,
394
],
[
260,
395
],
[
395,
396
],
[
258,
397
],
[
397,
398
],
[
186,
399
],
[
399,
400
],
[
399,
401
],
[
401,
402
],
[
402,
403
],
[
402,
404
],
[
405,
406
],
[
405,
407
],
[
401,
408
],
[
408,
409
],
[
408,
410
],
[
401,
411
],
[
411,
412
],
[
412,
413
],
[
412,
414
],
[
411,
415
],
[
401,
416
],
[
416,
417
],
[
417,
418
],
[
418,
419
],
[
418,
420
],
[
416,
421
],
[
421,
422
],
[
422,
423
],
[
422,
424
],
[
421,
425
],
[
416,
426
],
[
426,
427
],
[
427,
428
],
[
416,
429
],
[
430,
430
],
[
430,
431
],
[
431,
432
],
[
432,
433
],
[
433,
434
],
[
433,
435
],
[
432,
436
],
[
431,
437
],
[
437,
438
],
[
438,
439
],
[
439,
440
],
[
440,
441
],
[
440,
442
],
[
442,
443
],
[
442,
444
],
[
438,
445
],
[
445,
446
],
[
445,
447
],
[
438,
448
],
[
448,
449
],
[
449,
450
],
[
449,
451
],
[
438,
452
],
[
453,
453
],
[
453,
454
],
[
454,
455
],
[
455,
456
],
[
455,
457
],
[
454,
458
],
[
401,
459
],
[
459,
460
],
[
460,
461
],
[
461,
462
],
[
461,
463
],
[
459,
464
],
[
464,
465
],
[
464,
466
],
[
459,
467
],
[
467,
468
],
[
468,
469
],
[
459,
470
],
[
471,
471
],
[
471,
472
],
[
472,
473
],
[
473,
474
],
[
474,
475
],
[
474,
476
],
[
473,
477
],
[
472,
478
],
[
478,
479
],
[
479,
480
],
[
478,
481
],
[
399,
482
],
[
482,
483
],
[
186,
484
],
[
484,
485
],
[
484,
486
],
[
486,
487
],
[
487,
488
],
[
487,
489
],
[
486,
490
],
[
490,
491
],
[
490,
492
],
[
492,
493
],
[
492,
494
],
[
490,
495
],
[
495,
496
],
[
496,
497
],
[
496,
498
],
[
490,
499
],
[
500,
500
],
[
500,
501
],
[
501,
502
],
[
502,
503
],
[
503,
504
],
[
503,
505
],
[
502,
506
],
[
501,
507
],
[
507,
508
],
[
507,
509
],
[
509,
510
],
[
509,
511
],
[
509,
512
],
[
500,
513
],
[
513,
514
],
[
513,
515
],
[
515,
516
],
[
515,
517
],
[
515,
518
],
[
486,
519
],
[
519,
520
],
[
484,
521
],
[
521,
522
],
[
484,
523
],
[
523,
524
],
[
186,
525
],
[
525,
526
],
[
525,
527
],
[
527,
528
],
[
528,
529
],
[
528,
530
],
[
527,
531
],
[
531,
532
],
[
531,
533
],
[
531,
534
],
[
534,
535
],
[
535,
536
],
[
535,
537
],
[
537,
538
],
[
538,
539
],
[
539,
540
],
[
539,
541
],
[
538,
542
],
[
537,
543
],
[
527,
544
],
[
544,
545
],
[
525,
546
],
[
546,
547
],
[
186,
548
],
[
548,
549
],
[
548,
550
],
[
550,
551
],
[
551,
552
],
[
551,
553
],
[
550,
554
],
[
554,
555
],
[
554,
556
],
[
554,
557
],
[
557,
558
],
[
558,
559
],
[
558,
560
],
[
560,
561
],
[
561,
562
],
[
561,
563
],
[
563,
564
],
[
564,
565
],
[
564,
566
],
[
563,
567
],
[
560,
568
],
[
550,
569
],
[
569,
570
],
[
548,
571
],
[
571,
572
],
[
186,
573
],
[
573,
574
],
[
573,
575
],
[
575,
576
],
[
576,
577
],
[
577,
578
],
[
577,
579
],
[
577,
580
],
[
580,
581
],
[
580,
582
],
[
573,
583
],
[
583,
584
],
[
186,
585
],
[
585,
586
],
[
585,
587
],
[
587,
588
],
[
588,
589
],
[
589,
590
],
[
589,
591
],
[
588,
592
],
[
592,
593
],
[
587,
594
],
[
594,
595
],
[
595,
596
],
[
595,
597
],
[
597,
598
],
[
597,
599
],
[
595,
600
],
[
585,
601
],
[
601,
602
],
[
585,
603
],
[
603,
604
],
[
186,
605
],
[
605,
606
],
[
605,
607
],
[
607,
608
],
[
608,
609
],
[
608,
610
],
[
610,
611
],
[
610,
612
],
[
186,
613
],
[
613,
614
],
[
613,
615
],
[
615,
616
],
[
616,
617
],
[
616,
618
],
[
613,
619
],
[
619,
620
],
[
186,
621
],
[
621,
622
],
[
621,
623
],
[
623,
624
],
[
624,
625
],
[
625,
626
],
[
625,
627
],
[
627,
628
],
[
624,
629
],
[
629,
630
],
[
623,
631
],
[
631,
632
],
[
632,
633
],
[
632,
634
],
[
631,
635
],
[
635,
636
],
[
636,
637
],
[
636,
638
],
[
635,
639
],
[
639,
640
],
[
640,
641
],
[
640,
642
],
[
642,
643
],
[
643,
644
],
[
639,
645
],
[
645,
646
],
[
646,
647
],
[
646,
648
],
[
648,
649
],
[
649,
650
],
[
648,
651
],
[
635,
652
],
[
652,
653
],
[
653,
654
],
[
653,
655
],
[
652,
656
],
[
656,
657
],
[
657,
658
],
[
623,
659
],
[
659,
660
],
[
660,
661
],
[
660,
662
],
[
662,
663
],
[
186,
664
],
[
664,
665
],
[
664,
666
],
[
666,
667
],
[
667,
668
],
[
667,
669
],
[
669,
670
],
[
666,
671
],
[
671,
672
],
[
672,
673
],
[
672,
674
],
[
671,
675
],
[
675,
676
],
[
675,
677
],
[
677,
678
],
[
666,
679
],
[
679,
680
],
[
679,
681
],
[
666,
682
],
[
682,
683
],
[
683,
684
],
[
684,
685
],
[
684,
686
],
[
682,
687
],
[
687,
688
],
[
688,
689
],
[
689,
690
],
[
688,
691
],
[
687,
692
],
[
692,
693
],
[
692,
694
],
[
694,
695
],
[
666,
696
],
[
696,
697
],
[
697,
698
],
[
698,
699
],
[
186,
700
],
[
700,
701
],
[
700,
702
],
[
702,
703
],
[
703,
704
],
[
703,
705
],
[
705,
706
],
[
702,
707
],
[
707,
708
],
[
708,
709
],
[
708,
710
],
[
707,
711
],
[
711,
712
],
[
711,
713
],
[
713,
714
],
[
702,
715
],
[
715,
716
],
[
715,
717
],
[
702,
718
],
[
718,
719
],
[
719,
720
],
[
720,
721
],
[
720,
722
],
[
718,
723
],
[
723,
724
],
[
724,
725
],
[
725,
726
],
[
724,
727
],
[
723,
728
],
[
728,
729
],
[
728,
730
],
[
730,
731
],
[
702,
732
],
[
732,
733
],
[
733,
734
],
[
734,
735
],
[
186,
736
],
[
736,
737
],
[
736,
738
],
[
738,
739
],
[
739,
740
],
[
739,
741
],
[
741,
742
],
[
738,
743
],
[
743,
744
],
[
744,
745
],
[
744,
746
],
[
743,
747
],
[
747,
748
],
[
747,
749
],
[
749,
750
],
[
738,
751
],
[
751,
752
],
[
751,
753
],
[
738,
754
],
[
754,
755
],
[
755,
756
],
[
755,
757
],
[
754,
758
],
[
758,
759
],
[
759,
760
],
[
759,
761
],
[
761,
762
],
[
758,
763
],
[
763,
764
],
[
763,
765
],
[
765,
766
],
[
738,
767
],
[
767,
768
],
[
767,
769
],
[
738,
770
],
[
770,
771
],
[
771,
772
],
[
772,
773
],
[
772,
774
],
[
770,
775
],
[
775,
776
],
[
776,
777
],
[
777,
778
],
[
778,
779
],
[
778,
780
],
[
777,
781
],
[
781,
782
],
[
781,
783
],
[
776,
784
],
[
784,
785
],
[
775,
786
],
[
786,
787
],
[
786,
788
],
[
775,
789
],
[
789,
790
],
[
789,
791
],
[
791,
792
],
[
791,
793
],
[
775,
794
],
[
794,
795
],
[
794,
796
],
[
796,
797
],
[
738,
798
],
[
798,
799
],
[
799,
800
],
[
799,
801
],
[
186,
802
],
[
802,
803
],
[
802,
804
],
[
804,
805
],
[
805,
806
],
[
805,
807
],
[
807,
808
],
[
804,
809
],
[
809,
810
],
[
810,
811
],
[
810,
812
],
[
809,
813
],
[
813,
814
],
[
813,
815
],
[
815,
816
],
[
804,
817
],
[
817,
818
],
[
817,
819
],
[
804,
820
],
[
820,
821
],
[
821,
822
],
[
821,
823
],
[
820,
824
],
[
824,
825
],
[
825,
826
],
[
825,
827
],
[
827,
828
],
[
824,
829
],
[
829,
830
],
[
829,
831
],
[
831,
832
],
[
804,
833
],
[
833,
834
],
[
833,
835
],
[
804,
836
],
[
836,
837
],
[
837,
838
],
[
838,
839
],
[
838,
840
],
[
836,
841
],
[
841,
842
],
[
842,
843
],
[
843,
844
],
[
844,
845
],
[
844,
846
],
[
843,
847
],
[
847,
848
],
[
847,
849
],
[
842,
850
],
[
850,
851
],
[
841,
852
],
[
852,
853
],
[
852,
854
],
[
841,
855
],
[
855,
856
],
[
855,
857
],
[
857,
858
],
[
857,
859
],
[
841,
860
],
[
860,
861
],
[
860,
862
],
[
862,
863
],
[
804,
864
],
[
864,
865
],
[
865,
866
],
[
865,
867
],
[
186,
868
],
[
868,
869
],
[
868,
870
],
[
870,
871
],
[
871,
872
],
[
875,
873
],
[
885,
874
],
[
882,
875
],
[
875,
876
],
[
876,
877
],
[
876,
878
],
[
875,
879
],
[
879,
880
],
[
879,
881
],
[
882,
882
],
[
882,
883
],
[
882,
884
],
[
885,
885
],
[
885,
886
],
[
885,
887
],
[
875,
888
],
[
888,
889
],
[
888,
890
],
[
890,
891
],
[
868,
892
],
[
892,
893
],
[
186,
894
],
[
894,
895
],
[
894,
896
],
[
896,
897
],
[
897,
898
],
[
899,
899
],
[
899,
900
],
[
900,
901
],
[
900,
902
],
[
899,
903
],
[
903,
904
],
[
903,
905
],
[
899,
906
],
[
906,
907
],
[
906,
908
],
[
908,
909
],
[
894,
910
],
[
910,
911
],
[
0,
912
],
[
912,
913
],
[
912,
914
]
]
| [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.Set;\n\n\npublic class Main {\n\n\tstatic long mod = (long)(1e+9 + 7);\n\tstatic int[] sieve;\n\tstatic ArrayList<Integer> primes;\n\n\tpublic static void main(String[] args) {\n\t\tfast s = new fast();\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\n\t\tboolean[] p = new boolean[103];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}\n\n\t\tint l = x;\n\t\tint u = x;\n\t\tint ans = x;\n\n\t\tif(p[x+1]) {\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tStringBuilder sb = new StringBuilder(\"\");\n\t\tsb.append(ans);\n\n\t\tout.println(sb);\n\t\tout.close();\n\t}\n\n\n\n\n\n\n\n\tstatic class fast {\n\n\t\t private InputStream i;\n\t\t\tprivate byte[] buf = new byte[1024];\n\t\t\tprivate int curChar;\n\n\t\t\tprivate int numChars;\n\n\t\t\t//Return floor log2n\n\t\t\tpublic static long log2(long bits) // returns 0 for bits=0\n\t\t\t\t{\n\t\t\t\t int log = 0;\n\t\t\t\t if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }\n\t\t\t\t if( bits >= 256 ) { bits >>>= 8; log += 8; }\n\t\t\t\t if( bits >= 16 ) { bits >>>= 4; log += 4; }\n\t\t\t\t if( bits >= 4 ) { bits >>>= 2; log += 2; }\n\t\t\t\t return log + ( bits >>> 1 );\n\t\t\t\t}\n\n\t\t\tpublic static boolean next_permutation(int a[])\n\t\t\t {\n\t\t\t\t int i=0,j=0;int index=-1;\n\t\t\t\t int n=a.length;\n\n\t\t\t\t for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;\n\n\t\t\t\t if(index==-1) return false;\n\t\t\t\t i=index;\n\n\n\t\t\t\t for(j=i+1;j<n && a[i]<a[j];j++);\n\n\t\t\t\t int temp=a[i];\n\t\t\t\t a[i]=a[j-1];\n\t\t\t\t a[j-1]=temp;\n\n\t\t\t\t for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }\n\n\t\t\t\t return true;\n\t\t\t }\n\n\t\t\tpublic static void sieve(int size)\n\t\t\t{\n\t\t\t\tsieve=new int[size+1];\n\n\t\t\t\tprimes=new ArrayList<Integer>();\n\n\t\t\t\tsieve[1]=1;\n\n\t\t\t\tfor(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tfor(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic static long pow(long a, long p){\n\t\t\t long o = 1;\n\t\t\t for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long add(long... a){\n\t\t\t long o = 0;\n\t\t\t for(long x:a)o = (o+mod+x)%mod;\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long mul(long... a){\n\t\t\t long p = 1;\n\t\t\t for(long x:a)p = (mod+(p*x)%mod)%mod;\n\t\t\t return p;\n\t\t\t}\n\n\t\t\tpublic static long mod_inv(long n)\n\t\t\t{\n\t\t\t\treturn pow(n,mod-2);\n\t\t\t}\n\n\t\t\tpublic long gcd(long r,long ans)\n\t\t\t{\n\t\t\t\tif(r==0) return ans;\n\t\t\t\treturn gcd(ans%r,r);\n\t\t\t}\n\n\t\t\tpublic fast() {\n\t\t\t\tthis(System.in);\n\t\t\t}\n\t\t\tpublic fast(InputStream is) {\n\t\t\t\ti = is;\n\t\t\t}\n\t\t\tpublic int read() {\n\t\t\t\tif (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tif (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn buf[curChar++];\n\t\t\t}\n\t\t\tpublic String nextLine() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic String nextString() {\n\t \t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic long nextLong() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tlong res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic int nextInt() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tint res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic boolean isSpaceChar(int c) {\n\t\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t\t}\n\t\t\tpublic boolean isEndOfLine(int c) {\n\t\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t\t}\n\n\t\t}\n\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.ArrayDeque;",
"ArrayDeque",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.Iterator;",
"Iterator",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n\tstatic long mod = (long)(1e+9 + 7);\n\tstatic int[] sieve;\n\tstatic ArrayList<Integer> primes;\n\n\tpublic static void main(String[] args) {\n\t\tfast s = new fast();\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\n\t\tboolean[] p = new boolean[103];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}\n\n\t\tint l = x;\n\t\tint u = x;\n\t\tint ans = x;\n\n\t\tif(p[x+1]) {\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tStringBuilder sb = new StringBuilder(\"\");\n\t\tsb.append(ans);\n\n\t\tout.println(sb);\n\t\tout.close();\n\t}\n\n\n\n\n\n\n\n\tstatic class fast {\n\n\t\t private InputStream i;\n\t\t\tprivate byte[] buf = new byte[1024];\n\t\t\tprivate int curChar;\n\n\t\t\tprivate int numChars;\n\n\t\t\t//Return floor log2n\n\t\t\tpublic static long log2(long bits) // returns 0 for bits=0\n\t\t\t\t{\n\t\t\t\t int log = 0;\n\t\t\t\t if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }\n\t\t\t\t if( bits >= 256 ) { bits >>>= 8; log += 8; }\n\t\t\t\t if( bits >= 16 ) { bits >>>= 4; log += 4; }\n\t\t\t\t if( bits >= 4 ) { bits >>>= 2; log += 2; }\n\t\t\t\t return log + ( bits >>> 1 );\n\t\t\t\t}\n\n\t\t\tpublic static boolean next_permutation(int a[])\n\t\t\t {\n\t\t\t\t int i=0,j=0;int index=-1;\n\t\t\t\t int n=a.length;\n\n\t\t\t\t for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;\n\n\t\t\t\t if(index==-1) return false;\n\t\t\t\t i=index;\n\n\n\t\t\t\t for(j=i+1;j<n && a[i]<a[j];j++);\n\n\t\t\t\t int temp=a[i];\n\t\t\t\t a[i]=a[j-1];\n\t\t\t\t a[j-1]=temp;\n\n\t\t\t\t for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }\n\n\t\t\t\t return true;\n\t\t\t }\n\n\t\t\tpublic static void sieve(int size)\n\t\t\t{\n\t\t\t\tsieve=new int[size+1];\n\n\t\t\t\tprimes=new ArrayList<Integer>();\n\n\t\t\t\tsieve[1]=1;\n\n\t\t\t\tfor(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tfor(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic static long pow(long a, long p){\n\t\t\t long o = 1;\n\t\t\t for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long add(long... a){\n\t\t\t long o = 0;\n\t\t\t for(long x:a)o = (o+mod+x)%mod;\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long mul(long... a){\n\t\t\t long p = 1;\n\t\t\t for(long x:a)p = (mod+(p*x)%mod)%mod;\n\t\t\t return p;\n\t\t\t}\n\n\t\t\tpublic static long mod_inv(long n)\n\t\t\t{\n\t\t\t\treturn pow(n,mod-2);\n\t\t\t}\n\n\t\t\tpublic long gcd(long r,long ans)\n\t\t\t{\n\t\t\t\tif(r==0) return ans;\n\t\t\t\treturn gcd(ans%r,r);\n\t\t\t}\n\n\t\t\tpublic fast() {\n\t\t\t\tthis(System.in);\n\t\t\t}\n\t\t\tpublic fast(InputStream is) {\n\t\t\t\ti = is;\n\t\t\t}\n\t\t\tpublic int read() {\n\t\t\t\tif (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tif (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn buf[curChar++];\n\t\t\t}\n\t\t\tpublic String nextLine() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic String nextString() {\n\t \t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic long nextLong() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tlong res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic int nextInt() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tint res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic boolean isSpaceChar(int c) {\n\t\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t\t}\n\t\t\tpublic boolean isEndOfLine(int c) {\n\t\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t\t}\n\n\t\t}\n\n\n\n}",
"Main",
"static long mod = (long)(1e+9 + 7);",
"mod",
"(long)(1e+9 + 7)",
"1e+9",
"7",
"static int[] sieve;",
"sieve",
"static ArrayList<Integer> primes;",
"primes",
"public static void main(String[] args) {\n\t\tfast s = new fast();\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\n\t\tboolean[] p = new boolean[103];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}\n\n\t\tint l = x;\n\t\tint u = x;\n\t\tint ans = x;\n\n\t\tif(p[x+1]) {\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tStringBuilder sb = new StringBuilder(\"\");\n\t\tsb.append(ans);\n\n\t\tout.println(sb);\n\t\tout.close();\n\t}",
"main",
"{\n\t\tfast s = new fast();\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\n\t\tboolean[] p = new boolean[103];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}\n\n\t\tint l = x;\n\t\tint u = x;\n\t\tint ans = x;\n\n\t\tif(p[x+1]) {\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tStringBuilder sb = new StringBuilder(\"\");\n\t\tsb.append(ans);\n\n\t\tout.println(sb);\n\t\tout.close();\n\t}",
"fast s = new fast();",
"s",
"new fast()",
"int x = s.nextInt();",
"x",
"s.nextInt()",
"s.nextInt",
"s",
"int n = s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"boolean[] p = new boolean[103];",
"p",
"new boolean[103]",
"103",
"for(int i = 0; i < n; i++) {\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}",
"{\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}",
"int t = s.nextInt();",
"t",
"s.nextInt()",
"s.nextInt",
"s",
"p[t+1] = true",
"p[t+1]",
"p",
"t+1",
"t",
"1",
"true",
"int l = x;",
"l",
"x",
"int u = x;",
"u",
"x",
"int ans = x;",
"ans",
"x",
"if(p[x+1]) {\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"p[x+1]",
"p",
"x+1",
"x",
"1",
"{\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"while(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}",
"l > -1 || u < 101",
"l > -1",
"l",
"-1",
"1",
"u < 101",
"u",
"101",
"{\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}",
"if(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"l > -1",
"l",
"-1",
"1",
"{\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"l--",
"l",
"if(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"!p[l+1]",
"p[l+1]",
"p",
"l+1",
"l",
"1",
"{\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"ans = l",
"ans",
"l",
"break;",
"if(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"u < 101",
"u",
"101",
"{\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"u++",
"u",
"if(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"!p[u+1]",
"p[u+1]",
"p",
"u+1",
"u",
"1",
"{\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"ans = u",
"ans",
"u",
"break;",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"StringBuilder sb = new StringBuilder(\"\");",
"sb",
"new StringBuilder(\"\")",
"sb.append(ans)",
"sb.append",
"sb",
"ans",
"out.println(sb)",
"out.println",
"out",
"sb",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class fast {\n\n\t\t private InputStream i;\n\t\t\tprivate byte[] buf = new byte[1024];\n\t\t\tprivate int curChar;\n\n\t\t\tprivate int numChars;\n\n\t\t\t//Return floor log2n\n\t\t\tpublic static long log2(long bits) // returns 0 for bits=0\n\t\t\t\t{\n\t\t\t\t int log = 0;\n\t\t\t\t if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }\n\t\t\t\t if( bits >= 256 ) { bits >>>= 8; log += 8; }\n\t\t\t\t if( bits >= 16 ) { bits >>>= 4; log += 4; }\n\t\t\t\t if( bits >= 4 ) { bits >>>= 2; log += 2; }\n\t\t\t\t return log + ( bits >>> 1 );\n\t\t\t\t}\n\n\t\t\tpublic static boolean next_permutation(int a[])\n\t\t\t {\n\t\t\t\t int i=0,j=0;int index=-1;\n\t\t\t\t int n=a.length;\n\n\t\t\t\t for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;\n\n\t\t\t\t if(index==-1) return false;\n\t\t\t\t i=index;\n\n\n\t\t\t\t for(j=i+1;j<n && a[i]<a[j];j++);\n\n\t\t\t\t int temp=a[i];\n\t\t\t\t a[i]=a[j-1];\n\t\t\t\t a[j-1]=temp;\n\n\t\t\t\t for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }\n\n\t\t\t\t return true;\n\t\t\t }\n\n\t\t\tpublic static void sieve(int size)\n\t\t\t{\n\t\t\t\tsieve=new int[size+1];\n\n\t\t\t\tprimes=new ArrayList<Integer>();\n\n\t\t\t\tsieve[1]=1;\n\n\t\t\t\tfor(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tfor(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic static long pow(long a, long p){\n\t\t\t long o = 1;\n\t\t\t for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long add(long... a){\n\t\t\t long o = 0;\n\t\t\t for(long x:a)o = (o+mod+x)%mod;\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long mul(long... a){\n\t\t\t long p = 1;\n\t\t\t for(long x:a)p = (mod+(p*x)%mod)%mod;\n\t\t\t return p;\n\t\t\t}\n\n\t\t\tpublic static long mod_inv(long n)\n\t\t\t{\n\t\t\t\treturn pow(n,mod-2);\n\t\t\t}\n\n\t\t\tpublic long gcd(long r,long ans)\n\t\t\t{\n\t\t\t\tif(r==0) return ans;\n\t\t\t\treturn gcd(ans%r,r);\n\t\t\t}\n\n\t\t\tpublic fast() {\n\t\t\t\tthis(System.in);\n\t\t\t}\n\t\t\tpublic fast(InputStream is) {\n\t\t\t\ti = is;\n\t\t\t}\n\t\t\tpublic int read() {\n\t\t\t\tif (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tif (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn buf[curChar++];\n\t\t\t}\n\t\t\tpublic String nextLine() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic String nextString() {\n\t \t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic long nextLong() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tlong res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic int nextInt() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tint res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic boolean isSpaceChar(int c) {\n\t\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t\t}\n\t\t\tpublic boolean isEndOfLine(int c) {\n\t\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t\t}\n\n\t\t}",
"fast",
"private InputStream i;",
"i",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"//Return floor log2n\n\t\t\tpublic static long log2(long bits) // returns 0 for bits=0\n\t\t\t\t{\n\t\t\t\t int log = 0;\n\t\t\t\t if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }\n\t\t\t\t if( bits >= 256 ) { bits >>>= 8; log += 8; }\n\t\t\t\t if( bits >= 16 ) { bits >>>= 4; log += 4; }\n\t\t\t\t if( bits >= 4 ) { bits >>>= 2; log += 2; }\n\t\t\t\t return log + ( bits >>> 1 );\n\t\t\t\t}",
"log2",
"{\n\t\t\t\t int log = 0;\n\t\t\t\t if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }\n\t\t\t\t if( bits >= 256 ) { bits >>>= 8; log += 8; }\n\t\t\t\t if( bits >= 16 ) { bits >>>= 4; log += 4; }\n\t\t\t\t if( bits >= 4 ) { bits >>>= 2; log += 2; }\n\t\t\t\t return log + ( bits >>> 1 );\n\t\t\t\t}",
"int log = 0;",
"log",
"0",
"if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }",
"( bits & 0xffff0000 ) != 0",
"( bits & 0xffff0000 )",
"bits",
"0xffff0000",
"0",
"{ bits >>>= 16; log = 16; }",
"bits >>>= 16",
"bits",
"16",
"log = 16",
"log",
"16",
"if( bits >= 256 ) { bits >>>= 8; log += 8; }",
"bits >= 256",
"bits",
"256",
"{ bits >>>= 8; log += 8; }",
"bits >>>= 8",
"bits",
"8",
"log += 8",
"log",
"8",
"if( bits >= 16 ) { bits >>>= 4; log += 4; }",
"bits >= 16",
"bits",
"16",
"{ bits >>>= 4; log += 4; }",
"bits >>>= 4",
"bits",
"4",
"log += 4",
"log",
"4",
"if( bits >= 4 ) { bits >>>= 2; log += 2; }",
"bits >= 4",
"bits",
"4",
"{ bits >>>= 2; log += 2; }",
"bits >>>= 2",
"bits",
"2",
"log += 2",
"log",
"2",
"return log + ( bits >>> 1 );",
"log + ( bits >>> 1 )",
"log",
"( bits >>> 1 )",
"bits",
"1",
"long bits",
"bits",
"public static boolean next_permutation(int a[])\n\t\t\t {\n\t\t\t\t int i=0,j=0;int index=-1;\n\t\t\t\t int n=a.length;\n\n\t\t\t\t for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;\n\n\t\t\t\t if(index==-1) return false;\n\t\t\t\t i=index;\n\n\n\t\t\t\t for(j=i+1;j<n && a[i]<a[j];j++);\n\n\t\t\t\t int temp=a[i];\n\t\t\t\t a[i]=a[j-1];\n\t\t\t\t a[j-1]=temp;\n\n\t\t\t\t for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }\n\n\t\t\t\t return true;\n\t\t\t }",
"next_permutation",
"{\n\t\t\t\t int i=0,j=0;int index=-1;\n\t\t\t\t int n=a.length;\n\n\t\t\t\t for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;\n\n\t\t\t\t if(index==-1) return false;\n\t\t\t\t i=index;\n\n\n\t\t\t\t for(j=i+1;j<n && a[i]<a[j];j++);\n\n\t\t\t\t int temp=a[i];\n\t\t\t\t a[i]=a[j-1];\n\t\t\t\t a[j-1]=temp;\n\n\t\t\t\t for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }\n\n\t\t\t\t return true;\n\t\t\t }",
"int i=0",
"i",
"0",
"j=0;",
"j",
"0",
"int index=-1;",
"index",
"-1",
"1",
"int n=a.length;",
"n",
"a.length",
"a",
"a.length",
"for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;",
"i=0;",
"i=0",
"i",
"0",
"i<n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"if(a[i]<a[i+1]) index=i;",
"if(a[i]<a[i+1]) index=i;",
"a[i]<a[i+1]",
"a[i]",
"a",
"i",
"a[i+1]",
"a",
"i+1",
"i",
"1",
"index=i",
"index",
"i",
"if(index==-1) return false;",
"index==-1",
"index",
"-1",
"1",
"return false;",
"false",
"i=index",
"i",
"index",
"for(j=i+1;j<n && a[i]<a[j];j++);",
"j=i+1;",
"j=i+1",
"j",
"i+1",
"i",
"1",
"j<n && a[i]<a[j]",
"j<n",
"j",
"n",
"a[i]<a[j]",
"a[i]",
"a",
"i",
"a[j]",
"a",
"j",
"j++",
"j++",
"j",
";",
"int temp=a[i];",
"temp",
"a[i]",
"a",
"i",
"a[i]=a[j-1]",
"a[i]",
"a",
"i",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1]=temp",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"temp",
"for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }",
"int p=i+1,q=n-1;",
"int p=i+1",
"p",
"i+1",
"i",
"1",
"q=n-1;",
"q",
"n-1",
"n",
"1",
"p<q",
"p",
"q",
"p++,q--",
"p++",
"p",
"q--",
"q",
"{\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }",
"{\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }",
"temp=a[p]",
"temp",
"a[p]",
"a",
"p",
"a[p]=a[q]",
"a[p]",
"a",
"p",
"a[q]",
"a",
"q",
"a[q]=temp",
"a[q]",
"a",
"q",
"temp",
"return true;",
"true",
"int a[]",
"a",
"public static void sieve(int size)\n\t\t\t{\n\t\t\t\tsieve=new int[size+1];\n\n\t\t\t\tprimes=new ArrayList<Integer>();\n\n\t\t\t\tsieve[1]=1;\n\n\t\t\t\tfor(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tfor(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}\n\t\t\t}",
"sieve",
"{\n\t\t\t\tsieve=new int[size+1];\n\n\t\t\t\tprimes=new ArrayList<Integer>();\n\n\t\t\t\tsieve[1]=1;\n\n\t\t\t\tfor(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tfor(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}\n\t\t\t}",
"sieve=new int[size+1]",
"sieve",
"new int[size+1]",
"size+1",
"size",
"1",
"primes=new ArrayList<Integer>()",
"primes",
"new ArrayList<Integer>()",
"sieve[1]=1",
"sieve[1]",
"sieve",
"1",
"1",
"for(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}",
"int i=2;",
"int i=2;",
"i",
"2",
"i*i<=size",
"i*i",
"i",
"i",
"size",
"i++",
"i++",
"i",
"{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}",
"{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}",
"if(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }",
"sieve[i]==0",
"sieve[i]",
"sieve",
"i",
"0",
"{\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }",
"for(int j=i*i;j<size;j+=i) {sieve[j]=1;}",
"int j=i*i;",
"int j=i*i;",
"j",
"i*i",
"i",
"i",
"j<size",
"j",
"size",
"j+=i",
"j+=i",
"j",
"i",
"{sieve[j]=1;}",
"{sieve[j]=1;}",
"sieve[j]=1",
"sieve[j]",
"sieve",
"j",
"1",
"for(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}",
"int i=2;",
"int i=2;",
"i",
"2",
"i<=size",
"i",
"size",
"i++",
"i++",
"i",
"{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}",
"{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}",
"if(sieve[i]==0) primes.add(i);",
"sieve[i]==0",
"sieve[i]",
"sieve",
"i",
"0",
"primes.add(i)",
"primes.add",
"primes",
"i",
"int size",
"size",
"public static long pow(long a, long p){\n\t\t\t long o = 1;\n\t\t\t for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }\n\t\t\t return o;\n\t\t\t}",
"pow",
"{\n\t\t\t long o = 1;\n\t\t\t for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }\n\t\t\t return o;\n\t\t\t}",
"long o = 1;",
"o",
"1",
"for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }",
";",
"p>0",
"p",
"0",
"p>>=1",
"p>>=1",
"p",
"1",
"{\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }",
"{\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }",
"if((p&1)==1)o = mul(o, a);",
"(p&1)==1",
"(p&1)",
"p",
"1",
"1",
"o = mul(o, a)",
"o",
"mul(o, a)",
"mul",
"o",
"a",
"a = mul(a, a)",
"a",
"mul(a, a)",
"mul",
"a",
"a",
"return o;",
"o",
"long a",
"a",
"long p",
"p",
"public static long add(long... a){\n\t\t\t long o = 0;\n\t\t\t for(long x:a)o = (o+mod+x)%mod;\n\t\t\t return o;\n\t\t\t}",
"add",
"{\n\t\t\t long o = 0;\n\t\t\t for(long x:a)o = (o+mod+x)%mod;\n\t\t\t return o;\n\t\t\t}",
"long o = 0;",
"o",
"0",
"for(long x:a)o = (o+mod+x)%mod;",
"long x",
"a",
"o = (o+mod+x)%mod;",
"o = (o+mod+x)%mod",
"o",
"(o+mod+x)%mod",
"(o+mod+x)",
"o+mod+x",
"o",
"mod",
"x",
"mod",
"return o;",
"o",
"long... a",
"a",
"public static long mul(long... a){\n\t\t\t long p = 1;\n\t\t\t for(long x:a)p = (mod+(p*x)%mod)%mod;\n\t\t\t return p;\n\t\t\t}",
"mul",
"{\n\t\t\t long p = 1;\n\t\t\t for(long x:a)p = (mod+(p*x)%mod)%mod;\n\t\t\t return p;\n\t\t\t}",
"long p = 1;",
"p",
"1",
"for(long x:a)p = (mod+(p*x)%mod)%mod;",
"long x",
"a",
"p = (mod+(p*x)%mod)%mod;",
"p = (mod+(p*x)%mod)%mod",
"p",
"(mod+(p*x)%mod)%mod",
"(mod+(p*x)%mod)",
"mod",
"(p*x)%mod",
"(p*x)",
"p",
"x",
"mod",
"mod",
"return p;",
"p",
"long... a",
"a",
"public static long mod_inv(long n)\n\t\t\t{\n\t\t\t\treturn pow(n,mod-2);\n\t\t\t}",
"mod_inv",
"{\n\t\t\t\treturn pow(n,mod-2);\n\t\t\t}",
"return pow(n,mod-2);",
"pow(n,mod-2)",
"pow",
"n",
"mod-2",
"mod",
"2",
"long n",
"n",
"public long gcd(long r,long ans)\n\t\t\t{\n\t\t\t\tif(r==0) return ans;\n\t\t\t\treturn gcd(ans%r,r);\n\t\t\t}",
"gcd",
"{\n\t\t\t\tif(r==0) return ans;\n\t\t\t\treturn gcd(ans%r,r);\n\t\t\t}",
"if(r==0) return ans;",
"r==0",
"r",
"0",
"return ans;",
"ans",
"return gcd(ans%r,r);",
"gcd(ans%r,r)",
"gcd",
"ans%r",
"ans",
"r",
"r",
"long r",
"r",
"long ans",
"ans",
"public fast() {\n\t\t\t\tthis(System.in);\n\t\t\t}",
"fast",
"{\n\t\t\t\tthis(System.in);\n\t\t\t}",
"this(System.in)",
"this",
"System.in",
"System",
"System.in",
"public fast(InputStream is) {\n\t\t\t\ti = is;\n\t\t\t}",
"fast",
"{\n\t\t\t\ti = is;\n\t\t\t}",
"i = is",
"i",
"is",
"InputStream is",
"is",
"public int read() {\n\t\t\t\tif (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tif (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn buf[curChar++];\n\t\t\t}",
"read",
"{\n\t\t\t\tif (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tif (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn buf[curChar++];\n\t\t\t}",
"if (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();",
"numChars == -1",
"numChars",
"-1",
"1",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}",
"curChar >= numChars",
"curChar",
"numChars",
"{\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}",
"curChar = 0",
"curChar",
"0",
"try {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t}",
"numChars = i.read(buf)",
"numChars",
"i.read(buf)",
"i.read",
"i",
"buf",
"if (numChars <= 0)\n\t\t\t\t\t\treturn -1;",
"numChars <= 0",
"numChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public String nextLine() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));\n\t\t\t\treturn res.toString();\n\t\t\t}",
"nextLine",
"{\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));\n\t\t\t\treturn res.toString();\n\t\t\t}",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c))\n\t\t\t\t\tc = read();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = read()",
"c",
"read()",
"read",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));",
"!isEndOfLine(c)",
"isEndOfLine(c)",
"isEndOfLine",
"c",
"{\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = read()",
"c",
"read()",
"read",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"public String nextString() {\n\t \t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res.toString();\n\t\t\t}",
"nextString",
"{\n\t \t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res.toString();\n\t\t\t}",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c))\n\t\t\t\t\tc = read();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = read()",
"c",
"read()",
"read",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = read()",
"c",
"read()",
"read",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"public long nextLong() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tlong res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}",
"nextLong",
"{\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tlong res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c))\n\t\t\t\t\tc = read();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"long res = 0;",
"res",
"0",
"do {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"if (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public int nextInt() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tint res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}",
"nextInt",
"{\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tint res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c))\n\t\t\t\t\tc = read();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"int res = 0;",
"res",
"0",
"do {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t}",
"if (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n\t\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t\t}",
"isSpaceChar",
"{\n\t\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t\t}",
"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 boolean isEndOfLine(int c) {\n\t\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t\t}",
"isEndOfLine",
"{\n\t\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t\t}",
"return c == '\\n' || c == '\\r' || c == -1;",
"c == '\\n' || c == '\\r' || c == -1",
"c == '\\n' || c == '\\r' || c == -1",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public class Main {\n\n\tstatic long mod = (long)(1e+9 + 7);\n\tstatic int[] sieve;\n\tstatic ArrayList<Integer> primes;\n\n\tpublic static void main(String[] args) {\n\t\tfast s = new fast();\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\n\t\tboolean[] p = new boolean[103];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}\n\n\t\tint l = x;\n\t\tint u = x;\n\t\tint ans = x;\n\n\t\tif(p[x+1]) {\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tStringBuilder sb = new StringBuilder(\"\");\n\t\tsb.append(ans);\n\n\t\tout.println(sb);\n\t\tout.close();\n\t}\n\n\n\n\n\n\n\n\tstatic class fast {\n\n\t\t private InputStream i;\n\t\t\tprivate byte[] buf = new byte[1024];\n\t\t\tprivate int curChar;\n\n\t\t\tprivate int numChars;\n\n\t\t\t//Return floor log2n\n\t\t\tpublic static long log2(long bits) // returns 0 for bits=0\n\t\t\t\t{\n\t\t\t\t int log = 0;\n\t\t\t\t if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }\n\t\t\t\t if( bits >= 256 ) { bits >>>= 8; log += 8; }\n\t\t\t\t if( bits >= 16 ) { bits >>>= 4; log += 4; }\n\t\t\t\t if( bits >= 4 ) { bits >>>= 2; log += 2; }\n\t\t\t\t return log + ( bits >>> 1 );\n\t\t\t\t}\n\n\t\t\tpublic static boolean next_permutation(int a[])\n\t\t\t {\n\t\t\t\t int i=0,j=0;int index=-1;\n\t\t\t\t int n=a.length;\n\n\t\t\t\t for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;\n\n\t\t\t\t if(index==-1) return false;\n\t\t\t\t i=index;\n\n\n\t\t\t\t for(j=i+1;j<n && a[i]<a[j];j++);\n\n\t\t\t\t int temp=a[i];\n\t\t\t\t a[i]=a[j-1];\n\t\t\t\t a[j-1]=temp;\n\n\t\t\t\t for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }\n\n\t\t\t\t return true;\n\t\t\t }\n\n\t\t\tpublic static void sieve(int size)\n\t\t\t{\n\t\t\t\tsieve=new int[size+1];\n\n\t\t\t\tprimes=new ArrayList<Integer>();\n\n\t\t\t\tsieve[1]=1;\n\n\t\t\t\tfor(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tfor(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic static long pow(long a, long p){\n\t\t\t long o = 1;\n\t\t\t for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long add(long... a){\n\t\t\t long o = 0;\n\t\t\t for(long x:a)o = (o+mod+x)%mod;\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long mul(long... a){\n\t\t\t long p = 1;\n\t\t\t for(long x:a)p = (mod+(p*x)%mod)%mod;\n\t\t\t return p;\n\t\t\t}\n\n\t\t\tpublic static long mod_inv(long n)\n\t\t\t{\n\t\t\t\treturn pow(n,mod-2);\n\t\t\t}\n\n\t\t\tpublic long gcd(long r,long ans)\n\t\t\t{\n\t\t\t\tif(r==0) return ans;\n\t\t\t\treturn gcd(ans%r,r);\n\t\t\t}\n\n\t\t\tpublic fast() {\n\t\t\t\tthis(System.in);\n\t\t\t}\n\t\t\tpublic fast(InputStream is) {\n\t\t\t\ti = is;\n\t\t\t}\n\t\t\tpublic int read() {\n\t\t\t\tif (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tif (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn buf[curChar++];\n\t\t\t}\n\t\t\tpublic String nextLine() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic String nextString() {\n\t \t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic long nextLong() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tlong res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic int nextInt() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tint res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic boolean isSpaceChar(int c) {\n\t\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t\t}\n\t\t\tpublic boolean isEndOfLine(int c) {\n\t\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t\t}\n\n\t\t}\n\n\n\n}",
"public class Main {\n\n\tstatic long mod = (long)(1e+9 + 7);\n\tstatic int[] sieve;\n\tstatic ArrayList<Integer> primes;\n\n\tpublic static void main(String[] args) {\n\t\tfast s = new fast();\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\n\t\tboolean[] p = new boolean[103];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint t = s.nextInt();\n\t\t\tp[t+1] = true;\n\t\t}\n\n\t\tint l = x;\n\t\tint u = x;\n\t\tint ans = x;\n\n\t\tif(p[x+1]) {\n\t\t\twhile(l > -1 || u < 101){\n\t\t\t\tif(l > -1) {\n\t\t\t\t\tl--;\n\t\t\t\t\tif(!p[l+1]) {\n\t\t\t\t\t\tans = l;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(u < 101) {\n\t\t\t\t\tu++;\n\t\t\t\t\tif(!p[u+1]) {\n\t\t\t\t\t\tans = u;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tStringBuilder sb = new StringBuilder(\"\");\n\t\tsb.append(ans);\n\n\t\tout.println(sb);\n\t\tout.close();\n\t}\n\n\n\n\n\n\n\n\tstatic class fast {\n\n\t\t private InputStream i;\n\t\t\tprivate byte[] buf = new byte[1024];\n\t\t\tprivate int curChar;\n\n\t\t\tprivate int numChars;\n\n\t\t\t//Return floor log2n\n\t\t\tpublic static long log2(long bits) // returns 0 for bits=0\n\t\t\t\t{\n\t\t\t\t int log = 0;\n\t\t\t\t if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }\n\t\t\t\t if( bits >= 256 ) { bits >>>= 8; log += 8; }\n\t\t\t\t if( bits >= 16 ) { bits >>>= 4; log += 4; }\n\t\t\t\t if( bits >= 4 ) { bits >>>= 2; log += 2; }\n\t\t\t\t return log + ( bits >>> 1 );\n\t\t\t\t}\n\n\t\t\tpublic static boolean next_permutation(int a[])\n\t\t\t {\n\t\t\t\t int i=0,j=0;int index=-1;\n\t\t\t\t int n=a.length;\n\n\t\t\t\t for(i=0;i<n-1;i++)\n\t\t\t\t\t if(a[i]<a[i+1]) index=i;\n\n\t\t\t\t if(index==-1) return false;\n\t\t\t\t i=index;\n\n\n\t\t\t\t for(j=i+1;j<n && a[i]<a[j];j++);\n\n\t\t\t\t int temp=a[i];\n\t\t\t\t a[i]=a[j-1];\n\t\t\t\t a[j-1]=temp;\n\n\t\t\t\t for(int p=i+1,q=n-1;p<q;p++,q--)\n\t\t\t\t {\n\t\t\t\t\t temp=a[p];\n\t\t\t\t\t a[p]=a[q];\n\t\t\t\t\t a[q]=temp;\n\t\t\t\t }\n\n\t\t\t\t return true;\n\t\t\t }\n\n\t\t\tpublic static void sieve(int size)\n\t\t\t{\n\t\t\t\tsieve=new int[size+1];\n\n\t\t\t\tprimes=new ArrayList<Integer>();\n\n\t\t\t\tsieve[1]=1;\n\n\t\t\t\tfor(int i=2;i*i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0)\n\t\t\t\t\t {\n\t\t\t\t\t\tfor(int j=i*i;j<size;j+=i) {sieve[j]=1;}\n\t\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tfor(int i=2;i<=size;i++)\n\t\t\t\t{\n\t\t\t\t\tif(sieve[i]==0) primes.add(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic static long pow(long a, long p){\n\t\t\t long o = 1;\n\t\t\t for(; p>0; p>>=1){\n\t\t\t if((p&1)==1)o = mul(o, a);\n\t\t\t a = mul(a, a);\n\t\t\t }\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long add(long... a){\n\t\t\t long o = 0;\n\t\t\t for(long x:a)o = (o+mod+x)%mod;\n\t\t\t return o;\n\t\t\t}\n\n\t\t\tpublic static long mul(long... a){\n\t\t\t long p = 1;\n\t\t\t for(long x:a)p = (mod+(p*x)%mod)%mod;\n\t\t\t return p;\n\t\t\t}\n\n\t\t\tpublic static long mod_inv(long n)\n\t\t\t{\n\t\t\t\treturn pow(n,mod-2);\n\t\t\t}\n\n\t\t\tpublic long gcd(long r,long ans)\n\t\t\t{\n\t\t\t\tif(r==0) return ans;\n\t\t\t\treturn gcd(ans%r,r);\n\t\t\t}\n\n\t\t\tpublic fast() {\n\t\t\t\tthis(System.in);\n\t\t\t}\n\t\t\tpublic fast(InputStream is) {\n\t\t\t\ti = is;\n\t\t\t}\n\t\t\tpublic int read() {\n\t\t\t\tif (numChars == -1)\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tif (curChar >= numChars) {\n\t\t\t\t\tcurChar = 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumChars = i.read(buf);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\t}\n\t\t\t\t\tif (numChars <= 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn buf[curChar++];\n\t\t\t}\n\t\t\tpublic String nextLine() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isEndOfLine(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic String nextString() {\n\t \t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tStringBuilder res = new StringBuilder();\n\t\t\t\tdo {\n\t\t\t\t\tres.appendCodePoint(c);\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res.toString();\n\t\t\t}\n\t\t\tpublic long nextLong() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tlong res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic int nextInt() {\n\t\t\t\tint c = read();\n\t\t\t\twhile (isSpaceChar(c))\n\t\t\t\t\tc = read();\n\t\t\t\tint sgn = 1;\n\t\t\t\tif (c == '-') {\n\t\t\t\t\tsgn = -1;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t\tint res = 0;\n\t\t\t\tdo {\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tres *= 10;\n\t\t\t\t\tres += c - '0';\n\t\t\t\t\tc = read();\n\t\t\t\t} while (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t\t}\n\t\t\tpublic boolean isSpaceChar(int c) {\n\t\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t\t}\n\t\t\tpublic boolean isEndOfLine(int c) {\n\t\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t\t}\n\n\t\t}\n\n\n\n}",
"Main"
]
| import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class Main {
static long mod = (long)(1e+9 + 7);
static int[] sieve;
static ArrayList<Integer> primes;
public static void main(String[] args) {
fast s = new fast();
int x = s.nextInt();
int n = s.nextInt();
boolean[] p = new boolean[103];
for(int i = 0; i < n; i++) {
int t = s.nextInt();
p[t+1] = true;
}
int l = x;
int u = x;
int ans = x;
if(p[x+1]) {
while(l > -1 || u < 101){
if(l > -1) {
l--;
if(!p[l+1]) {
ans = l;
break;
}
}
if(u < 101) {
u++;
if(!p[u+1]) {
ans = u;
break;
}
}
}
}
PrintWriter out = new PrintWriter(System.out);
StringBuilder sb = new StringBuilder("");
sb.append(ans);
out.println(sb);
out.close();
}
static class fast {
private InputStream i;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
//Return floor log2n
public static long log2(long bits) // returns 0 for bits=0
{
int log = 0;
if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
if( bits >= 256 ) { bits >>>= 8; log += 8; }
if( bits >= 16 ) { bits >>>= 4; log += 4; }
if( bits >= 4 ) { bits >>>= 2; log += 2; }
return log + ( bits >>> 1 );
}
public static boolean next_permutation(int a[])
{
int i=0,j=0;int index=-1;
int n=a.length;
for(i=0;i<n-1;i++)
if(a[i]<a[i+1]) index=i;
if(index==-1) return false;
i=index;
for(j=i+1;j<n && a[i]<a[j];j++);
int temp=a[i];
a[i]=a[j-1];
a[j-1]=temp;
for(int p=i+1,q=n-1;p<q;p++,q--)
{
temp=a[p];
a[p]=a[q];
a[q]=temp;
}
return true;
}
public static void sieve(int size)
{
sieve=new int[size+1];
primes=new ArrayList<Integer>();
sieve[1]=1;
for(int i=2;i*i<=size;i++)
{
if(sieve[i]==0)
{
for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
}
}
for(int i=2;i<=size;i++)
{
if(sieve[i]==0) primes.add(i);
}
}
public static long pow(long a, long p){
long o = 1;
for(; p>0; p>>=1){
if((p&1)==1)o = mul(o, a);
a = mul(a, a);
}
return o;
}
public static long add(long... a){
long o = 0;
for(long x:a)o = (o+mod+x)%mod;
return o;
}
public static long mul(long... a){
long p = 1;
for(long x:a)p = (mod+(p*x)%mod)%mod;
return p;
}
public static long mod_inv(long n)
{
return pow(n,mod-2);
}
public long gcd(long r,long ans)
{
if(r==0) return ans;
return gcd(ans%r,r);
}
public fast() {
this(System.in);
}
public fast(InputStream is) {
i = is;
}
public int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = i.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isEndOfLine(c));
return res.toString();
}
public String nextString() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public long nextLong() {
int c = read();
while (isSpaceChar(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 (!isSpaceChar(c));
return res * sgn;
}
public int nextInt() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
4,
13,
13,
2,
13,
13,
13,
41,
13,
4,
13,
13,
2,
13,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
30,
9,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
42,
40,
4,
18,
13,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
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
],
[
227,
20
],
[
227,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
23,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
23,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
23,
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
],
[
56,
58
],
[
58,
59
],
[
58,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
58,
64
],
[
55,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
67,
73
],
[
55,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
82,
91
],
[
74,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
102,
104
],
[
96,
105
],
[
92,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
110,
119
],
[
106,
120
],
[
120,
121
],
[
21,
122
],
[
122,
123
],
[
227,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
127,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
140,
146
],
[
146,
147
],
[
147,
148
],
[
126,
149
],
[
149,
150
],
[
124,
151
],
[
151,
152
],
[
124,
153
],
[
153,
154
],
[
124,
155
],
[
155,
156
],
[
227,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
162,
163
],
[
162,
164
],
[
157,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
168,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
173,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
167,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
157,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
195,
196
],
[
157,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
199,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
204,
209
],
[
209,
210
],
[
209,
211
],
[
204,
212
],
[
212,
213
],
[
213,
214
],
[
204,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
216,
220
],
[
220,
221
],
[
199,
222
],
[
222,
223
],
[
197,
224
],
[
224,
225
],
[
0,
226
],
[
226,
227
],
[
226,
228
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\nimport java.lang.Math;\nimport java.util.Map;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int x = fs.nextInt();\n int n = fs.nextInt();\n int[] ar = fs.readArray(n);\n\n for (int i = 0; i<100; i++) {\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }\n }\n public static boolean inArray(int[] ar, int x, int n) {\n\n for (int i = 0; i<n; i++) {\n if (x==ar[i]) {\n return false;\n }\n }\n return true;\n\n }\n\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n\n public String next() {\n while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n }\n\n}\n",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.*;",
"util.*",
"java",
"import java.lang.Math;",
"Math",
"java.lang",
"import java.util.Map;",
"Map",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int x = fs.nextInt();\n int n = fs.nextInt();\n int[] ar = fs.readArray(n);\n\n for (int i = 0; i<100; i++) {\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }\n }\n public static boolean inArray(int[] ar, int x, int n) {\n\n for (int i = 0; i<n; i++) {\n if (x==ar[i]) {\n return false;\n }\n }\n return true;\n\n }\n\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n\n public String next() {\n while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n }\n\n}",
"Main",
"public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int x = fs.nextInt();\n int n = fs.nextInt();\n int[] ar = fs.readArray(n);\n\n for (int i = 0; i<100; i++) {\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }\n }",
"main",
"{\n FastScanner fs = new FastScanner();\n int x = fs.nextInt();\n int n = fs.nextInt();\n int[] ar = fs.readArray(n);\n\n for (int i = 0; i<100; i++) {\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }\n }",
"FastScanner fs = new FastScanner();",
"fs",
"new FastScanner()",
"int x = fs.nextInt();",
"x",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int n = fs.nextInt();",
"n",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int[] ar = fs.readArray(n);",
"ar",
"fs.readArray(n)",
"fs.readArray",
"fs",
"n",
"for (int i = 0; i<100; i++) {\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<100",
"i",
"100",
"i++",
"i++",
"i",
"{\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }",
"{\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }",
"boolean dec = inArray(ar,x-i,n);",
"dec",
"inArray(ar,x-i,n)",
"inArray",
"ar",
"x-i",
"x",
"i",
"n",
"boolean inc = inArray(ar,x+i,n);",
"inc",
"inArray(ar,x+i,n)",
"inArray",
"ar",
"x+i",
"x",
"i",
"n",
"if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }",
"dec == true && inc == true",
"dec == true",
"dec",
"true",
"inc == true",
"inc",
"true",
"{\n System.out.println(x-i);\n break;\n }",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"break;",
"if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }",
"dec==true",
"dec",
"true",
"{\n System.out.println(x-i);\n break;\n }",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"break;",
"if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }",
"inc == true",
"inc",
"true",
"{\n System.out.println(x+i);\n break;\n }",
"System.out.println(x+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"break;",
"{\n continue;\n }",
"continue;",
"String[] args",
"args",
"public static boolean inArray(int[] ar, int x, int n) {\n\n for (int i = 0; i<n; i++) {\n if (x==ar[i]) {\n return false;\n }\n }\n return true;\n\n }",
"inArray",
"{\n\n for (int i = 0; i<n; i++) {\n if (x==ar[i]) {\n return false;\n }\n }\n return true;\n\n }",
"for (int i = 0; i<n; i++) {\n if (x==ar[i]) {\n return false;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (x==ar[i]) {\n return false;\n }\n }",
"{\n if (x==ar[i]) {\n return false;\n }\n }",
"if (x==ar[i]) {\n return false;\n }",
"x==ar[i]",
"x",
"ar[i]",
"ar",
"i",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"int[] ar",
"ar",
"int x",
"x",
"int n",
"n",
"static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n\n public String next() {\n while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n }",
"FastScanner",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringTokenizer st=new StringTokenizer(\"\");",
"st",
"new StringTokenizer(\"\")",
"public String next() {\n while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }",
"next",
"{\n while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }",
"while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"try {\n st=new StringTokenizer(br.readLine());\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 st=new StringTokenizer(br.readLine());\n }",
"st=new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }",
"readArray",
"{\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }",
"int[] a=new int[n];",
"a",
"new int[n]",
"n",
"for (int i=0; i<n; i++) a[i]=nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=nextInt();",
"a[i]=nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int x = fs.nextInt();\n int n = fs.nextInt();\n int[] ar = fs.readArray(n);\n\n for (int i = 0; i<100; i++) {\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }\n }\n public static boolean inArray(int[] ar, int x, int n) {\n\n for (int i = 0; i<n; i++) {\n if (x==ar[i]) {\n return false;\n }\n }\n return true;\n\n }\n\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n\n public String next() {\n while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int x = fs.nextInt();\n int n = fs.nextInt();\n int[] ar = fs.readArray(n);\n\n for (int i = 0; i<100; i++) {\n boolean dec = inArray(ar,x-i,n);\n boolean inc = inArray(ar,x+i,n);\n if (dec == true && inc == true) {\n System.out.println(x-i);\n break;\n } else if (dec==true) {\n System.out.println(x-i);\n break;\n } else if (inc == true) {\n System.out.println(x+i);\n break;\n } else {\n continue;\n }\n\n }\n }\n public static boolean inArray(int[] ar, int x, int n) {\n\n for (int i = 0; i<n; i++) {\n if (x==ar[i]) {\n return false;\n }\n }\n return true;\n\n }\n\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n\n public String next() {\n while (!st.hasMoreElements())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n }\n\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.Math;
import java.util.Map;
public class Main {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
int x = fs.nextInt();
int n = fs.nextInt();
int[] ar = fs.readArray(n);
for (int i = 0; i<100; i++) {
boolean dec = inArray(ar,x-i,n);
boolean inc = inArray(ar,x+i,n);
if (dec == true && inc == true) {
System.out.println(x-i);
break;
} else if (dec==true) {
System.out.println(x-i);
break;
} else if (inc == true) {
System.out.println(x+i);
break;
} else {
continue;
}
}
}
public static boolean inArray(int[] ar, int x, int n) {
for (int i = 0; i<n; i++) {
if (x==ar[i]) {
return false;
}
}
return true;
}
static class FastScanner {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
public String next() {
while (!st.hasMoreElements())
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a=new int[n];
for (int i=0; i<n; i++) a[i]=nextInt();
return a;
}
}
}
|
[
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,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
18,
13,
13,
17,
41,
13,
13,
14,
18,
13,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
18,
13,
13,
30,
0,
13,
13,
3,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
18,
13,
13,
30,
14,
2,
2,
13,
13,
2,
13,
13,
30,
0,
13,
13,
3,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
4,
13,
20,
12,
13,
30,
14,
2,
13,
13,
30,
38,
5,
13,
30,
30,
0,
13,
4,
13,
13,
17,
18,
13,
13,
0,
13,
17,
29,
18,
13,
40,
13,
12,
13,
30,
40,
13,
12,
13,
30,
41,
13,
42,
17,
30,
41,
13,
4,
13,
14,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
30,
14,
40,
0,
13,
2,
13,
17,
4,
13,
29,
13,
12,
13,
30,
42,
17,
30,
41,
13,
4,
13,
14,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
30,
4,
13,
3,
12,
13,
30,
4,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
17,
42,
17,
30,
41,
13,
2,
4,
13,
17,
14,
2,
2,
13,
17,
2,
17,
13,
3,
0,
13,
2,
2,
17,
13,
13,
29,
8,
13,
40,
13,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
17,
42,
17,
30,
41,
13,
2,
4,
13,
17,
14,
2,
2,
13,
17,
2,
17,
13,
3,
0,
13,
2,
2,
17,
13,
13,
29,
8,
13,
40,
13,
13,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
398,
11
],
[
398,
12
],
[
12,
13
],
[
12,
14
],
[
398,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
17,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
17,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
17,
34
],
[
34,
35
],
[
34,
36
],
[
17,
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
],
[
54,
55
],
[
54,
56
],
[
51,
57
],
[
17,
58
],
[
58,
59
],
[
58,
60
],
[
17,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
69,
76
],
[
76,
77
],
[
76,
78
],
[
69,
79
],
[
79,
80
],
[
80,
81
],
[
69,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
65,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
94,
101
],
[
101,
102
],
[
101,
103
],
[
94,
104
],
[
104,
105
],
[
105,
106
],
[
94,
107
],
[
108,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
114,
127
],
[
17,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
15,
132
],
[
132,
133
],
[
398,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
134,
140
],
[
140,
141
],
[
140,
142
],
[
134,
143
],
[
143,
144
],
[
143,
145
],
[
134,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
134,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
167,
169
],
[
167,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
159,
174
],
[
174,
175
],
[
174,
176
],
[
154,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
134,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
134,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
190,
191
],
[
189,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
194,
199
],
[
199,
200
],
[
201,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
205,
206
],
[
205,
207
],
[
201,
208
],
[
208,
209
],
[
208,
210
],
[
199,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
216,
218
],
[
212,
219
],
[
219,
220
],
[
211,
221
],
[
221,
222
],
[
134,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
228,
233
],
[
233,
234
],
[
235,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
235,
239
],
[
239,
240
],
[
239,
241
],
[
235,
242
],
[
242,
243
],
[
242,
244
],
[
233,
245
],
[
245,
246
],
[
246,
247
],
[
245,
248
],
[
134,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
252,
253
],
[
251,
254
],
[
254,
255
],
[
254,
256
],
[
251,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
258,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
265,
267
],
[
258,
268
],
[
268,
269
],
[
269,
270
],
[
258,
271
],
[
272,
272
],
[
272,
273
],
[
273,
274
],
[
274,
275
],
[
274,
276
],
[
273,
277
],
[
277,
278
],
[
251,
279
],
[
279,
280
],
[
249,
281
],
[
281,
282
],
[
134,
283
],
[
283,
284
],
[
283,
285
],
[
285,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
285,
290
],
[
290,
291
],
[
290,
292
],
[
285,
293
],
[
293,
294
],
[
293,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
299,
300
],
[
298,
301
],
[
295,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
303,
307
],
[
307,
308
],
[
307,
309
],
[
302,
310
],
[
295,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
313,
317
],
[
285,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
321,
322
],
[
319,
323
],
[
134,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
327,
328
],
[
327,
329
],
[
326,
331
],
[
331,
332
],
[
332,
333
],
[
333,
334
],
[
333,
335
],
[
331,
336
],
[
336,
337
],
[
336,
338
],
[
338,
339
],
[
338,
340
],
[
331,
341
],
[
341,
342
],
[
342,
343
],
[
331,
344
],
[
344,
345
],
[
345,
346
],
[
346,
347
],
[
346,
348
],
[
345,
349
],
[
349,
350
],
[
326,
351
],
[
351,
352
],
[
324,
353
],
[
353,
354
],
[
134,
355
],
[
355,
356
],
[
355,
357
],
[
357,
358
],
[
358,
359
],
[
358,
360
],
[
360,
361
],
[
357,
362
],
[
362,
363
],
[
362,
364
],
[
357,
365
],
[
365,
366
],
[
365,
367
],
[
367,
368
],
[
368,
369
],
[
368,
370
],
[
370,
371
],
[
371,
372
],
[
370,
373
],
[
367,
374
],
[
374,
375
],
[
375,
376
],
[
376,
377
],
[
376,
378
],
[
375,
379
],
[
379,
380
],
[
379,
381
],
[
374,
382
],
[
367,
383
],
[
383,
384
],
[
383,
385
],
[
385,
386
],
[
386,
387
],
[
386,
388
],
[
385,
389
],
[
357,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
393,
394
],
[
391,
395
],
[
134,
396
],
[
0,
397
],
[
397,
398
],
[
397,
399
]
]
| [
"import java.io.*;\nimport java.util.*;\nimport static java.lang.System.out;\n\npublic class Main{\n static MyReader in = new MyReader();\n\n public static void main(String[] args){\n int X = in.i();\n int N = in.i();\n int[] p = in.ii(N);\n\n boolean[] b = new boolean[102];\n for (int i = 0; i < N; i++) {\n b[p[i]] = true;\n }\n\n int ans = X;\n if (b[X]) {\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }\n out.println(ans);\n }\n\n static class MyReader extends BufferedReader {\n char[] cbuf = new char[1024];\n int head = 0;\n int tail = 0;\n\n MyReader() {\n super(new InputStreamReader(System.in));\n }\n\n char next() {\n if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }\n return cbuf[head++];\n }\n\n void back() {\n head--;\n }\n\n boolean minus() {\n boolean minus;\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }\n }\n\n void skip() {\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }\n }\n\n char[] s(final int N) {\n skip();\n char[] s = new char[N];\n for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }\n return s;\n }\n\n int i() {\n boolean minus = minus();\n int n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n\n int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }\n\n long l() {\n boolean minus = minus();\n long n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import static java.lang.System.out;",
"import static java.lang.System.out;",
"import static java.lang.System.out;",
"public class Main{\n static MyReader in = new MyReader();\n\n public static void main(String[] args){\n int X = in.i();\n int N = in.i();\n int[] p = in.ii(N);\n\n boolean[] b = new boolean[102];\n for (int i = 0; i < N; i++) {\n b[p[i]] = true;\n }\n\n int ans = X;\n if (b[X]) {\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }\n out.println(ans);\n }\n\n static class MyReader extends BufferedReader {\n char[] cbuf = new char[1024];\n int head = 0;\n int tail = 0;\n\n MyReader() {\n super(new InputStreamReader(System.in));\n }\n\n char next() {\n if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }\n return cbuf[head++];\n }\n\n void back() {\n head--;\n }\n\n boolean minus() {\n boolean minus;\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }\n }\n\n void skip() {\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }\n }\n\n char[] s(final int N) {\n skip();\n char[] s = new char[N];\n for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }\n return s;\n }\n\n int i() {\n boolean minus = minus();\n int n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n\n int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }\n\n long l() {\n boolean minus = minus();\n long n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n }\n}",
"Main",
"static MyReader in = new MyReader();",
"in",
"new MyReader()",
"public static void main(String[] args){\n int X = in.i();\n int N = in.i();\n int[] p = in.ii(N);\n\n boolean[] b = new boolean[102];\n for (int i = 0; i < N; i++) {\n b[p[i]] = true;\n }\n\n int ans = X;\n if (b[X]) {\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }\n out.println(ans);\n }",
"main",
"{\n int X = in.i();\n int N = in.i();\n int[] p = in.ii(N);\n\n boolean[] b = new boolean[102];\n for (int i = 0; i < N; i++) {\n b[p[i]] = true;\n }\n\n int ans = X;\n if (b[X]) {\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }\n out.println(ans);\n }",
"int X = in.i();",
"X",
"in.i()",
"in.i",
"in",
"int N = in.i();",
"N",
"in.i()",
"in.i",
"in",
"int[] p = in.ii(N);",
"p",
"in.ii(N)",
"in.ii",
"in",
"N",
"boolean[] b = new boolean[102];",
"b",
"new boolean[102]",
"102",
"for (int i = 0; i < N; i++) {\n b[p[i]] = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n b[p[i]] = true;\n }",
"{\n b[p[i]] = true;\n }",
"b[p[i]] = true",
"b[p[i]]",
"b",
"p[i]",
"p",
"i",
"true",
"int ans = X;",
"ans",
"X",
"if (b[X]) {\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }",
"b[X]",
"b",
"X",
"{\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }",
"ans = 0",
"ans",
"0",
"for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }",
"int i = X - 1;",
"int i = X - 1;",
"i",
"X - 1",
"X",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n if (!b[i]) {\n ans = i;\n break;\n }\n }",
"{\n if (!b[i]) {\n ans = i;\n break;\n }\n }",
"if (!b[i]) {\n ans = i;\n break;\n }",
"!b[i]",
"b[i]",
"b",
"i",
"{\n ans = i;\n break;\n }",
"ans = i",
"ans",
"i",
"break;",
"for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }",
"int i = X + 1;",
"int i = X + 1;",
"i",
"X + 1",
"X",
"1",
"i < 102",
"i",
"102",
"i++",
"i++",
"i",
"{\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }",
"{\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }",
"if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }",
"!b[i]",
"b[i]",
"b",
"i",
"{\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }",
"if (i - X < X - ans) {\n ans = i;\n }",
"i - X < X - ans",
"i - X",
"i",
"X",
"X - ans",
"X",
"ans",
"{\n ans = i;\n }",
"ans = i",
"ans",
"i",
"break;",
"out.println(ans)",
"out.println",
"out",
"ans",
"String[] args",
"args",
"static class MyReader extends BufferedReader {\n char[] cbuf = new char[1024];\n int head = 0;\n int tail = 0;\n\n MyReader() {\n super(new InputStreamReader(System.in));\n }\n\n char next() {\n if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }\n return cbuf[head++];\n }\n\n void back() {\n head--;\n }\n\n boolean minus() {\n boolean minus;\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }\n }\n\n void skip() {\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }\n }\n\n char[] s(final int N) {\n skip();\n char[] s = new char[N];\n for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }\n return s;\n }\n\n int i() {\n boolean minus = minus();\n int n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n\n int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }\n\n long l() {\n boolean minus = minus();\n long n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n }",
"MyReader",
"char[] cbuf = new char[1024];",
"cbuf",
"new char[1024]",
"1024",
"int head = 0;",
"head",
"0",
"int tail = 0;",
"tail",
"0",
"MyReader() {\n super(new InputStreamReader(System.in));\n }",
"MyReader",
"{\n super(new InputStreamReader(System.in));\n }",
"super(new InputStreamReader(System.in))",
"super",
"new InputStreamReader(System.in)",
"char next() {\n if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }\n return cbuf[head++];\n }",
"next",
"{\n if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }\n return cbuf[head++];\n }",
"if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }",
"head == tail",
"head",
"tail",
"{\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }",
"try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}",
"catch (IOException e) {}",
"IOException e",
"{}",
"{\n tail = read(cbuf, 0, cbuf.length);\n }",
"tail = read(cbuf, 0, cbuf.length)",
"tail",
"read(cbuf, 0, cbuf.length)",
"read",
"cbuf",
"0",
"cbuf.length",
"cbuf",
"cbuf.length",
"head = 0",
"head",
"0",
"return cbuf[head++];",
"cbuf[head++]",
"cbuf",
"head++",
"head",
"void back() {\n head--;\n }",
"back",
"{\n head--;\n }",
"head--",
"head",
"boolean minus() {\n boolean minus;\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }\n }",
"minus",
"{\n boolean minus;\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }\n }",
"boolean minus;",
"minus",
"while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }",
"true",
"{\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }",
"char c = next();",
"c",
"next()",
"next",
"if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }",
"c != ' ' && c != '\\n' && c != '\\r'",
"c != ' ' && c != '\\n' && c != '\\r'",
"c != ' '",
"c",
"' '",
"c != '\\n'",
"c",
"'\\n'",
"c != '\\r'",
"c",
"'\\r'",
"{\n if (!(minus = c == '-')) back();\n return minus;\n }",
"if (!(minus = c == '-')) back();",
"!(minus = c == '-')",
"(minus = c == '-')",
"minus",
"c == '-'",
"c",
"'-'",
"back()",
"back",
"return minus;",
"minus",
"void skip() {\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }\n }",
"skip",
"{\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }\n }",
"while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }",
"true",
"{\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }",
"char c = next();",
"c",
"next()",
"next",
"if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }",
"c != ' ' && c != '\\n' && c != '\\r'",
"c != ' ' && c != '\\n' && c != '\\r'",
"c != ' '",
"c",
"' '",
"c != '\\n'",
"c",
"'\\n'",
"c != '\\r'",
"c",
"'\\r'",
"{\n back();\n break;\n }",
"back()",
"back",
"break;",
"char[] s(final int N) {\n skip();\n char[] s = new char[N];\n for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }\n return s;\n }",
"s",
"{\n skip();\n char[] s = new char[N];\n for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }\n return s;\n }",
"skip()",
"skip",
"char[] s = new char[N];",
"s",
"new char[N]",
"N",
"for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < s.length",
"i",
"s.length",
"s",
"s.length",
"i++",
"i++",
"i",
"{\n s[i] = next();\n }",
"{\n s[i] = next();\n }",
"s[i] = next()",
"s[i]",
"s",
"i",
"next()",
"next",
"return s;",
"s",
"final int N",
"N",
"int i() {\n boolean minus = minus();\n int n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }",
"i",
"{\n boolean minus = minus();\n int n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }",
"boolean minus = minus();",
"minus",
"minus()",
"minus",
"int n = 0;",
"n",
"0",
"while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }",
"true",
"{\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }",
"int k = next() - '0';",
"k",
"next() - '0'",
"next()",
"next",
"'0'",
"if (k < 0 || 9 < k) break;",
"k < 0 || 9 < k",
"k < 0",
"k",
"0",
"9 < k",
"9",
"k",
"break;",
"n = 10 * n + k",
"n",
"10 * n + k",
"10 * n",
"10",
"n",
"k",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }",
"ii",
"{\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }",
"int[] a = new int[N];",
"a",
"new int[N]",
"N",
"for (int j = 0; j < a.length; j++) a[j] = i();",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < a.length",
"j",
"a.length",
"a",
"a.length",
"j++",
"j++",
"j",
"a[j] = i();",
"a[j] = i()",
"a[j]",
"a",
"j",
"i()",
"i",
"return a;",
"a",
"final int N",
"N",
"long l() {\n boolean minus = minus();\n long n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }",
"l",
"{\n boolean minus = minus();\n long n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }",
"boolean minus = minus();",
"minus",
"minus()",
"minus",
"long n = 0;",
"n",
"0",
"while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }",
"true",
"{\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }",
"int k = next() - '0';",
"k",
"next() - '0'",
"next()",
"next",
"'0'",
"if (k < 0 || 9 < k) break;",
"k < 0 || 9 < k",
"k < 0",
"k",
"0",
"9 < k",
"9",
"k",
"break;",
"n = 10 * n + k",
"n",
"10 * n + k",
"10 * n",
"10",
"n",
"k",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"BufferedReader",
"public class Main{\n static MyReader in = new MyReader();\n\n public static void main(String[] args){\n int X = in.i();\n int N = in.i();\n int[] p = in.ii(N);\n\n boolean[] b = new boolean[102];\n for (int i = 0; i < N; i++) {\n b[p[i]] = true;\n }\n\n int ans = X;\n if (b[X]) {\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }\n out.println(ans);\n }\n\n static class MyReader extends BufferedReader {\n char[] cbuf = new char[1024];\n int head = 0;\n int tail = 0;\n\n MyReader() {\n super(new InputStreamReader(System.in));\n }\n\n char next() {\n if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }\n return cbuf[head++];\n }\n\n void back() {\n head--;\n }\n\n boolean minus() {\n boolean minus;\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }\n }\n\n void skip() {\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }\n }\n\n char[] s(final int N) {\n skip();\n char[] s = new char[N];\n for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }\n return s;\n }\n\n int i() {\n boolean minus = minus();\n int n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n\n int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }\n\n long l() {\n boolean minus = minus();\n long n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n }\n}",
"public class Main{\n static MyReader in = new MyReader();\n\n public static void main(String[] args){\n int X = in.i();\n int N = in.i();\n int[] p = in.ii(N);\n\n boolean[] b = new boolean[102];\n for (int i = 0; i < N; i++) {\n b[p[i]] = true;\n }\n\n int ans = X;\n if (b[X]) {\n ans = 0;\n for (int i = X - 1; i > 0; i--) {\n if (!b[i]) {\n ans = i;\n break;\n }\n }\n for (int i = X + 1; i < 102; i++) {\n if (!b[i]) {\n if (i - X < X - ans) {\n ans = i;\n }\n break;\n }\n }\n }\n out.println(ans);\n }\n\n static class MyReader extends BufferedReader {\n char[] cbuf = new char[1024];\n int head = 0;\n int tail = 0;\n\n MyReader() {\n super(new InputStreamReader(System.in));\n }\n\n char next() {\n if (head == tail) {\n try {\n tail = read(cbuf, 0, cbuf.length);\n } catch (IOException e) {}\n head = 0;\n }\n return cbuf[head++];\n }\n\n void back() {\n head--;\n }\n\n boolean minus() {\n boolean minus;\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n if (!(minus = c == '-')) back();\n return minus;\n }\n }\n }\n\n void skip() {\n while (true) {\n char c = next();\n if (c != ' ' && c != '\\n' && c != '\\r') {\n back();\n break;\n }\n }\n }\n\n char[] s(final int N) {\n skip();\n char[] s = new char[N];\n for (int i = 0; i < s.length; i++) {\n s[i] = next();\n }\n return s;\n }\n\n int i() {\n boolean minus = minus();\n int n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n\n int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }\n\n long l() {\n boolean minus = minus();\n long n = 0;\n while (true) {\n int k = next() - '0';\n if (k < 0 || 9 < k) break;\n n = 10 * n + k;\n }\n return minus ? -n : n;\n }\n }\n}",
"Main"
]
| import java.io.*;
import java.util.*;
import static java.lang.System.out;
public class Main{
static MyReader in = new MyReader();
public static void main(String[] args){
int X = in.i();
int N = in.i();
int[] p = in.ii(N);
boolean[] b = new boolean[102];
for (int i = 0; i < N; i++) {
b[p[i]] = true;
}
int ans = X;
if (b[X]) {
ans = 0;
for (int i = X - 1; i > 0; i--) {
if (!b[i]) {
ans = i;
break;
}
}
for (int i = X + 1; i < 102; i++) {
if (!b[i]) {
if (i - X < X - ans) {
ans = i;
}
break;
}
}
}
out.println(ans);
}
static class MyReader extends BufferedReader {
char[] cbuf = new char[1024];
int head = 0;
int tail = 0;
MyReader() {
super(new InputStreamReader(System.in));
}
char next() {
if (head == tail) {
try {
tail = read(cbuf, 0, cbuf.length);
} catch (IOException e) {}
head = 0;
}
return cbuf[head++];
}
void back() {
head--;
}
boolean minus() {
boolean minus;
while (true) {
char c = next();
if (c != ' ' && c != '\n' && c != '\r') {
if (!(minus = c == '-')) back();
return minus;
}
}
}
void skip() {
while (true) {
char c = next();
if (c != ' ' && c != '\n' && c != '\r') {
back();
break;
}
}
}
char[] s(final int N) {
skip();
char[] s = new char[N];
for (int i = 0; i < s.length; i++) {
s[i] = next();
}
return s;
}
int i() {
boolean minus = minus();
int n = 0;
while (true) {
int k = next() - '0';
if (k < 0 || 9 < k) break;
n = 10 * n + k;
}
return minus ? -n : n;
}
int[] ii(final int N) {
int[] a = new int[N];
for (int j = 0; j < a.length; j++) a[j] = i();
return a;
}
long l() {
boolean minus = minus();
long n = 0;
while (true) {
int k = next() - '0';
if (k < 0 || 9 < k) break;
n = 10 * n + k;
}
return minus ? -n : n;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
14,
40,
4,
18,
4,
18,
13,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
0,
13,
17,
14,
40,
4,
18,
4,
18,
13,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
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
],
[
119,
8
],
[
119,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
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
],
[
11,
49
],
[
49,
50
],
[
49,
51
],
[
11,
52
],
[
52,
53
],
[
52,
54
],
[
11,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
55,
65
],
[
65,
66
],
[
66,
67
],
[
55,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
72,
78
],
[
78,
79
],
[
78,
80
],
[
70,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
87,
89
],
[
70,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
92,
98
],
[
98,
99
],
[
98,
100
],
[
90,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
107,
109
],
[
11,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
9,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
]
| [
"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\t\tint X\t\t\t= sc.nextInt();\n\t\tint N\t\t\t= sc.nextInt();\n\t\tInteger nList[]\t= new Integer[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}\n\t\tint ans\t\t\t= X;\n\t\tBoolean flag\t= true;\n\t\tfor (int i = 0; i <= X && flag; i++) {\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\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\t\tint X\t\t\t= sc.nextInt();\n\t\tint N\t\t\t= sc.nextInt();\n\t\tInteger nList[]\t= new Integer[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}\n\t\tint ans\t\t\t= X;\n\t\tBoolean flag\t= true;\n\t\tfor (int i = 0; i <= X && flag; i++) {\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\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 X\t\t\t= sc.nextInt();\n\t\tint N\t\t\t= sc.nextInt();\n\t\tInteger nList[]\t= new Integer[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}\n\t\tint ans\t\t\t= X;\n\t\tBoolean flag\t= true;\n\t\tfor (int i = 0; i <= X && flag; i++) {\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\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 X\t\t\t= sc.nextInt();\n\t\tint N\t\t\t= sc.nextInt();\n\t\tInteger nList[]\t= new Integer[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}\n\t\tint ans\t\t\t= X;\n\t\tBoolean flag\t= true;\n\t\tfor (int i = 0; i <= X && flag; i++) {\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\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 X\t\t\t= sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N\t\t\t= sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Integer nList[]\t= new Integer[N];",
"nList",
"new Integer[N]",
"N",
"for(int i = 0; i < N; i++) {\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}",
"{\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}",
"nList[i]\t= sc.nextInt()",
"nList[i]",
"nList",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans\t\t\t= X;",
"ans",
"X",
"Boolean flag\t= true;",
"flag",
"true",
"for (int i = 0; i <= X && flag; i++) {\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= X && flag",
"i <= X",
"i",
"X",
"flag",
"i++",
"i++",
"i",
"{\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}",
"if(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}",
"!(Arrays.asList(nList).contains(X-i))",
"(Arrays.asList(nList).contains(X-i))",
"Arrays.asList(nList).contains",
"Arrays.asList(nList)",
"Arrays.asList",
"Arrays",
"nList",
"X-i",
"X",
"i",
"{\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}",
"ans = X-i",
"ans",
"X-i",
"X",
"i",
"flag = false",
"flag",
"false",
"if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}",
"!(Arrays.asList(nList).contains(X+i))",
"(Arrays.asList(nList).contains(X+i))",
"Arrays.asList(nList).contains",
"Arrays.asList(nList)",
"Arrays.asList",
"Arrays",
"nList",
"X+i",
"X",
"i",
"{\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}",
"ans =X+i",
"ans",
"X+i",
"X",
"i",
"flag = false",
"flag",
"false",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X\t\t\t= sc.nextInt();\n\t\tint N\t\t\t= sc.nextInt();\n\t\tInteger nList[]\t= new Integer[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}\n\t\tint ans\t\t\t= X;\n\t\tBoolean flag\t= true;\n\t\tfor (int i = 0; i <= X && flag; i++) {\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X\t\t\t= sc.nextInt();\n\t\tint N\t\t\t= sc.nextInt();\n\t\tInteger nList[]\t= new Integer[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnList[i]\t= sc.nextInt();\n\t\t}\n\t\tint ans\t\t\t= X;\n\t\tBoolean flag\t= true;\n\t\tfor (int i = 0; i <= X && flag; i++) {\n\t\t\tif(!(Arrays.asList(nList).contains(X-i))) {\n\t\t\t\tans = X-i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t\telse if(!(Arrays.asList(nList).contains(X+i))) {\n\t\t\t\tans =X+i;\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\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 X = sc.nextInt();
int N = sc.nextInt();
Integer nList[] = new Integer[N];
for(int i = 0; i < N; i++) {
nList[i] = sc.nextInt();
}
int ans = X;
Boolean flag = true;
for (int i = 0; i <= X && flag; i++) {
if(!(Arrays.asList(nList).contains(X-i))) {
ans = X-i;
flag = false;
}
else if(!(Arrays.asList(nList).contains(X+i))) {
ans =X+i;
flag = false;
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
13,
41,
13,
17,
42,
17,
30,
41,
13,
2,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
0,
13,
13,
3,
0,
13,
2,
13,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
2,
13,
17,
30,
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
],
[
148,
5
],
[
148,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
54,
60
],
[
60,
61
],
[
60,
62
],
[
54,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
63,
74
],
[
75,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
54,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
54,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
54,
101
],
[
101,
102
],
[
101,
103
],
[
54,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
116,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
54,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
54,
137
],
[
137,
138
],
[
8,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
6,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
]
| [
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n\n Scanner scanner = new Scanner(System.in);\n\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n int p[] = new int[N];\n for(int loop=0; loop<N; loop++) {\n p[loop] = scanner.nextInt();\n }\n\n int sol = X;\n int dis = 0;\n while(true) {\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }\n\n System.out.println( sol );\n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n\n Scanner scanner = new Scanner(System.in);\n\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n int p[] = new int[N];\n for(int loop=0; loop<N; loop++) {\n p[loop] = scanner.nextInt();\n }\n\n int sol = X;\n int dis = 0;\n while(true) {\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }\n\n System.out.println( sol );\n\n }\n}",
"Main",
"public static void main(String[] args){\n\n Scanner scanner = new Scanner(System.in);\n\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n int p[] = new int[N];\n for(int loop=0; loop<N; loop++) {\n p[loop] = scanner.nextInt();\n }\n\n int sol = X;\n int dis = 0;\n while(true) {\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }\n\n System.out.println( sol );\n\n }",
"main",
"{\n\n Scanner scanner = new Scanner(System.in);\n\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n int p[] = new int[N];\n for(int loop=0; loop<N; loop++) {\n p[loop] = scanner.nextInt();\n }\n\n int sol = X;\n int dis = 0;\n while(true) {\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }\n\n System.out.println( sol );\n\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int X = scanner.nextInt();",
"X",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int p[] = new int[N];",
"p",
"new int[N]",
"N",
"for(int loop=0; loop<N; loop++) {\n p[loop] = scanner.nextInt();\n }",
"int loop=0;",
"int loop=0;",
"loop",
"0",
"loop<N",
"loop",
"N",
"loop++",
"loop++",
"loop",
"{\n p[loop] = scanner.nextInt();\n }",
"{\n p[loop] = scanner.nextInt();\n }",
"p[loop] = scanner.nextInt()",
"p[loop]",
"p",
"loop",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int sol = X;",
"sol",
"X",
"int dis = 0;",
"dis",
"0",
"while(true) {\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }",
"true",
"{\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }",
"int ans = sol - dis;",
"ans",
"sol - dis",
"sol",
"dis",
"boolean exist = false;",
"exist",
"false",
"for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }",
"int loop=0;",
"int loop=0;",
"loop",
"0",
"loop<N",
"loop",
"N",
"loop++",
"loop++",
"loop",
"{\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }",
"{\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }",
"if( ans == p[loop] ){\n exist = true;\n break;\n }",
"ans == p[loop]",
"ans",
"p[loop]",
"p",
"loop",
"{\n exist = true;\n break;\n }",
"exist = true",
"exist",
"true",
"break;",
"if( exist == false ) {\n sol = ans;\n break;\n }",
"exist == false",
"exist",
"false",
"{\n sol = ans;\n break;\n }",
"sol = ans",
"sol",
"ans",
"break;",
"ans = sol + dis",
"ans",
"sol + dis",
"sol",
"dis",
"exist = false",
"exist",
"false",
"for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }",
"int loop=0;",
"int loop=0;",
"loop",
"0",
"loop<N",
"loop",
"N",
"loop++",
"loop++",
"loop",
"{\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }",
"{\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }",
"if( ans == p[loop] ){\n exist = true;\n break;\n }",
"ans == p[loop]",
"ans",
"p[loop]",
"p",
"loop",
"{\n exist = true;\n break;\n }",
"exist = true",
"exist",
"true",
"break;",
"if( exist == false ) {\n sol = ans;\n break;\n }",
"exist == false",
"exist",
"false",
"{\n sol = ans;\n break;\n }",
"sol = ans",
"sol",
"ans",
"break;",
"dis++",
"dis",
"System.out.println( sol )",
"System.out.println",
"System.out",
"System",
"System.out",
"sol",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n\n Scanner scanner = new Scanner(System.in);\n\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n int p[] = new int[N];\n for(int loop=0; loop<N; loop++) {\n p[loop] = scanner.nextInt();\n }\n\n int sol = X;\n int dis = 0;\n while(true) {\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }\n\n System.out.println( sol );\n\n }\n}",
"public class Main{\n public static void main(String[] args){\n\n Scanner scanner = new Scanner(System.in);\n\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n int p[] = new int[N];\n for(int loop=0; loop<N; loop++) {\n p[loop] = scanner.nextInt();\n }\n\n int sol = X;\n int dis = 0;\n while(true) {\n\n int ans = sol - dis;\n\n boolean exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n ans = sol + dis;\n\n exist = false;\n for(int loop=0; loop<N; loop++) {\n if( ans == p[loop] ){\n exist = true;\n break;\n }\n }\n if( exist == false ) {\n sol = ans;\n break;\n }\n\n dis++;\n }\n\n System.out.println( sol );\n\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int X = scanner.nextInt();
int N = scanner.nextInt();
int p[] = new int[N];
for(int loop=0; loop<N; loop++) {
p[loop] = scanner.nextInt();
}
int sol = X;
int dis = 0;
while(true) {
int ans = sol - dis;
boolean exist = false;
for(int loop=0; loop<N; loop++) {
if( ans == p[loop] ){
exist = true;
break;
}
}
if( exist == false ) {
sol = ans;
break;
}
ans = sol + dis;
exist = false;
for(int loop=0; loop<N; loop++) {
if( ans == p[loop] ){
exist = true;
break;
}
}
if( exist == false ) {
sol = ans;
break;
}
dis++;
}
System.out.println( sol );
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
9,
14,
2,
2,
13,
13,
4,
18,
13,
2,
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
],
[
97,
5
],
[
97,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
8,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
45,
51
],
[
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
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
65,
71
],
[
71,
72
],
[
64,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
81,
83
],
[
73,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
8,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
6,
94
],
[
94,
95
],
[
0,
96
],
[
96,
97
],
[
96,
98
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tint[] ps = new int[102];\n\t\tint nearest = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 102; i++) {\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(nearest);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tint[] ps = new int[102];\n\t\tint nearest = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 102; i++) {\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(nearest);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tint[] ps = new int[102];\n\t\tint nearest = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 102; i++) {\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(nearest);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tint[] ps = new int[102];\n\t\tint nearest = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 102; i++) {\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(nearest);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int[] ps = new int[102];",
"ps",
"new int[102]",
"102",
"int nearest = 0;",
"nearest",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}",
"{\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}",
"ps[sc.nextInt()] = 1",
"ps[sc.nextInt()]",
"ps",
"sc.nextInt()",
"sc.nextInt",
"sc",
"1",
"for (int i = 0; i < 102; i++) {\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 102",
"i",
"102",
"i++",
"i++",
"i",
"{\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}",
"if (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}",
"ps[i] == 1",
"ps[i]",
"ps",
"i",
"1",
"{\n\t\t\t\tcontinue;\n\t\t\t}",
"continue;",
"if (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}",
"x - nearest > Math.abs(x - i)",
"x - nearest",
"x",
"nearest",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"{\n\t\t\t\tnearest = i;\n\t\t\t}",
"nearest = i",
"nearest",
"i",
"System.out.println(nearest)",
"System.out.println",
"System.out",
"System",
"System.out",
"nearest",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tint[] ps = new int[102];\n\t\tint nearest = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 102; i++) {\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(nearest);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tint[] ps = new int[102];\n\t\tint nearest = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tps[sc.nextInt()] = 1;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 102; i++) {\n\t\t\tif (ps[i] == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (x - nearest > Math.abs(x - i)) {\n\t\t\t\tnearest = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(nearest);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
sc.nextLine();
int[] ps = new int[102];
int nearest = 0;
for (int i = 0; i < n; i++) {
ps[sc.nextInt()] = 1;
}
for (int i = 0; i < 102; i++) {
if (ps[i] == 1) {
continue;
}
if (x - nearest > Math.abs(x - i)) {
nearest = i;
}
}
System.out.println(nearest);
}
}
|
[
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,
4,
18,
13,
41,
13,
20,
41,
13,
18,
13,
13,
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,
4,
18,
13,
18,
13,
13,
17,
0,
13,
4,
18,
13,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
13,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
14,
2,
2,
13,
17,
13,
30,
29,
2,
13,
17,
30,
29,
2,
13,
17,
14,
2,
13,
13,
30,
14,
2,
2,
13,
17,
13,
30,
29,
2,
13,
17,
30,
29,
2,
13,
17,
41,
13,
20,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
14,
2,
4,
18,
13,
17,
30,
14,
2,
4,
18,
13,
2,
2,
13,
17,
13,
4,
18,
13,
2,
2,
13,
17,
13,
30,
29,
2,
13,
17,
30,
29,
2,
13,
17,
41,
13,
18,
13,
13,
41,
13,
17,
4,
18,
13,
13,
42,
2,
4,
18,
13,
17,
30,
41,
13,
4,
18,
13,
17,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
4,
18,
13,
17,
29,
13,
23,
13,
23,
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
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
33,
35
],
[
14,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
14,
41
],
[
41,
42
],
[
41,
43
],
[
14,
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
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
68,
70
],
[
65,
71
],
[
57,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
74,
78
],
[
78,
79
],
[
78,
80
],
[
57,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
14,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
90,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
106,
108
],
[
106,
109
],
[
106,
110
],
[
106,
111
],
[
106,
112
],
[
106,
113
],
[
12,
114
],
[
114,
115
],
[
10,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
124,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
124,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
118,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
145,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
145,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
118,
161
],
[
161,
162
],
[
161,
163
],
[
118,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
164,
172
],
[
172,
173
],
[
173,
174
],
[
164,
175
],
[
176,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
179,
182
],
[
177,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
118,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
189,
193
],
[
188,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
197,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
196,
205
],
[
205,
206
],
[
206,
207
],
[
205,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
195,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
195,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
118,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
225,
227
],
[
118,
228
],
[
228,
229
],
[
228,
230
],
[
118,
231
],
[
231,
232
],
[
232,
233
],
[
231,
234
],
[
118,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
236,
240
],
[
235,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
244,
247
],
[
241,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
250,
253
],
[
253,
254
],
[
253,
255
],
[
241,
256
],
[
256,
257
],
[
257,
258
],
[
257,
259
],
[
256,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
260,
264
],
[
264,
265
],
[
264,
266
],
[
241,
267
],
[
267,
268
],
[
268,
269
],
[
267,
270
],
[
118,
271
],
[
271,
272
],
[
116,
273
],
[
273,
274
],
[
116,
275
],
[
275,
276
],
[
116,
277
],
[
277,
278
],
[
116,
279
],
[
279,
280
],
[
116,
281
],
[
281,
282
],
[
116,
283
],
[
283,
284
]
]
| [
"import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\nclass Main {\npublic static void main (String[] args) {\nScanner scn= new Scanner(System.in);\n\t\t\n int x=scn.nextInt();\n int n=scn.nextInt();\n HashMap<Integer,Integer> map=new HashMap<> ();\n int min=Integer.MAX_VALUE;\n int max=Integer.MIN_VALUE;\n\t\t int a[]= new int[n];\n\t\t for(int i=0; i<n; i++){\n a[i]=scn.nextInt();\n map.put(a[i],1);\n min=Math.min(min,a[i]);\n max=Math.max(max,a[i]);\n }\n if(n==0){\n System.out.println(x);\n } else \n\t\t System.out.println(some(a,x,n,map,min,max));\n\t\t\n\t}\n\tpublic static int some(int a[],int x, int n,HashMap<Integer,Integer> map, int min, int max){\n // if(x<=min) return min-1;\n // if(x>=max) return max+1; \n if(x<min){\n if((x-1)<=min){\n return x-1;\n } else {\n return x+1;\n } \n }\n if(x>max){\n if((x-1)>max){\n return x-1;\n } else {\n return x+1;\n }\n }\n ArrayList<Integer> al=new ArrayList<> ();\n for(int i=min; i<=max; i++){\n if(!map.containsKey(i)){\n al.add(i);\n }\n }\n if(al.size()==0){\n if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){\n return max+1;\n } else {\n return min-1;\n }\n }\n int mans=Integer.MAX_VALUE;\n int ans=0;\n Collections.sort(al);\n while(al.size()!=0){\n int p=al.get(0);\n int temp=Math.abs(x-p);\n if(temp<mans){\n mans=temp;\n ans=p;\n } \n al.remove(0);\n }\n return ans;\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main {\npublic static void main (String[] args) {\nScanner scn= new Scanner(System.in);\n\t\t\n int x=scn.nextInt();\n int n=scn.nextInt();\n HashMap<Integer,Integer> map=new HashMap<> ();\n int min=Integer.MAX_VALUE;\n int max=Integer.MIN_VALUE;\n\t\t int a[]= new int[n];\n\t\t for(int i=0; i<n; i++){\n a[i]=scn.nextInt();\n map.put(a[i],1);\n min=Math.min(min,a[i]);\n max=Math.max(max,a[i]);\n }\n if(n==0){\n System.out.println(x);\n } else \n\t\t System.out.println(some(a,x,n,map,min,max));\n\t\t\n\t}\n\tpublic static int some(int a[],int x, int n,HashMap<Integer,Integer> map, int min, int max){\n // if(x<=min) return min-1;\n // if(x>=max) return max+1; \n if(x<min){\n if((x-1)<=min){\n return x-1;\n } else {\n return x+1;\n } \n }\n if(x>max){\n if((x-1)>max){\n return x-1;\n } else {\n return x+1;\n }\n }\n ArrayList<Integer> al=new ArrayList<> ();\n for(int i=min; i<=max; i++){\n if(!map.containsKey(i)){\n al.add(i);\n }\n }\n if(al.size()==0){\n if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){\n return max+1;\n } else {\n return min-1;\n }\n }\n int mans=Integer.MAX_VALUE;\n int ans=0;\n Collections.sort(al);\n while(al.size()!=0){\n int p=al.get(0);\n int temp=Math.abs(x-p);\n if(temp<mans){\n mans=temp;\n ans=p;\n } \n al.remove(0);\n }\n return ans;\n\t}\n}",
"Main",
"public static void main (String[] args) {\nScanner scn= new Scanner(System.in);\n\t\t\n int x=scn.nextInt();\n int n=scn.nextInt();\n HashMap<Integer,Integer> map=new HashMap<> ();\n int min=Integer.MAX_VALUE;\n int max=Integer.MIN_VALUE;\n\t\t int a[]= new int[n];\n\t\t for(int i=0; i<n; i++){\n a[i]=scn.nextInt();\n map.put(a[i],1);\n min=Math.min(min,a[i]);\n max=Math.max(max,a[i]);\n }\n if(n==0){\n System.out.println(x);\n } else \n\t\t System.out.println(some(a,x,n,map,min,max));\n\t\t\n\t}",
"main",
"{\nScanner scn= new Scanner(System.in);\n\t\t\n int x=scn.nextInt();\n int n=scn.nextInt();\n HashMap<Integer,Integer> map=new HashMap<> ();\n int min=Integer.MAX_VALUE;\n int max=Integer.MIN_VALUE;\n\t\t int a[]= new int[n];\n\t\t for(int i=0; i<n; i++){\n a[i]=scn.nextInt();\n map.put(a[i],1);\n min=Math.min(min,a[i]);\n max=Math.max(max,a[i]);\n }\n if(n==0){\n System.out.println(x);\n } else \n\t\t System.out.println(some(a,x,n,map,min,max));\n\t\t\n\t}",
"Scanner scn= new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int x=scn.nextInt();",
"x",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int n=scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"HashMap<Integer,Integer> map=new HashMap<> ();",
"map",
"new HashMap<> ()",
"int min=Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int max=Integer.MIN_VALUE;",
"max",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"int a[]= new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0; i<n; i++){\n a[i]=scn.nextInt();\n map.put(a[i],1);\n min=Math.min(min,a[i]);\n max=Math.max(max,a[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]=scn.nextInt();\n map.put(a[i],1);\n min=Math.min(min,a[i]);\n max=Math.max(max,a[i]);\n }",
"{\n a[i]=scn.nextInt();\n map.put(a[i],1);\n min=Math.min(min,a[i]);\n max=Math.max(max,a[i]);\n }",
"a[i]=scn.nextInt()",
"a[i]",
"a",
"i",
"scn.nextInt()",
"scn.nextInt",
"scn",
"map.put(a[i],1)",
"map.put",
"map",
"a[i]",
"a",
"i",
"1",
"min=Math.min(min,a[i])",
"min",
"Math.min(min,a[i])",
"Math.min",
"Math",
"min",
"a[i]",
"a",
"i",
"max=Math.max(max,a[i])",
"max",
"Math.max(max,a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"if(n==0){\n System.out.println(x);\n } else \n\t\t System.out.println(some(a,x,n,map,min,max));",
"n==0",
"n",
"0",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"System.out.println(some(a,x,n,map,min,max))",
"System.out.println",
"System.out",
"System",
"System.out",
"some(a,x,n,map,min,max)",
"some",
"a",
"x",
"n",
"map",
"min",
"max",
"String[] args",
"args",
"public static int some(int a[],int x, int n,HashMap<Integer,Integer> map, int min, int max){\n // if(x<=min) return min-1;\n // if(x>=max) return max+1; \n if(x<min){\n if((x-1)<=min){\n return x-1;\n } else {\n return x+1;\n } \n }\n if(x>max){\n if((x-1)>max){\n return x-1;\n } else {\n return x+1;\n }\n }\n ArrayList<Integer> al=new ArrayList<> ();\n for(int i=min; i<=max; i++){\n if(!map.containsKey(i)){\n al.add(i);\n }\n }\n if(al.size()==0){\n if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){\n return max+1;\n } else {\n return min-1;\n }\n }\n int mans=Integer.MAX_VALUE;\n int ans=0;\n Collections.sort(al);\n while(al.size()!=0){\n int p=al.get(0);\n int temp=Math.abs(x-p);\n if(temp<mans){\n mans=temp;\n ans=p;\n } \n al.remove(0);\n }\n return ans;\n\t}",
"some",
"{\n // if(x<=min) return min-1;\n // if(x>=max) return max+1; \n if(x<min){\n if((x-1)<=min){\n return x-1;\n } else {\n return x+1;\n } \n }\n if(x>max){\n if((x-1)>max){\n return x-1;\n } else {\n return x+1;\n }\n }\n ArrayList<Integer> al=new ArrayList<> ();\n for(int i=min; i<=max; i++){\n if(!map.containsKey(i)){\n al.add(i);\n }\n }\n if(al.size()==0){\n if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){\n return max+1;\n } else {\n return min-1;\n }\n }\n int mans=Integer.MAX_VALUE;\n int ans=0;\n Collections.sort(al);\n while(al.size()!=0){\n int p=al.get(0);\n int temp=Math.abs(x-p);\n if(temp<mans){\n mans=temp;\n ans=p;\n } \n al.remove(0);\n }\n return ans;\n\t}",
"if(x<min){\n if((x-1)<=min){\n return x-1;\n } else {\n return x+1;\n } \n }",
"x<min",
"x",
"min",
"{\n if((x-1)<=min){\n return x-1;\n } else {\n return x+1;\n } \n }",
"if((x-1)<=min){\n return x-1;\n } else {\n return x+1;\n }",
"(x-1)<=min",
"(x-1)",
"x",
"1",
"min",
"{\n return x-1;\n }",
"return x-1;",
"x-1",
"x",
"1",
"{\n return x+1;\n }",
"return x+1;",
"x+1",
"x",
"1",
"if(x>max){\n if((x-1)>max){\n return x-1;\n } else {\n return x+1;\n }\n }",
"x>max",
"x",
"max",
"{\n if((x-1)>max){\n return x-1;\n } else {\n return x+1;\n }\n }",
"if((x-1)>max){\n return x-1;\n } else {\n return x+1;\n }",
"(x-1)>max",
"(x-1)",
"x",
"1",
"max",
"{\n return x-1;\n }",
"return x-1;",
"x-1",
"x",
"1",
"{\n return x+1;\n }",
"return x+1;",
"x+1",
"x",
"1",
"ArrayList<Integer> al=new ArrayList<> ();",
"al",
"new ArrayList<> ()",
"for(int i=min; i<=max; i++){\n if(!map.containsKey(i)){\n al.add(i);\n }\n }",
"int i=min;",
"int i=min;",
"i",
"min",
"i<=max",
"i",
"max",
"i++",
"i++",
"i",
"{\n if(!map.containsKey(i)){\n al.add(i);\n }\n }",
"{\n if(!map.containsKey(i)){\n al.add(i);\n }\n }",
"if(!map.containsKey(i)){\n al.add(i);\n }",
"!map.containsKey(i)",
"map.containsKey(i)",
"map.containsKey",
"map",
"i",
"{\n al.add(i);\n }",
"al.add(i)",
"al.add",
"al",
"i",
"if(al.size()==0){\n if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){\n return max+1;\n } else {\n return min-1;\n }\n }",
"al.size()==0",
"al.size()",
"al.size",
"al",
"0",
"{\n if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){\n return max+1;\n } else {\n return min-1;\n }\n }",
"if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){\n return max+1;\n } else {\n return min-1;\n }",
"Math.abs((min-1)-x)>Math.abs((max+1)-x)",
"Math.abs((min-1)-x)",
"Math.abs",
"Math",
"(min-1)-x",
"(min-1)",
"min",
"1",
"x",
"Math.abs((max+1)-x)",
"Math.abs",
"Math",
"(max+1)-x",
"(max+1)",
"max",
"1",
"x",
"{\n return max+1;\n }",
"return max+1;",
"max+1",
"max",
"1",
"{\n return min-1;\n }",
"return min-1;",
"min-1",
"min",
"1",
"int mans=Integer.MAX_VALUE;",
"mans",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int ans=0;",
"ans",
"0",
"Collections.sort(al)",
"Collections.sort",
"Collections",
"al",
"while(al.size()!=0){\n int p=al.get(0);\n int temp=Math.abs(x-p);\n if(temp<mans){\n mans=temp;\n ans=p;\n } \n al.remove(0);\n }",
"al.size()!=0",
"al.size()",
"al.size",
"al",
"0",
"{\n int p=al.get(0);\n int temp=Math.abs(x-p);\n if(temp<mans){\n mans=temp;\n ans=p;\n } \n al.remove(0);\n }",
"int p=al.get(0);",
"p",
"al.get(0)",
"al.get",
"al",
"0",
"int temp=Math.abs(x-p);",
"temp",
"Math.abs(x-p)",
"Math.abs",
"Math",
"x-p",
"x",
"p",
"if(temp<mans){\n mans=temp;\n ans=p;\n }",
"temp<mans",
"temp",
"mans",
"{\n mans=temp;\n ans=p;\n }",
"mans=temp",
"mans",
"temp",
"ans=p",
"ans",
"p",
"al.remove(0)",
"al.remove",
"al",
"0",
"return ans;",
"ans",
"int a[]",
"a",
"int x",
"x",
"int n",
"n",
"HashMap<Integer,Integer> map",
"map",
"int min",
"min",
"int max",
"max"
]
| import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
public static void main (String[] args) {
Scanner scn= new Scanner(System.in);
int x=scn.nextInt();
int n=scn.nextInt();
HashMap<Integer,Integer> map=new HashMap<> ();
int min=Integer.MAX_VALUE;
int max=Integer.MIN_VALUE;
int a[]= new int[n];
for(int i=0; i<n; i++){
a[i]=scn.nextInt();
map.put(a[i],1);
min=Math.min(min,a[i]);
max=Math.max(max,a[i]);
}
if(n==0){
System.out.println(x);
} else
System.out.println(some(a,x,n,map,min,max));
}
public static int some(int a[],int x, int n,HashMap<Integer,Integer> map, int min, int max){
// if(x<=min) return min-1;
// if(x>=max) return max+1;
if(x<min){
if((x-1)<=min){
return x-1;
} else {
return x+1;
}
}
if(x>max){
if((x-1)>max){
return x-1;
} else {
return x+1;
}
}
ArrayList<Integer> al=new ArrayList<> ();
for(int i=min; i<=max; i++){
if(!map.containsKey(i)){
al.add(i);
}
}
if(al.size()==0){
if(Math.abs((min-1)-x)>Math.abs((max+1)-x)){
return max+1;
} else {
return min-1;
}
}
int mans=Integer.MAX_VALUE;
int ans=0;
Collections.sort(al);
while(al.size()!=0){
int p=al.get(0);
int temp=Math.abs(x-p);
if(temp<mans){
mans=temp;
ans=p;
}
al.remove(0);
}
return ans;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
13,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
13,
42,
2,
13,
2,
13,
13,
30,
14,
4,
18,
13,
13,
30,
40,
13,
9,
0,
13,
4,
18,
13,
4,
18,
13,
2,
13,
13,
13,
14,
2,
4,
18,
13,
13,
13,
13,
30,
3,
0,
13,
13,
40,
13,
0,
13,
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
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
26,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
26,
36
],
[
8,
37
],
[
37,
38
],
[
37,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
8,
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
],
[
8,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
62,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
77,
84
],
[
8,
85
],
[
85,
86
],
[
86,
87
],
[
8,
88
],
[
88,
89
],
[
88,
90
],
[
8,
91
],
[
91,
92
],
[
91,
93
],
[
8,
94
],
[
94,
95
],
[
94,
96
],
[
8,
97
],
[
97,
98
],
[
97,
99
],
[
8,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
107,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
106,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
106,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
130,
134
],
[
129,
135
],
[
128,
136
],
[
136,
137
],
[
106,
138
],
[
138,
139
],
[
138,
140
],
[
106,
141
],
[
141,
142
],
[
106,
143
],
[
143,
144
],
[
143,
145
],
[
8,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
6,
152
],
[
152,
153
]
]
| [
"import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tfinal int X = sc.nextInt();\n\t\tfinal int N = sc.nextInt();\n\t\tif(N==0){\n\t\t\tsc.close();\n\t\t\tSystem.out.println(X);\n\t\t\treturn;\n\t\t}\n\t\tArrayList<Integer> p = new ArrayList<>();\n\t\tint max=0;\n\t\tfor(int i=0;i<N;++i){\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tfor(int i=0;i<N;++i){\n\t\t\tmax = Math.max(p.get(i), max);\n\t\t}\n\t\tsc.close();\n\t\tint ans = 0;\n\t\tint i=0;\n\t\tint min = 101;\n\t\tint tmp = min;\n\t\twhile(i<(X+max)){\n\t\t\tif(p.contains(i)) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmin = Math.min(Math.abs(X-i), min);\n\t\t\tif(Math.min(tmp, min)==tmp){break;}\n\t\t\tans = i;\n\t\t\t++i;\n\t\t\ttmp = min;\n\t\t}\n\t\tSystem.out.println(ans);\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\tfinal int X = sc.nextInt();\n\t\tfinal int N = sc.nextInt();\n\t\tif(N==0){\n\t\t\tsc.close();\n\t\t\tSystem.out.println(X);\n\t\t\treturn;\n\t\t}\n\t\tArrayList<Integer> p = new ArrayList<>();\n\t\tint max=0;\n\t\tfor(int i=0;i<N;++i){\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tfor(int i=0;i<N;++i){\n\t\t\tmax = Math.max(p.get(i), max);\n\t\t}\n\t\tsc.close();\n\t\tint ans = 0;\n\t\tint i=0;\n\t\tint min = 101;\n\t\tint tmp = min;\n\t\twhile(i<(X+max)){\n\t\t\tif(p.contains(i)) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmin = Math.min(Math.abs(X-i), min);\n\t\t\tif(Math.min(tmp, min)==tmp){break;}\n\t\t\tans = i;\n\t\t\t++i;\n\t\t\ttmp = min;\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\tfinal int X = sc.nextInt();\n\t\tfinal int N = sc.nextInt();\n\t\tif(N==0){\n\t\t\tsc.close();\n\t\t\tSystem.out.println(X);\n\t\t\treturn;\n\t\t}\n\t\tArrayList<Integer> p = new ArrayList<>();\n\t\tint max=0;\n\t\tfor(int i=0;i<N;++i){\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tfor(int i=0;i<N;++i){\n\t\t\tmax = Math.max(p.get(i), max);\n\t\t}\n\t\tsc.close();\n\t\tint ans = 0;\n\t\tint i=0;\n\t\tint min = 101;\n\t\tint tmp = min;\n\t\twhile(i<(X+max)){\n\t\t\tif(p.contains(i)) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmin = Math.min(Math.abs(X-i), min);\n\t\t\tif(Math.min(tmp, min)==tmp){break;}\n\t\t\tans = i;\n\t\t\t++i;\n\t\t\ttmp = min;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tfinal int X = sc.nextInt();\n\t\tfinal int N = sc.nextInt();\n\t\tif(N==0){\n\t\t\tsc.close();\n\t\t\tSystem.out.println(X);\n\t\t\treturn;\n\t\t}\n\t\tArrayList<Integer> p = new ArrayList<>();\n\t\tint max=0;\n\t\tfor(int i=0;i<N;++i){\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tfor(int i=0;i<N;++i){\n\t\t\tmax = Math.max(p.get(i), max);\n\t\t}\n\t\tsc.close();\n\t\tint ans = 0;\n\t\tint i=0;\n\t\tint min = 101;\n\t\tint tmp = min;\n\t\twhile(i<(X+max)){\n\t\t\tif(p.contains(i)) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmin = Math.min(Math.abs(X-i), min);\n\t\t\tif(Math.min(tmp, min)==tmp){break;}\n\t\t\tans = i;\n\t\t\t++i;\n\t\t\ttmp = min;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"final int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"final int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(N==0){\n\t\t\tsc.close();\n\t\t\tSystem.out.println(X);\n\t\t\treturn;\n\t\t}",
"N==0",
"N",
"0",
"{\n\t\t\tsc.close();\n\t\t\tSystem.out.println(X);\n\t\t\treturn;\n\t\t}",
"sc.close()",
"sc.close",
"sc",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"return;",
"ArrayList<Integer> p = new ArrayList<>();",
"p",
"new ArrayList<>()",
"int max=0;",
"max",
"0",
"for(int i=0;i<N;++i){\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"++i",
"++i",
"i",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<N;++i){\n\t\t\tmax = Math.max(p.get(i), max);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"++i",
"++i",
"i",
"{\n\t\t\tmax = Math.max(p.get(i), max);\n\t\t}",
"{\n\t\t\tmax = Math.max(p.get(i), max);\n\t\t}",
"max = Math.max(p.get(i), max)",
"max",
"Math.max(p.get(i), max)",
"Math.max",
"Math",
"p.get(i)",
"p.get",
"p",
"i",
"max",
"sc.close()",
"sc.close",
"sc",
"int ans = 0;",
"ans",
"0",
"int i=0;",
"i",
"0",
"int min = 101;",
"min",
"101",
"int tmp = min;",
"tmp",
"min",
"while(i<(X+max)){\n\t\t\tif(p.contains(i)) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmin = Math.min(Math.abs(X-i), min);\n\t\t\tif(Math.min(tmp, min)==tmp){break;}\n\t\t\tans = i;\n\t\t\t++i;\n\t\t\ttmp = min;\n\t\t}",
"i<(X+max)",
"i",
"(X+max)",
"X",
"max",
"{\n\t\t\tif(p.contains(i)) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmin = Math.min(Math.abs(X-i), min);\n\t\t\tif(Math.min(tmp, min)==tmp){break;}\n\t\t\tans = i;\n\t\t\t++i;\n\t\t\ttmp = min;\n\t\t}",
"if(p.contains(i)) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}",
"p.contains(i)",
"p.contains",
"p",
"i",
"{\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}",
"++i",
"i",
"continue;",
"min = Math.min(Math.abs(X-i), min)",
"min",
"Math.min(Math.abs(X-i), min)",
"Math.min",
"Math",
"Math.abs(X-i)",
"Math.abs",
"Math",
"X-i",
"X",
"i",
"min",
"if(Math.min(tmp, min)==tmp){break;}",
"Math.min(tmp, min)==tmp",
"Math.min(tmp, min)",
"Math.min",
"Math",
"tmp",
"min",
"tmp",
"{break;}",
"break;",
"ans = i",
"ans",
"i",
"++i",
"i",
"tmp = min",
"tmp",
"min",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
]
| import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final int X = sc.nextInt();
final int N = sc.nextInt();
if(N==0){
sc.close();
System.out.println(X);
return;
}
ArrayList<Integer> p = new ArrayList<>();
int max=0;
for(int i=0;i<N;++i){
p.add(sc.nextInt());
}
for(int i=0;i<N;++i){
max = Math.max(p.get(i), max);
}
sc.close();
int ans = 0;
int i=0;
int min = 101;
int tmp = min;
while(i<(X+max)){
if(p.contains(i)) {
++i;
continue;
}
min = Math.min(Math.abs(X-i), min);
if(Math.min(tmp, min)==tmp){break;}
ans = i;
++i;
tmp = min;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
20,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
13,
14,
2,
13,
13,
30,
0,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
42,
17,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
3,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
3,
40,
13,
0,
13,
17,
0,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
184,
5
],
[
184,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
31,
33
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
8,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
42,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
60,
62
],
[
53,
63
],
[
63,
64
],
[
64,
65
],
[
53,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
67,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
90,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
8,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
103,
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
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
128,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
103,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
153,
160
],
[
103,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
165,
172
],
[
103,
173
],
[
173,
174
],
[
103,
175
],
[
175,
176
],
[
175,
177
],
[
103,
178
],
[
178,
179
],
[
178,
180
],
[
6,
181
],
[
181,
182
],
[
0,
183
],
[
183,
184
],
[
183,
185
]
]
| [
"import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint k = 0;\n\t\tint s = 1;\n\t\tboolean mini = true;\n\t\tboolean large = true;\n\t\tint[] p = new int[n];\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\twhile(true) {\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint k = 0;\n\t\tint s = 1;\n\t\tboolean mini = true;\n\t\tboolean large = true;\n\t\tint[] p = new int[n];\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\twhile(true) {\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint k = 0;\n\t\tint s = 1;\n\t\tboolean mini = true;\n\t\tboolean large = true;\n\t\tint[] p = new int[n];\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\twhile(true) {\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint k = 0;\n\t\tint s = 1;\n\t\tboolean mini = true;\n\t\tboolean large = true;\n\t\tint[] p = new int[n];\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\twhile(true) {\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int k = 0;",
"k",
"0",
"int s = 1;",
"s",
"1",
"boolean mini = true;",
"mini",
"true",
"boolean large = true;",
"large",
"true",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"if(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i = 0; i < p.length; i++) {\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < p.length",
"i",
"p.length",
"p",
"p.length",
"i++",
"i++",
"i",
"{\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"p[i] = num",
"p[i]",
"p",
"i",
"num",
"if(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}",
"num == x",
"num",
"x",
"{\n\t\t\t\tk += 1;\n\t\t\t}",
"k += 1",
"k",
"1",
"if(k == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"k == 0",
"k",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"while(true) {\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}",
"true",
"{\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}",
"int min = x - s;",
"min",
"x - s",
"x",
"s",
"int lar = x + s;",
"lar",
"x + s",
"x",
"s",
"for(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < p.length",
"i",
"p.length",
"p",
"p.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}",
"if(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}",
"min == p[i]",
"min",
"p[i]",
"p",
"i",
"{\n\t\t\t\t\tmini = false;\n\t\t\t\t}",
"mini = false",
"mini",
"false",
"if(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}",
"lar == p[i]",
"lar",
"p[i]",
"p",
"i",
"{\n\t\t\t\t\tlarge = false;\n\t\t\t\t}",
"large = false",
"large",
"false",
"if(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}",
"mini == true",
"mini",
"true",
"{\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"break;",
"if(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}",
"large == true",
"large",
"true",
"{\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(lar)",
"System.out.println",
"System.out",
"System",
"System.out",
"lar",
"break;",
"s++",
"s",
"mini = true",
"mini",
"true",
"large = true",
"large",
"true",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint k = 0;\n\t\tint s = 1;\n\t\tboolean mini = true;\n\t\tboolean large = true;\n\t\tint[] p = new int[n];\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\twhile(true) {\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint k = 0;\n\t\tint s = 1;\n\t\tboolean mini = true;\n\t\tboolean large = true;\n\t\tint[] p = new int[n];\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\tint num = sc.nextInt();\n\t\t\tp[i] = num;\n\t\t\tif(num == x) {\n\t\t\t\tk += 1;\n\t\t\t}\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\twhile(true) {\n\t\t\tint min = x - s;\n\t\t\tint lar = x + s;\n\t\t\tfor(int i = 0; i < p.length; i++) {\n\t\t\t\tif(min == p[i]) {\n\t\t\t\t\tmini = false;\n\t\t\t\t}\n\t\t\t\tif(lar == p[i]) {\n\t\t\t\t\tlarge = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mini == true) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(large == true) {\n\t\t\t\tSystem.out.println(lar);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts++;\n\t\t\tmini = true;\n\t\t large = true;\n\t\t}\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int k = 0;
int s = 1;
boolean mini = true;
boolean large = true;
int[] p = new int[n];
if(n == 0) {
System.out.println(x);
System.exit(0);
}
for(int i = 0; i < p.length; i++) {
int num = sc.nextInt();
p[i] = num;
if(num == x) {
k += 1;
}
}
if(k == 0) {
System.out.println(x);
System.exit(0);
}
while(true) {
int min = x - s;
int lar = x + s;
for(int i = 0; i < p.length; i++) {
if(min == p[i]) {
mini = false;
}
if(lar == p[i]) {
large = false;
}
}
if(mini == true) {
System.out.println(min);
break;
}
if(large == true) {
System.out.println(lar);
break;
}
s++;
mini = true;
large = true;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
18,
13,
2,
13,
17,
17,
41,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
2,
13,
17,
3,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
2,
13,
17,
30,
3,
0,
13,
2,
13,
17,
3,
14,
2,
2,
13,
17,
2,
4,
18,
13,
2,
13,
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
],
[
187,
5
],
[
187,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
26,
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
],
[
8,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
77,
83
],
[
8,
84
],
[
84,
85
],
[
84,
86
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
87,
94
],
[
94,
95
],
[
94,
96
],
[
87,
97
],
[
97,
98
],
[
98,
99
],
[
87,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
108,
114
],
[
8,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
115,
122
],
[
122,
123
],
[
122,
124
],
[
115,
125
],
[
125,
126
],
[
126,
127
],
[
115,
128
],
[
129,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
130,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
142,
143
],
[
142,
144
],
[
138,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
137,
153
],
[
153,
154
],
[
136,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
136,
160
],
[
129,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
170,
171
],
[
170,
172
],
[
166,
173
],
[
161,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
8,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
178,
183
],
[
6,
184
],
[
184,
185
],
[
0,
186
],
[
186,
187
],
[
186,
188
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint[] pArray = new int[100];\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tpArray[i] = 0;\n\t\t}\n\t\tint p = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}\n\t\tint ans = 101;\n\n\t\tfor (int i = x - 1; i < 100; i++) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = x - 1; i >= 0; i--) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\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\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint[] pArray = new int[100];\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tpArray[i] = 0;\n\t\t}\n\t\tint p = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}\n\t\tint ans = 101;\n\n\t\tfor (int i = x - 1; i < 100; i++) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = x - 1; i >= 0; i--) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\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\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint[] pArray = new int[100];\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tpArray[i] = 0;\n\t\t}\n\t\tint p = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}\n\t\tint ans = 101;\n\n\t\tfor (int i = x - 1; i < 100; i++) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = x - 1; i >= 0; i--) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\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\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint[] pArray = new int[100];\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tpArray[i] = 0;\n\t\t}\n\t\tint p = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}\n\t\tint ans = 101;\n\n\t\tfor (int i = x - 1; i < 100; i++) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = x - 1; i >= 0; i--) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\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 x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int[] pArray = new int[100];",
"pArray",
"new int[100]",
"100",
"for (int i = 0; i < 100; i++) {\n\t\t\tpArray[i] = 0;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n\t\t\tpArray[i] = 0;\n\t\t}",
"{\n\t\t\tpArray[i] = 0;\n\t\t}",
"pArray[i] = 0",
"pArray[i]",
"pArray",
"i",
"0",
"int p = 0;",
"p",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}",
"{\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}",
"p = sc.nextInt()",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"pArray[p - 1] = 1",
"pArray[p - 1]",
"pArray",
"p - 1",
"p",
"1",
"1",
"int ans = 101;",
"ans",
"101",
"for (int i = x - 1; i < 100; i++) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = x - 1;",
"int i = x - 1;",
"i",
"x - 1",
"x",
"1",
"i < 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}",
"pArray[i] == 0",
"pArray[i]",
"pArray",
"i",
"0",
"{\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = i + 1",
"ans",
"i + 1",
"i",
"1",
"break;",
"for (int i = x - 1; i >= 0; i--) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\n\t\t\t}\n\t\t}",
"int i = x - 1;",
"int i = x - 1;",
"i",
"x - 1",
"x",
"1",
"i >= 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\n\t\t\t}\n\t\t}",
"if (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}",
"pArray[i] == 0",
"pArray[i]",
"pArray",
"i",
"0",
"{\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}",
"if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"Math.abs(x - ans) < Math.abs(x - (i + 1))",
"Math.abs(x - ans)",
"Math.abs",
"Math",
"x - ans",
"x",
"ans",
"Math.abs(x - (i + 1))",
"Math.abs",
"Math",
"x - (i + 1)",
"x",
"(i + 1)",
"i",
"1",
"{\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"break;",
"ans = i + 1",
"ans",
"i + 1",
"i",
"1",
"break;",
"if (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\n\t\t\t}",
"i == 0 && Math.abs(x - ans) >= x",
"i == 0",
"i",
"0",
"Math.abs(x - ans) >= x",
"Math.abs(x - ans)",
"Math.abs",
"Math",
"x - ans",
"x",
"ans",
"x",
"{\n\t\t\t\tans = 0;\n\t\t\t}",
"ans = 0",
"ans",
"0",
"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\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint[] pArray = new int[100];\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tpArray[i] = 0;\n\t\t}\n\t\tint p = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}\n\t\tint ans = 101;\n\n\t\tfor (int i = x - 1; i < 100; i++) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = x - 1; i >= 0; i--) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\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\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint[] pArray = new int[100];\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tpArray[i] = 0;\n\t\t}\n\t\tint p = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp = sc.nextInt();\n\t\t\tpArray[p - 1] = 1;\n\t\t}\n\t\tint ans = 101;\n\n\t\tfor (int i = x - 1; i < 100; i++) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = x - 1; i >= 0; i--) {\n\t\t\tif (pArray[i] == 0) {\n\t\t\t\tif (Math.abs(x - ans) < Math.abs(x - (i + 1))) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tans = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (i == 0 && Math.abs(x - ans) >= x) {\n\t\t\t\tans = 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if (n == 0) {
System.out.println(x);
return;
}
int[] pArray = new int[100];
for (int i = 0; i < 100; i++) {
pArray[i] = 0;
}
int p = 0;
for (int i = 0; i < n; i++) {
p = sc.nextInt();
pArray[p - 1] = 1;
}
int ans = 101;
for (int i = x - 1; i < 100; i++) {
if (pArray[i] == 0) {
ans = i + 1;
break;
}
}
for (int i = x - 1; i >= 0; i--) {
if (pArray[i] == 0) {
if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
break;
}
ans = i + 1;
break;
}
if (i == 0 && Math.abs(x - ans) >= x) {
ans = 0;
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
30,
0,
18,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
14,
2,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
114,
5
],
[
114,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
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
],
[
42,
43
],
[
43,
44
],
[
39,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
46,
56
],
[
56,
57
],
[
57,
58
],
[
46,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
62,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
69,
78
],
[
61,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
85,
92
],
[
79,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
107,
108
],
[
107,
109
],
[
101,
110
],
[
6,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
]
| [
"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\tint number = sc.nextInt();\n\t\tint numlength = sc.nextInt();\n\t\tboolean[] numbers = new boolean[101];\n\n\t\tfor (int i = 0; i < numlength; i++) {\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}\n\n\t\tfor (int i = 0; i < numlength + 1; i++) {\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint number = sc.nextInt();\n\t\tint numlength = sc.nextInt();\n\t\tboolean[] numbers = new boolean[101];\n\n\t\tfor (int i = 0; i < numlength; i++) {\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}\n\n\t\tfor (int i = 0; i < numlength + 1; i++) {\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint number = sc.nextInt();\n\t\tint numlength = sc.nextInt();\n\t\tboolean[] numbers = new boolean[101];\n\n\t\tfor (int i = 0; i < numlength; i++) {\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}\n\n\t\tfor (int i = 0; i < numlength + 1; i++) {\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint number = sc.nextInt();\n\t\tint numlength = sc.nextInt();\n\t\tboolean[] numbers = new boolean[101];\n\n\t\tfor (int i = 0; i < numlength; i++) {\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}\n\n\t\tfor (int i = 0; i < numlength + 1; i++) {\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int number = sc.nextInt();",
"number",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int numlength = sc.nextInt();",
"numlength",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean[] numbers = new boolean[101];",
"numbers",
"new boolean[101]",
"101",
"for (int i = 0; i < numlength; i++) {\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numlength",
"i",
"numlength",
"i++",
"i++",
"i",
"{\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}",
"{\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}",
"numbers[sc.nextInt()] = true",
"numbers[sc.nextInt()]",
"numbers",
"sc.nextInt()",
"sc.nextInt",
"sc",
"true",
"for (int i = 0; i < numlength + 1; i++) {\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numlength + 1",
"i",
"numlength + 1",
"numlength",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"if (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}",
"numbers[number - i] == false",
"numbers[number - i]",
"numbers",
"number - i",
"number",
"i",
"false",
"{\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(number - i)",
"System.out.println",
"System.out",
"System",
"System.out",
"number - i",
"number",
"i",
"return;",
"if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}",
"number + i == 101",
"number + i",
"number",
"i",
"101",
"{\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(101)",
"System.out.println",
"System.out",
"System",
"System.out",
"101",
"return;",
"if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}",
"numbers[number + i] == false",
"numbers[number + i]",
"numbers",
"number + i",
"number",
"i",
"false",
"{\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(number + i)",
"System.out.println",
"System.out",
"System",
"System.out",
"number + i",
"number",
"i",
"return;",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint number = sc.nextInt();\n\t\tint numlength = sc.nextInt();\n\t\tboolean[] numbers = new boolean[101];\n\n\t\tfor (int i = 0; i < numlength; i++) {\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}\n\n\t\tfor (int i = 0; i < numlength + 1; i++) {\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint number = sc.nextInt();\n\t\tint numlength = sc.nextInt();\n\t\tboolean[] numbers = new boolean[101];\n\n\t\tfor (int i = 0; i < numlength; i++) {\n\t\t\tnumbers[sc.nextInt()] = true;\n\t\t}\n\n\t\tfor (int i = 0; i < numlength + 1; i++) {\n\t\t\tif (numbers[number - i] == false) {\n\t\t\t\tSystem.out.println(number - i);\n\t\t\t\treturn;\n\t\t\t} else if(number + i == 101){\n\t\t\t\tSystem.out.println(101);\n\t\t\t\treturn;\n\t\t\t}else if (numbers[number + i] == false) {\n\t\t\t\tSystem.out.println(number + i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int number = sc.nextInt();
int numlength = sc.nextInt();
boolean[] numbers = new boolean[101];
for (int i = 0; i < numlength; i++) {
numbers[sc.nextInt()] = true;
}
for (int i = 0; i < numlength + 1; i++) {
if (numbers[number - i] == false) {
System.out.println(number - i);
return;
} else if(number + i == 101){
System.out.println(101);
return;
}else if (numbers[number + i] == false) {
System.out.println(number + i);
return;
}
}
}
} |
[
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,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
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,
4,
18,
13,
18,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
9,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
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
],
[
161,
11
],
[
161,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
14,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
39,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
14,
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
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
73,
75
],
[
14,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
76,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
82,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
14,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
111,
113
],
[
107,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
117,
119
],
[
106,
120
],
[
120,
121
],
[
105,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
127,
128
],
[
127,
129
],
[
122,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
130,
139
],
[
105,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
145,
146
],
[
145,
147
],
[
140,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
148,
157
],
[
12,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\npublic class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"Main",
"public static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}",
"main",
"{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int i=sc.nextInt();",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int j=sc.nextInt();",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int arr[]=new int[j];",
"arr",
"new int[j]",
"j",
"List li1=new ArrayList();",
"li1",
"new ArrayList()",
"if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }",
"j==0",
"j",
"0",
"{\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }",
"System.out.println(i)",
"System.out.println",
"System.out",
"System",
"System.out",
"i",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<j",
"k",
"j",
"k++",
"k++",
"k",
"{\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }",
"{\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }",
"arr[k]=sc.nextInt()",
"arr[k]",
"arr",
"k",
"sc.nextInt()",
"sc.nextInt",
"sc",
"li1.add(arr[k])",
"li1.add",
"li1",
"arr[k]",
"arr",
"k",
"if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }",
"!li1.contains(i)",
"li1.contains(i)",
"li1.contains",
"li1",
"i",
"{\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }",
"System.out.println(i)",
"System.out.println",
"System.out",
"System",
"System.out",
"i",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<=j",
"k",
"j",
"k++",
"k++",
"k",
"{\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }",
"{\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }",
"if((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }",
"(li1.contains(i+k))&&(li1.contains(i-k))",
"(li1.contains(i+k))",
"li1.contains",
"li1",
"i+k",
"i",
"k",
"(li1.contains(i-k))",
"li1.contains",
"li1",
"i-k",
"i",
"k",
"{ \n\t\t\t\t continue;\n\t\t\t }",
"continue;",
"if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }",
"!li1.contains(i-k)",
"li1.contains(i-k)",
"li1.contains",
"li1",
"i-k",
"i",
"k",
"{\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }",
"System.out.println(i-k)",
"System.out.println",
"System.out",
"System",
"System.out",
"i-k",
"i",
"k",
"break;",
"if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }",
"!li1.contains(i+k)",
"li1.contains(i+k)",
"li1.contains",
"li1",
"i+k",
"i",
"k",
"{\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }",
"System.out.println(i+k)",
"System.out.println",
"System.out",
"System",
"System.out",
"i+k",
"i",
"k",
"break;",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int i=sc.nextInt();\n\t\t int j=sc.nextInt();\n\t\t int arr[]=new int[j];\n\t\t List li1=new ArrayList();\n\t\t if(j==0)\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t for(int k=0;k<j;k++)\n\t\t {\n\t\t\t arr[k]=sc.nextInt();\n\t\t\t li1.add(arr[k]);\n\t\t }\n\t\t if(!li1.contains(i))\n\t\t {\n\t\t\t System.out.println(i);\n\t\t\t System.exit(0);\n\t\t }\n\t\t\n\t\t for(int k=0;k<=j;k++)\n\t\t {\n\t\t\tif((li1.contains(i+k))&&(li1.contains(i-k)))\n\t\t\t { \n\t\t\t\t continue;\n\t\t\t }\n \n\t\t\t if(!li1.contains(i-k))\n\t\t\t {\n\t\t\t\t System.out.println(i-k);\n break;\n\t\t\t\t \n\t\t\t }\n\t\t\t if(!li1.contains(i+k))\n\t\t\t {\n\t\t\t\t System.out.println(i+k);\n break;\n\t\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t \n\t\t \n\t}\n \n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int i=sc.nextInt();
int j=sc.nextInt();
int arr[]=new int[j];
List li1=new ArrayList();
if(j==0)
{
System.out.println(i);
System.exit(0);
}
for(int k=0;k<j;k++)
{
arr[k]=sc.nextInt();
li1.add(arr[k]);
}
if(!li1.contains(i))
{
System.out.println(i);
System.exit(0);
}
for(int k=0;k<=j;k++)
{
if((li1.contains(i+k))&&(li1.contains(i-k)))
{
continue;
}
if(!li1.contains(i-k))
{
System.out.println(i-k);
break;
}
if(!li1.contains(i+k))
{
System.out.println(i+k);
break;
}
}
}
} |
[
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,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
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
],
[
105,
11
],
[
105,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
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
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
14,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
74,
83
],
[
66,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
92,
101
],
[
12,
102
],
[
102,
103
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}",
"main",
"{\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int x = scan.nextInt();",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"List<Integer> p = new ArrayList<>();",
"p",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}",
"{\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}",
"int a = scan.nextInt();",
"a",
"scan.nextInt()",
"scan.nextInt",
"scan",
"p.add(a)",
"p.add",
"p",
"a",
"for (int i = 0; i < 100; i++) {\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}",
"!p.contains(x - i)",
"p.contains(x - i)",
"p.contains",
"p",
"x - i",
"x",
"i",
"{\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x - i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x - i",
"x",
"i",
"break;",
"if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}",
"!p.contains(x + i)",
"p.contains(x + i)",
"p.contains",
"p",
"x + i",
"x",
"i",
"{\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x + i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x + i",
"x",
"i",
"break;",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tList<Integer> p = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = scan.nextInt();\n\t\t\tp.add(a);\n\t\t}\n\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tif (!p.contains(x - i)) {\n\t\t\t\tSystem.out.println(x - i);\n\t\t\t\tbreak;\n\t\t\t} else if (!p.contains(x + i)) {\n\t\t\t\tSystem.out.println(x + i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int n = scan.nextInt();
List<Integer> p = new ArrayList<>();
for (int i = 0; i < n; i++) {
int a = scan.nextInt();
p.add(a);
}
for (int i = 0; i < 100; i++) {
if (!p.contains(x - i)) {
System.out.println(x - i);
break;
} else if (!p.contains(x + i)) {
System.out.println(x + i);
break;
}
}
}
} |
[
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,
20,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
4,
18,
13,
18,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
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
],
[
172,
20
],
[
172,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
23,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
32,
37
],
[
23,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
43,
44
],
[
43,
45
],
[
23,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
51,
53
],
[
23,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
54,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
68,
73
],
[
65,
74
],
[
74,
75
],
[
74,
76
],
[
65,
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
],
[
90,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
65,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
99,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
99,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
113,
123
],
[
123,
124
],
[
124,
125
],
[
113,
126
],
[
127,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
147,
148
],
[
147,
149
],
[
141,
150
],
[
133,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
156,
157
],
[
156,
158
],
[
151,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
165,
166
],
[
165,
167
],
[
159,
168
],
[
21,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.nio.charset.StandardCharsets;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Main {\n\tpublic static void main (String[] args) throws IOException{\n\t InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t BufferedReader in = new BufferedReader(reader);\n\t String[] str1 = in.readLine().split(\" \");\n\t int num1 = Integer.parseInt(str1[0]);\n\t int num2 = Integer.parseInt(str1[1]);\n\n\t if(num2==0) {\n\t\t\tSystem.out.println(num1);\n\t }else {\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\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",
"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 InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t BufferedReader in = new BufferedReader(reader);\n\t String[] str1 = in.readLine().split(\" \");\n\t int num1 = Integer.parseInt(str1[0]);\n\t int num2 = Integer.parseInt(str1[1]);\n\n\t if(num2==0) {\n\t\t\tSystem.out.println(num1);\n\t }else {\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t }\n\t}\n}",
"Main",
"public static void main (String[] args) throws IOException{\n\t InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t BufferedReader in = new BufferedReader(reader);\n\t String[] str1 = in.readLine().split(\" \");\n\t int num1 = Integer.parseInt(str1[0]);\n\t int num2 = Integer.parseInt(str1[1]);\n\n\t if(num2==0) {\n\t\t\tSystem.out.println(num1);\n\t }else {\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t }\n\t}",
"main",
"{\n\t InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t BufferedReader in = new BufferedReader(reader);\n\t String[] str1 = in.readLine().split(\" \");\n\t int num1 = Integer.parseInt(str1[0]);\n\t int num2 = Integer.parseInt(str1[1]);\n\n\t if(num2==0) {\n\t\t\tSystem.out.println(num1);\n\t }else {\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t }\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[] str1 = in.readLine().split(\" \");",
"str1",
"in.readLine().split(\" \")",
"in.readLine().split",
"in.readLine()",
"in.readLine",
"in",
"\" \"",
"int num1 = Integer.parseInt(str1[0]);",
"num1",
"Integer.parseInt(str1[0])",
"Integer.parseInt",
"Integer",
"str1[0]",
"str1",
"0",
"int num2 = Integer.parseInt(str1[1]);",
"num2",
"Integer.parseInt(str1[1])",
"Integer.parseInt",
"Integer",
"str1[1]",
"str1",
"1",
"if(num2==0) {\n\t\t\tSystem.out.println(num1);\n\t }else {\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t }",
"num2==0",
"num2",
"0",
"{\n\t\t\tSystem.out.println(num1);\n\t }",
"System.out.println(num1)",
"System.out.println",
"System.out",
"System",
"System.out",
"num1",
"{\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t }",
"String[] str2 =in.readLine().split(\" \");",
"str2",
"in.readLine().split(\" \")",
"in.readLine().split",
"in.readLine()",
"in.readLine",
"in",
"\" \"",
"List<Integer> arrays = new ArrayList<Integer>();",
"arrays",
"new ArrayList<Integer>()",
"for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<num2",
"i",
"num2",
"i++",
"i++",
"i",
"{\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }",
"{\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }",
"arrays.add(Integer.parseInt(str2[i]))",
"arrays.add",
"arrays",
"Integer.parseInt(str2[i])",
"Integer.parseInt",
"Integer",
"str2[i]",
"str2",
"i",
"if(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"!arrays.contains(num1)",
"arrays.contains(num1)",
"arrays.contains",
"arrays",
"num1",
"{\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}",
"System.out.println(num1)",
"System.out.println",
"System.out",
"System",
"System.out",
"num1",
"{\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<num2+1",
"i",
"num2+1",
"num2",
"1",
"i++",
"i++",
"i",
"{\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"if(num1>0) {\n\t\t\t\t\t}",
"num1>0",
"num1",
"0",
"{\n\t\t\t\t\t}",
"if(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"!arrays.contains(num1-i)",
"arrays.contains(num1-i)",
"arrays.contains",
"arrays",
"num1-i",
"num1",
"i",
"{\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"System.out.println(num1-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"num1-i",
"num1",
"i",
"break;",
"if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"!arrays.contains(num1+i)",
"arrays.contains(num1+i)",
"arrays.contains",
"arrays",
"num1+i",
"num1",
"i",
"{\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"System.out.println(num1+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"num1+i",
"num1",
"i",
"break;",
"String[] args",
"args",
"public class Main {\n\tpublic static void main (String[] args) throws IOException{\n\t InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t BufferedReader in = new BufferedReader(reader);\n\t String[] str1 = in.readLine().split(\" \");\n\t int num1 = Integer.parseInt(str1[0]);\n\t int num2 = Integer.parseInt(str1[1]);\n\n\t if(num2==0) {\n\t\t\tSystem.out.println(num1);\n\t }else {\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t }\n\t}\n}",
"public class Main {\n\tpublic static void main (String[] args) throws IOException{\n\t InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t BufferedReader in = new BufferedReader(reader);\n\t String[] str1 = in.readLine().split(\" \");\n\t int num1 = Integer.parseInt(str1[0]);\n\t int num2 = Integer.parseInt(str1[1]);\n\n\t if(num2==0) {\n\t\t\tSystem.out.println(num1);\n\t }else {\n\t\t String[] str2 =in.readLine().split(\" \");\n\t\t List<Integer> arrays = new ArrayList<Integer>();\n\t\t for(int i = 0; i<num2; i++) {\n\t\t \tarrays.add(Integer.parseInt(str2[i]));\n\t\t }\n\t\t\tif(!arrays.contains(num1)) {\n\t\t\t\tSystem.out.println(num1);\n\t\t\t}else {\n\t\t\t\tfor(int i=1; i<num2+1; i++) {\n\t\t\t\t\tif(num1>0) {\n\t\t\t\t\t}\n\t\t\t\t\tif(!arrays.contains(num1-i)) {\n\t\t\t\t\t\tSystem.out.println(num1-i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else if(!arrays.contains(num1+i)) {\n\t\t\t\t\t\tSystem.out.println(num1+i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t }\n\t}\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
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[] str1 = in.readLine().split(" ");
int num1 = Integer.parseInt(str1[0]);
int num2 = Integer.parseInt(str1[1]);
if(num2==0) {
System.out.println(num1);
}else {
String[] str2 =in.readLine().split(" ");
List<Integer> arrays = new ArrayList<Integer>();
for(int i = 0; i<num2; i++) {
arrays.add(Integer.parseInt(str2[i]));
}
if(!arrays.contains(num1)) {
System.out.println(num1);
}else {
for(int i=1; i<num2+1; i++) {
if(num1>0) {
}
if(!arrays.contains(num1-i)) {
System.out.println(num1-i);
break;
}else if(!arrays.contains(num1+i)) {
System.out.println(num1+i);
break;
}
}
}
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
14,
40,
4,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
29,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
13,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
3,
14,
40,
4,
13,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
3,
4,
18,
18,
13,
13,
13,
29,
23,
13,
12,
13,
30,
29,
4,
18,
4,
18,
13,
13,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
144,
5
],
[
144,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
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
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
50,
57
],
[
46,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
60,
63
],
[
58,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
64,
71
],
[
58,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
91,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
89,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
106,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
112,
118
],
[
72,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
72,
125
],
[
6,
126
],
[
126,
127
],
[
144,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
132,
138
],
[
128,
139
],
[
139,
140
],
[
128,
141
],
[
141,
142
],
[
0,
143
],
[
143,
144
],
[
143,
145
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n Integer[] p = new Integer[n];\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n }\n if (n == 0) {\n System.out.println(x);\n return;\n } else if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }\n }\n\n private static boolean checkForbiddenList(Integer[] p, int x) {\n return Arrays.asList(p).contains(x);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n Integer[] p = new Integer[n];\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n }\n if (n == 0) {\n System.out.println(x);\n return;\n } else if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }\n }\n\n private static boolean checkForbiddenList(Integer[] p, int x) {\n return Arrays.asList(p).contains(x);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n Integer[] p = new Integer[n];\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n }\n if (n == 0) {\n System.out.println(x);\n return;\n } else if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n Integer[] p = new Integer[n];\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n }\n if (n == 0) {\n System.out.println(x);\n return;\n } else if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Integer[] p = new Integer[n];",
"p",
"new Integer[n]",
"n",
"for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i] = sc.nextInt();\n }",
"{\n p[i] = sc.nextInt();\n }",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (n == 0) {\n System.out.println(x);\n return;\n } else if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }",
"!checkForbiddenList(p, x)",
"checkForbiddenList(p, x)",
"checkForbiddenList",
"p",
"x",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"{\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }",
"{\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }",
"if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }",
"!checkForbiddenList(p, x - i)",
"checkForbiddenList(p, x - i)",
"checkForbiddenList",
"p",
"x - i",
"x",
"i",
"{\n ans = x - i;\n break;\n }",
"ans = x - i",
"ans",
"x - i",
"x",
"i",
"break;",
"if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }",
"!checkForbiddenList(p, x + i)",
"checkForbiddenList(p, x + i)",
"checkForbiddenList",
"p",
"x + i",
"x",
"i",
"{\n ans = x + i;\n break;\n }",
"ans = x + i",
"ans",
"x + i",
"x",
"i",
"break;",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"return;",
"String[] args",
"args",
"private static boolean checkForbiddenList(Integer[] p, int x) {\n return Arrays.asList(p).contains(x);\n }",
"checkForbiddenList",
"{\n return Arrays.asList(p).contains(x);\n }",
"return Arrays.asList(p).contains(x);",
"Arrays.asList(p).contains(x)",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"x",
"Integer[] p",
"p",
"int x",
"x",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n Integer[] p = new Integer[n];\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n }\n if (n == 0) {\n System.out.println(x);\n return;\n } else if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }\n }\n\n private static boolean checkForbiddenList(Integer[] p, int x) {\n return Arrays.asList(p).contains(x);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n Integer[] p = new Integer[n];\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n }\n if (n == 0) {\n System.out.println(x);\n return;\n } else if (!checkForbiddenList(p, x)) {\n System.out.println(x);\n return;\n } else {\n int ans = 0;\n for (int i = 0; i < 100; i++) {\n if (!checkForbiddenList(p, x - i)) {\n ans = x - i;\n break;\n } else if (!checkForbiddenList(p, x + i)) {\n ans = x + i;\n break;\n }\n }\n System.out.println(ans);\n return;\n }\n }\n\n private static boolean checkForbiddenList(Integer[] p, int x) {\n return Arrays.asList(p).contains(x);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
Integer[] p = new Integer[n];
for (int i = 0; i < n; i++) {
p[i] = sc.nextInt();
}
if (n == 0) {
System.out.println(x);
return;
} else if (!checkForbiddenList(p, x)) {
System.out.println(x);
return;
} else {
int ans = 0;
for (int i = 0; i < 100; i++) {
if (!checkForbiddenList(p, x - i)) {
ans = x - i;
break;
} else if (!checkForbiddenList(p, x + i)) {
ans = x + i;
break;
}
}
System.out.println(ans);
return;
}
}
private static boolean checkForbiddenList(Integer[] p, int x) {
return Arrays.asList(p).contains(x);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
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,
41,
13,
40,
17,
11,
1,
41,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
3,
14,
40,
13,
30,
0,
13,
13,
3,
41,
13,
40,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
3,
14,
40,
13,
30,
0,
13,
13,
3,
14,
2,
2,
13,
40,
17,
2,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
14,
2,
2,
13,
40,
17,
2,
13,
40,
17,
30,
4,
18,
18,
13,
13,
13,
30,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
17,
41,
13,
17,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
291,
17
],
[
291,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
20,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
20,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
34,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
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
],
[
45,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
45,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
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
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
103,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
86,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
45,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
45,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
126,
133
],
[
133,
134
],
[
133,
135
],
[
126,
136
],
[
136,
137
],
[
137,
138
],
[
126,
139
],
[
140,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
144,
155
],
[
156,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
157,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
140,
168
],
[
168,
169
],
[
169,
170
],
[
168,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
45,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
177,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
176,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
187,
192
],
[
176,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
194,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
193,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
204,
209
],
[
193,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
212,
216
],
[
216,
217
],
[
216,
218
],
[
211,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
220,
225
],
[
211,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
227,
232
],
[
18,
233
],
[
233,
234
],
[
291,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
237,
239
],
[
235,
240
],
[
240,
241
],
[
240,
242
],
[
235,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
245,
249
],
[
249,
250
],
[
249,
251
],
[
243,
252
],
[
252,
253
],
[
235,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
258,
262
],
[
262,
263
],
[
263,
264
],
[
264,
265
],
[
257,
266
],
[
266,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
270,
271
],
[
271,
272
],
[
267,
273
],
[
273,
274
],
[
274,
275
],
[
274,
276
],
[
256,
277
],
[
277,
278
],
[
278,
279
],
[
279,
280
],
[
235,
281
],
[
281,
282
],
[
281,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
286,
287
],
[
285,
288
],
[
288,
289
],
[
0,
290
],
[
290,
291
],
[
290,
292
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t}\n\t\telse {\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t\tprivate StringTokenizer tokenizer = null;\n\n\t\tpublic FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t}\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.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t}\n\t\telse {\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t\tprivate StringTokenizer tokenizer = null;\n\n\t\tpublic FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t}\n\t\telse {\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"main",
"{\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t}\n\t\telse {\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"FastScanner sc = new FastScanner(System.in);",
"sc",
"new FastScanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t}\n\t\telse {\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"N == 0",
"N",
"0",
"{\n\t\t\tSystem.out.println(X);\n\t\t}",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"{\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int[] numbers = new int[N];",
"numbers",
"new int[N]",
"N",
"for (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}",
"{\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}",
"numbers[i] = sc.nextInt()",
"numbers[i]",
"numbers",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int min = -1;",
"min",
"-1",
"1",
"for (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int j=X;",
"int j=X;",
"j",
"X",
"j >= 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"boolean found = false;",
"found",
"false",
"for (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"if (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"numbers[i] == j",
"numbers[i]",
"numbers",
"i",
"j",
"{\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"found = true",
"found",
"true",
"break;",
"if (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"!found",
"found",
"{\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"min = j",
"min",
"j",
"break;",
"int max = -1;",
"max",
"-1",
"1",
"for (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int j=X+1;",
"int j=X+1;",
"j",
"X+1",
"X",
"1",
"j <= 101",
"j",
"101",
"j++",
"j++",
"j",
"{\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"boolean found = false;",
"found",
"false",
"for (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"if (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"numbers[i] == j",
"numbers[i]",
"numbers",
"i",
"j",
"{\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"found = true",
"found",
"true",
"break;",
"if (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"!found",
"found",
"{\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"max = j",
"max",
"j",
"break;",
"if (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}",
"max == -1 && min != -1",
"max == -1",
"max",
"-1",
"1",
"min != -1",
"min",
"-1",
"1",
"{\n\t\t\t\tSystem.out.println(min);\n\t\t\t}",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}",
"min == -1 && max != -1",
"min == -1",
"min",
"-1",
"1",
"max != -1",
"max",
"-1",
"1",
"{\n\t\t\t\tSystem.out.println(max);\n\t\t\t}",
"System.out.println(max)",
"System.out.println",
"System.out",
"System",
"System.out",
"max",
"{\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}",
"if ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}",
"(X-min) <= (max-X)",
"(X-min)",
"X",
"min",
"(max-X)",
"max",
"X",
"{\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"{\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}",
"System.out.println(max)",
"System.out.println",
"System.out",
"System",
"System.out",
"max",
"String[] args",
"args",
"private static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t\tprivate StringTokenizer tokenizer = null;\n\n\t\tpublic FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t}",
"FastScanner",
"private BufferedReader reader = null;",
"reader",
"null",
"private StringTokenizer tokenizer = null;",
"tokenizer",
"null",
"public FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}",
"FastScanner",
"{\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}",
"reader = new BufferedReader(new InputStreamReader(in))",
"reader",
"new BufferedReader(new InputStreamReader(in))",
"tokenizer = null",
"tokenizer",
"null",
"InputStream in",
"in",
"public String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}",
"next",
"{\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}",
"try {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t}",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"nextInt",
"{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t}\n\t\telse {\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t\tprivate StringTokenizer tokenizer = null;\n\n\t\tpublic FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t}\n\t\telse {\n\t\t\tint[] numbers = new int[N];\n\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\tnumbers[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint min = -1;\n\t\t\tfor (int j=X; j >= 0; j--) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmin = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint max = -1;\n\t\t\tfor (int j=X+1; j <= 101; j++) {\n\t\t\t\tboolean found = false;\n\t\t\t\tfor (int i=0; i < N; i++) {\n\t\t\t\t\tif (numbers[i] == j) {\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tmax = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (max == -1 && min != -1) {\n\t\t\t\tSystem.out.println(min);\n\t\t\t}\n\t\t\telse if (min == -1 && max != -1) {\n\t\t\t\tSystem.out.println(max);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ((X-min) <= (max-X)) {\n\t\t\t\t\tSystem.out.println(min);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(max);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t\tprivate StringTokenizer tokenizer = null;\n\n\t\tpublic FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t}\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
if (N == 0) {
System.out.println(X);
}
else {
int[] numbers = new int[N];
for (int i=0; i < N; i++) {
numbers[i] = sc.nextInt();
}
int min = -1;
for (int j=X; j >= 0; j--) {
boolean found = false;
for (int i=0; i < N; i++) {
if (numbers[i] == j) {
found = true;
break;
}
}
if (!found) {
min = j;
break;
}
}
int max = -1;
for (int j=X+1; j <= 101; j++) {
boolean found = false;
for (int i=0; i < N; i++) {
if (numbers[i] == j) {
found = true;
break;
}
}
if (!found) {
max = j;
break;
}
}
if (max == -1 && min != -1) {
System.out.println(min);
}
else if (min == -1 && max != -1) {
System.out.println(max);
}
else {
if ((X-min) <= (max-X)) {
System.out.println(min);
}
else {
System.out.println(max);
}
}
}
}
private static class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
42,
2,
13,
13,
30,
14,
2,
13,
13,
0,
13,
13,
0,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
29,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
2,
13,
17,
17,
29,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
0,
13,
17,
30,
30,
14,
2,
2,
13,
13,
17,
29,
17,
29,
17,
23,
13,
12,
13,
30,
28,
13,
13,
30,
30,
4,
18,
18,
13,
13,
2,
13,
17,
4,
18,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
14,
40,
4,
18,
13,
13,
4,
18,
18,
13,
13,
13,
30,
41,
13,
13,
41,
13,
13,
42,
13,
30,
14,
40,
4,
18,
13,
40,
13,
30,
4,
18,
18,
13,
13,
13,
0,
13,
17,
3,
14,
40,
4,
18,
13,
40,
13,
30,
4,
18,
18,
13,
13,
13,
0,
13,
17,
3,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
383,
8
],
[
383,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
9,
29
],
[
29,
30
],
[
9,
31
],
[
31,
32
],
[
383,
33
],
[
33,
34
],
[
33,
35
],
[
35,
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
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
49,
59
],
[
59,
60
],
[
35,
61
],
[
61,
62
],
[
33,
63
],
[
63,
64
],
[
33,
65
],
[
65,
66
],
[
383,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
76,
82
],
[
82,
83
],
[
69,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
84,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
100,
106
],
[
106,
107
],
[
69,
108
],
[
108,
109
],
[
67,
110
],
[
110,
111
],
[
383,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
115,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
114,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
112,
133
],
[
133,
134
],
[
383,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
137,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
137,
151
],
[
151,
152
],
[
151,
153
],
[
137,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
159,
160
],
[
159,
161
],
[
154,
162
],
[
162,
163
],
[
163,
164
],
[
154,
165
],
[
166,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
170,
171
],
[
171,
172
],
[
137,
173
],
[
173,
174
],
[
173,
175
],
[
137,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
178,
181
],
[
176,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
182,
187
],
[
176,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
188,
192
],
[
192,
193
],
[
192,
194
],
[
188,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
200,
203
],
[
203,
204
],
[
198,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
206,
211
],
[
205,
212
],
[
212,
213
],
[
212,
214
],
[
205,
215
],
[
198,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
221,
222
],
[
216,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
224,
229
],
[
223,
230
],
[
230,
231
],
[
230,
232
],
[
223,
233
],
[
135,
234
],
[
234,
235
],
[
383,
236
],
[
236,
237
],
[
236,
238
],
[
238,
239
],
[
236,
240
],
[
240,
241
],
[
236,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
236,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
251,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
265,
266
],
[
266,
267
],
[
261,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
250,
272
],
[
272,
273
],
[
273,
274
],
[
274,
275
],
[
236,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
280,
283
],
[
283,
284
],
[
236,
285
],
[
285,
286
],
[
285,
287
],
[
287,
288
],
[
288,
289
],
[
289,
290
],
[
290,
291
],
[
289,
292
],
[
292,
293
],
[
236,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
298,
301
],
[
301,
302
],
[
236,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
305,
310
],
[
310,
311
],
[
311,
312
],
[
312,
313
],
[
312,
314
],
[
310,
315
],
[
315,
316
],
[
315,
317
],
[
310,
318
],
[
318,
319
],
[
319,
320
],
[
310,
321
],
[
321,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
322,
326
],
[
326,
327
],
[
305,
328
],
[
328,
329
],
[
303,
330
],
[
330,
331
],
[
236,
332
],
[
332,
333
],
[
332,
334
],
[
334,
335
],
[
335,
336
],
[
335,
337
],
[
334,
339
],
[
339,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
339,
344
],
[
344,
345
],
[
344,
346
],
[
339,
347
],
[
347,
348
],
[
348,
349
],
[
339,
350
],
[
350,
351
],
[
351,
352
],
[
352,
353
],
[
352,
354
],
[
351,
355
],
[
355,
356
],
[
334,
357
],
[
357,
358
],
[
332,
359
],
[
359,
360
],
[
236,
361
],
[
361,
362
],
[
361,
363
],
[
363,
364
],
[
364,
365
],
[
364,
366
],
[
363,
367
],
[
367,
368
],
[
368,
369
],
[
368,
370
],
[
370,
371
],
[
371,
372
],
[
372,
373
],
[
367,
374
],
[
374,
375
],
[
375,
376
],
[
375,
377
],
[
377,
378
],
[
378,
379
],
[
363,
380
],
[
380,
381
],
[
0,
382
],
[
382,
383
],
[
382,
384
]
]
| [
"import java.io.*;\nimport java.util.*;\n \npublic class Main{\n static class FastReader{\n BufferedReader br; \n StringTokenizer st; \n public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));} \n String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();} \n int nextInt(){return Integer.parseInt(next());} \n long nextLong(){return Long.parseLong(next());} \n double nextDouble(){return Double.parseDouble(next());} \n int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}\n long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}\n String nextLine(){String str = \"\";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;} \n }\n static int getgcd(int n1,int n2){\n while(n1 != n2){\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }\n return n1;\n }\n static boolean isSorted(int[] arr, int n){\n for(int i=1;i<n;i++){\n if(arr[i]<arr[i-1]) return false;\n }\n return true;\n }\n static boolean isPrime(long n){\n if(n==2) return true;\n else if(n%2==0) return false;\n for(int i=3;i<=n/2;i+=2){\n if(n%i==0) return false;\n }\n return true;\n }\n static void printArray(int[] arr){\n for(int x:arr){\n System.out.print(x+\" \");\n }\n System.out.println();\n }\n public static void main(String[] args) throws NumberFormatException, IOException {\n FastReader s=new FastReader(); \n int x=s.nextInt();int n=s.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=0;i<n;i++){\n hs.add(s.nextInt());\n }\n boolean test = true;\n if(!hs.contains(x)) System.out.println(x);\n else{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }\n\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n static class FastReader{\n BufferedReader br; \n StringTokenizer st; \n public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));} \n String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();} \n int nextInt(){return Integer.parseInt(next());} \n long nextLong(){return Long.parseLong(next());} \n double nextDouble(){return Double.parseDouble(next());} \n int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}\n long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}\n String nextLine(){String str = \"\";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;} \n }\n static int getgcd(int n1,int n2){\n while(n1 != n2){\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }\n return n1;\n }\n static boolean isSorted(int[] arr, int n){\n for(int i=1;i<n;i++){\n if(arr[i]<arr[i-1]) return false;\n }\n return true;\n }\n static boolean isPrime(long n){\n if(n==2) return true;\n else if(n%2==0) return false;\n for(int i=3;i<=n/2;i+=2){\n if(n%i==0) return false;\n }\n return true;\n }\n static void printArray(int[] arr){\n for(int x:arr){\n System.out.print(x+\" \");\n }\n System.out.println();\n }\n public static void main(String[] args) throws NumberFormatException, IOException {\n FastReader s=new FastReader(); \n int x=s.nextInt();int n=s.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=0;i<n;i++){\n hs.add(s.nextInt());\n }\n boolean test = true;\n if(!hs.contains(x)) System.out.println(x);\n else{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }\n\n }\n}",
"Main",
"static int getgcd(int n1,int n2){\n while(n1 != n2){\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }\n return n1;\n }",
"getgcd",
"{\n while(n1 != n2){\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }\n return n1;\n }",
"while(n1 != n2){\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }",
"n1 != n2",
"n1",
"n2",
"{\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }",
"if(n1 > n2) n1 -= n2;\n else n2 -= n1;",
"n1 > n2",
"n1",
"n2",
"n1 -= n2",
"n1",
"n2",
"n2 -= n1",
"n2",
"n1",
"return n1;",
"n1",
"int n1",
"n1",
"int n2",
"n2",
"static boolean isSorted(int[] arr, int n){\n for(int i=1;i<n;i++){\n if(arr[i]<arr[i-1]) return false;\n }\n return true;\n }",
"isSorted",
"{\n for(int i=1;i<n;i++){\n if(arr[i]<arr[i-1]) return false;\n }\n return true;\n }",
"for(int i=1;i<n;i++){\n if(arr[i]<arr[i-1]) return false;\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(arr[i]<arr[i-1]) return false;\n }",
"{\n if(arr[i]<arr[i-1]) return false;\n }",
"if(arr[i]<arr[i-1]) return false;",
"arr[i]<arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"return false;",
"false",
"return true;",
"true",
"int[] arr",
"arr",
"int n",
"n",
"static boolean isPrime(long n){\n if(n==2) return true;\n else if(n%2==0) return false;\n for(int i=3;i<=n/2;i+=2){\n if(n%i==0) return false;\n }\n return true;\n }",
"isPrime",
"{\n if(n==2) return true;\n else if(n%2==0) return false;\n for(int i=3;i<=n/2;i+=2){\n if(n%i==0) return false;\n }\n return true;\n }",
"if(n==2) return true;\n else if(n%2==0) return false;",
"n==2",
"n",
"2",
"return true;",
"true",
"if(n%2==0) return false;",
"n%2==0",
"n%2",
"n",
"2",
"0",
"return false;",
"false",
"for(int i=3;i<=n/2;i+=2){\n if(n%i==0) return false;\n }",
"int i=3;",
"int i=3;",
"i",
"3",
"i<=n/2",
"i",
"n/2",
"n",
"2",
"i+=2",
"i+=2",
"i",
"2",
"{\n if(n%i==0) return false;\n }",
"{\n if(n%i==0) return false;\n }",
"if(n%i==0) return false;",
"n%i==0",
"n%i",
"n",
"i",
"0",
"return false;",
"false",
"return true;",
"true",
"long n",
"n",
"static void printArray(int[] arr){\n for(int x:arr){\n System.out.print(x+\" \");\n }\n System.out.println();\n }",
"printArray",
"{\n for(int x:arr){\n System.out.print(x+\" \");\n }\n System.out.println();\n }",
"for(int x:arr){\n System.out.print(x+\" \");\n }",
"int x",
"arr",
"{\n System.out.print(x+\" \");\n }",
"{\n System.out.print(x+\" \");\n }",
"System.out.print(x+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"x+\" \"",
"x",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int[] arr",
"arr",
"public static void main(String[] args) throws NumberFormatException, IOException {\n FastReader s=new FastReader(); \n int x=s.nextInt();int n=s.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=0;i<n;i++){\n hs.add(s.nextInt());\n }\n boolean test = true;\n if(!hs.contains(x)) System.out.println(x);\n else{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }\n\n }",
"main",
"{\n FastReader s=new FastReader(); \n int x=s.nextInt();int n=s.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=0;i<n;i++){\n hs.add(s.nextInt());\n }\n boolean test = true;\n if(!hs.contains(x)) System.out.println(x);\n else{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }\n\n }",
"FastReader s=new FastReader();",
"s",
"new FastReader()",
"int x=s.nextInt();",
"x",
"s.nextInt()",
"s.nextInt",
"s",
"int n=s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"HashSet<Integer> hs = new HashSet<>();",
"hs",
"new HashSet<>()",
"for(int i=0;i<n;i++){\n hs.add(s.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n hs.add(s.nextInt());\n }",
"{\n hs.add(s.nextInt());\n }",
"hs.add(s.nextInt())",
"hs.add",
"hs",
"s.nextInt()",
"s.nextInt",
"s",
"boolean test = true;",
"test",
"true",
"if(!hs.contains(x)) System.out.println(x);\n else{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }",
"!hs.contains(x)",
"hs.contains(x)",
"hs.contains",
"hs",
"x",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }",
"int i=x",
"i",
"x",
"j=x;",
"j",
"x",
"while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }",
"test",
"{\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }",
"if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }",
"!hs.contains(--i)",
"hs.contains(--i)",
"hs.contains",
"hs",
"--i",
"i",
"{\n System.out.println(i);test=false;break;\n }",
"System.out.println(i)",
"System.out.println",
"System.out",
"System",
"System.out",
"i",
"test=false",
"test",
"false",
"break;",
"if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }",
"!hs.contains(++j)",
"hs.contains(++j)",
"hs.contains",
"hs",
"++j",
"j",
"{\n System.out.println(j);test=false;break;\n }",
"System.out.println(j)",
"System.out.println",
"System.out",
"System",
"System.out",
"j",
"test=false",
"test",
"false",
"break;",
"String[] args",
"args",
"static class FastReader{\n BufferedReader br; \n StringTokenizer st; \n public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));} \n String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();} \n int nextInt(){return Integer.parseInt(next());} \n long nextLong(){return Long.parseLong(next());} \n double nextDouble(){return Double.parseDouble(next());} \n int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}\n long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}\n String nextLine(){String str = \"\";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;} \n }",
"FastReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}",
"FastReader",
"{br = new BufferedReader(new InputStreamReader(System.in));}",
"br = new BufferedReader(new InputStreamReader(System.in))",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();}",
"next",
"{while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();}",
"while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}",
"try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}",
"catch (IOException e){e.printStackTrace();}",
"IOException e",
"{e.printStackTrace();}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{st = new StringTokenizer(br.readLine());}",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt(){return Integer.parseInt(next());}",
"nextInt",
"{return Integer.parseInt(next());}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong(){return Long.parseLong(next());}",
"nextLong",
"{return Long.parseLong(next());}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nextDouble(){return Double.parseDouble(next());}",
"nextDouble",
"{return Double.parseDouble(next());}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}",
"readArray",
"{int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}",
"int[] a=new int[n];",
"a",
"new int[n]",
"n",
"for (int i=0; i<n; i++) a[i]=nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=nextInt();",
"a[i]=nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}",
"readLongArray",
"{long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}",
"long[] a=new long[n];",
"a",
"new long[n]",
"n",
"for (int i=0; i<n; i++) a[i]=nextLong();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=nextLong();",
"a[i]=nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"String nextLine(){String str = \"\";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;}",
"nextLine",
"{String str = \"\";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;}",
"String str = \"\";",
"str",
"\"\"",
"try{str = br.readLine();}catch (IOException e){e.printStackTrace();}",
"catch (IOException e){e.printStackTrace();}",
"IOException e",
"{e.printStackTrace();}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{str = br.readLine();}",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main{\n static class FastReader{\n BufferedReader br; \n StringTokenizer st; \n public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));} \n String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();} \n int nextInt(){return Integer.parseInt(next());} \n long nextLong(){return Long.parseLong(next());} \n double nextDouble(){return Double.parseDouble(next());} \n int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}\n long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}\n String nextLine(){String str = \"\";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;} \n }\n static int getgcd(int n1,int n2){\n while(n1 != n2){\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }\n return n1;\n }\n static boolean isSorted(int[] arr, int n){\n for(int i=1;i<n;i++){\n if(arr[i]<arr[i-1]) return false;\n }\n return true;\n }\n static boolean isPrime(long n){\n if(n==2) return true;\n else if(n%2==0) return false;\n for(int i=3;i<=n/2;i+=2){\n if(n%i==0) return false;\n }\n return true;\n }\n static void printArray(int[] arr){\n for(int x:arr){\n System.out.print(x+\" \");\n }\n System.out.println();\n }\n public static void main(String[] args) throws NumberFormatException, IOException {\n FastReader s=new FastReader(); \n int x=s.nextInt();int n=s.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=0;i<n;i++){\n hs.add(s.nextInt());\n }\n boolean test = true;\n if(!hs.contains(x)) System.out.println(x);\n else{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }\n\n }\n}",
"public class Main{\n static class FastReader{\n BufferedReader br; \n StringTokenizer st; \n public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));} \n String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();} \n int nextInt(){return Integer.parseInt(next());} \n long nextLong(){return Long.parseLong(next());} \n double nextDouble(){return Double.parseDouble(next());} \n int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}\n long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}\n String nextLine(){String str = \"\";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;} \n }\n static int getgcd(int n1,int n2){\n while(n1 != n2){\n if(n1 > n2) n1 -= n2;\n else n2 -= n1;\n }\n return n1;\n }\n static boolean isSorted(int[] arr, int n){\n for(int i=1;i<n;i++){\n if(arr[i]<arr[i-1]) return false;\n }\n return true;\n }\n static boolean isPrime(long n){\n if(n==2) return true;\n else if(n%2==0) return false;\n for(int i=3;i<=n/2;i+=2){\n if(n%i==0) return false;\n }\n return true;\n }\n static void printArray(int[] arr){\n for(int x:arr){\n System.out.print(x+\" \");\n }\n System.out.println();\n }\n public static void main(String[] args) throws NumberFormatException, IOException {\n FastReader s=new FastReader(); \n int x=s.nextInt();int n=s.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=0;i<n;i++){\n hs.add(s.nextInt());\n }\n boolean test = true;\n if(!hs.contains(x)) System.out.println(x);\n else{\n int i=x,j=x;\n while(test){\n if(!hs.contains(--i)){\n System.out.println(i);test=false;break;\n }else if(!hs.contains(++j)){\n System.out.println(j);test=false;break;\n }\n }\n }\n\n }\n}",
"Main"
]
| import java.io.*;
import java.util.*;
public class Main{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}
String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException e){e.printStackTrace();}}return st.nextToken();}
int nextInt(){return Integer.parseInt(next());}
long nextLong(){return Long.parseLong(next());}
double nextDouble(){return Double.parseDouble(next());}
int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}
long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}
String nextLine(){String str = "";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;}
}
static int getgcd(int n1,int n2){
while(n1 != n2){
if(n1 > n2) n1 -= n2;
else n2 -= n1;
}
return n1;
}
static boolean isSorted(int[] arr, int n){
for(int i=1;i<n;i++){
if(arr[i]<arr[i-1]) return false;
}
return true;
}
static boolean isPrime(long n){
if(n==2) return true;
else if(n%2==0) return false;
for(int i=3;i<=n/2;i+=2){
if(n%i==0) return false;
}
return true;
}
static void printArray(int[] arr){
for(int x:arr){
System.out.print(x+" ");
}
System.out.println();
}
public static void main(String[] args) throws NumberFormatException, IOException {
FastReader s=new FastReader();
int x=s.nextInt();int n=s.nextInt();
HashSet<Integer> hs = new HashSet<>();
for(int i=0;i<n;i++){
hs.add(s.nextInt());
}
boolean test = true;
if(!hs.contains(x)) System.out.println(x);
else{
int i=x,j=x;
while(test){
if(!hs.contains(--i)){
System.out.println(i);test=false;break;
}else if(!hs.contains(++j)){
System.out.println(j);test=false;break;
}
}
}
}
} |
[
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,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
13,
2,
13,
40,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
14,
2,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
3,
11,
1,
41,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
14,
2,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
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
],
[
163,
11
],
[
163,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
32
],
[
32,
33
],
[
32,
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
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
14,
66
],
[
66,
67
],
[
66,
68
],
[
14,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
69,
78
],
[
78,
79
],
[
79,
80
],
[
69,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
83,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
90,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
105,
106
],
[
105,
107
],
[
99,
108
],
[
108,
109
],
[
108,
110
],
[
99,
111
],
[
14,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
112,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
132,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
147,
148
],
[
147,
149
],
[
141,
150
],
[
150,
151
],
[
150,
152
],
[
141,
153
],
[
14,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
12,
160
],
[
160,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
]
| [
"import java.security.SecureRandom;\nimport java.sql.Array;\nimport java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x=sc.nextInt();\n\n int n=sc.nextInt();\n int a[]= new int[n];\n Set<Integer> s= new HashSet<>();\n for (int i=0;i<n;i++){\n a[i]=sc.nextInt();\n s.add(a[i]);\n }\n int min=Integer.MAX_VALUE;\n int index=0;\n for (int i=x;i>=-1000;i--){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n for (int i=x;i<=1000;i++){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n System.out.println(index);\n\n\n }\n }\n\n\n\n",
"import java.security.SecureRandom;",
"SecureRandom",
"java.security",
"import java.sql.Array;",
"Array",
"java.sql",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x=sc.nextInt();\n\n int n=sc.nextInt();\n int a[]= new int[n];\n Set<Integer> s= new HashSet<>();\n for (int i=0;i<n;i++){\n a[i]=sc.nextInt();\n s.add(a[i]);\n }\n int min=Integer.MAX_VALUE;\n int index=0;\n for (int i=x;i>=-1000;i--){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n for (int i=x;i<=1000;i++){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n System.out.println(index);\n\n\n }\n }",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x=sc.nextInt();\n\n int n=sc.nextInt();\n int a[]= new int[n];\n Set<Integer> s= new HashSet<>();\n for (int i=0;i<n;i++){\n a[i]=sc.nextInt();\n s.add(a[i]);\n }\n int min=Integer.MAX_VALUE;\n int index=0;\n for (int i=x;i>=-1000;i--){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n for (int i=x;i<=1000;i++){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n System.out.println(index);\n\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x=sc.nextInt();\n\n int n=sc.nextInt();\n int a[]= new int[n];\n Set<Integer> s= new HashSet<>();\n for (int i=0;i<n;i++){\n a[i]=sc.nextInt();\n s.add(a[i]);\n }\n int min=Integer.MAX_VALUE;\n int index=0;\n for (int i=x;i>=-1000;i--){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n for (int i=x;i<=1000;i++){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n System.out.println(index);\n\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a[]= new int[n];",
"a",
"new int[n]",
"n",
"Set<Integer> s= new HashSet<>();",
"s",
"new HashSet<>()",
"for (int i=0;i<n;i++){\n a[i]=sc.nextInt();\n s.add(a[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]=sc.nextInt();\n s.add(a[i]);\n }",
"{\n a[i]=sc.nextInt();\n s.add(a[i]);\n }",
"a[i]=sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"s.add(a[i])",
"s.add",
"s",
"a[i]",
"a",
"i",
"int min=Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int index=0;",
"index",
"0",
"for (int i=x;i>=-1000;i--){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }",
"int i=x;",
"int i=x;",
"i",
"x",
"i>=-1000",
"i",
"-1000",
"1000",
"i--",
"i--",
"i",
"{\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }",
"{\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }",
"if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }",
"!s.contains(i)",
"s.contains(i)",
"s.contains",
"s",
"i",
"{\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }",
"if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }",
"min>Math.abs(x-i)",
"min",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"{\n min=Math.abs(x-i);\n index=i;\n break;\n }",
"min=Math.abs(x-i)",
"min",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"index=i",
"index",
"i",
"break;",
"for (int i=x;i<=1000;i++){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }",
"int i=x;",
"int i=x;",
"i",
"x",
"i<=1000",
"i",
"1000",
"i++",
"i++",
"i",
"{\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }",
"{\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }",
"if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }",
"!s.contains(i)",
"s.contains(i)",
"s.contains",
"s",
"i",
"{\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }",
"if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }",
"min>Math.abs(x-i)",
"min",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"{\n min=Math.abs(x-i);\n index=i;\n break;\n }",
"min=Math.abs(x-i)",
"min",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"index=i",
"index",
"i",
"break;",
"System.out.println(index)",
"System.out.println",
"System.out",
"System",
"System.out",
"index",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x=sc.nextInt();\n\n int n=sc.nextInt();\n int a[]= new int[n];\n Set<Integer> s= new HashSet<>();\n for (int i=0;i<n;i++){\n a[i]=sc.nextInt();\n s.add(a[i]);\n }\n int min=Integer.MAX_VALUE;\n int index=0;\n for (int i=x;i>=-1000;i--){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n for (int i=x;i<=1000;i++){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n System.out.println(index);\n\n\n }\n }",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x=sc.nextInt();\n\n int n=sc.nextInt();\n int a[]= new int[n];\n Set<Integer> s= new HashSet<>();\n for (int i=0;i<n;i++){\n a[i]=sc.nextInt();\n s.add(a[i]);\n }\n int min=Integer.MAX_VALUE;\n int index=0;\n for (int i=x;i>=-1000;i--){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n for (int i=x;i<=1000;i++){\n if (!s.contains(i)){\n if (min>Math.abs(x-i)){\n min=Math.abs(x-i);\n index=i;\n break;\n }\n\n }\n }\n System.out.println(index);\n\n\n }\n }",
"Main"
]
| import java.security.SecureRandom;
import java.sql.Array;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x=sc.nextInt();
int n=sc.nextInt();
int a[]= new int[n];
Set<Integer> s= new HashSet<>();
for (int i=0;i<n;i++){
a[i]=sc.nextInt();
s.add(a[i]);
}
int min=Integer.MAX_VALUE;
int index=0;
for (int i=x;i>=-1000;i--){
if (!s.contains(i)){
if (min>Math.abs(x-i)){
min=Math.abs(x-i);
index=i;
break;
}
}
}
for (int i=x;i<=1000;i++){
if (!s.contains(i)){
if (min>Math.abs(x-i)){
min=Math.abs(x-i);
index=i;
break;
}
}
}
System.out.println(index);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
40,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
62,
64
],
[
58,
65
],
[
57,
66
],
[
66,
67
],
[
66,
68
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
6,
75
],
[
75,
76
]
]
| [
"import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner scn=new Scanner(System.in);\n int x=scn.nextInt();\n int x_=x;\n int n=scn.nextInt();\n ArrayList<Integer> p=new ArrayList<>();\n \n for(int i=0;i<n;i++){\n p.add(scn.nextInt());\n }\n Collections.sort(p);\n int a=0;\n int ans=x;\n \nOUT: for(int i=0;i<p.size();i++){\n if(x<=p.get(i)||i>=p.size()){\n a=i;\n for(int j=a;j>=0;j--){\n if(x_-p.get(j)==0) x_--;\n else if(x_>p.get(j)) break;\n }\n a=Math.abs(x-x_);\n ans=x_;\n x_=x;\n \n for(int j=i;j<p.size();j++){\n if(x_-p.get(j)==0) x_++;\n else if(x_<p.get(j)||x_>x+a-1) break OUT;\n if(j>=p.size()-1) break OUT;\n }\n }\n }\n \n if(Math.abs(x_-x)<a) ans=x_;\n \n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args){\n Scanner scn=new Scanner(System.in);\n int x=scn.nextInt();\n int x_=x;\n int n=scn.nextInt();\n ArrayList<Integer> p=new ArrayList<>();\n \n for(int i=0;i<n;i++){\n p.add(scn.nextInt());\n }\n Collections.sort(p);\n int a=0;\n int ans=x;\n \nOUT: for(int i=0;i<p.size();i++){\n if(x<=p.get(i)||i>=p.size()){\n a=i;\n for(int j=a;j>=0;j--){\n if(x_-p.get(j)==0) x_--;\n else if(x_>p.get(j)) break;\n }\n a=Math.abs(x-x_);\n ans=x_;\n x_=x;\n \n for(int j=i;j<p.size();j++){\n if(x_-p.get(j)==0) x_++;\n else if(x_<p.get(j)||x_>x+a-1) break OUT;\n if(j>=p.size()-1) break OUT;\n }\n }\n }\n \n if(Math.abs(x_-x)<a) ans=x_;\n \n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scn=new Scanner(System.in);\n int x=scn.nextInt();\n int x_=x;\n int n=scn.nextInt();\n ArrayList<Integer> p=new ArrayList<>();\n \n for(int i=0;i<n;i++){\n p.add(scn.nextInt());\n }\n Collections.sort(p);\n int a=0;\n int ans=x;\n \nOUT: for(int i=0;i<p.size();i++){\n if(x<=p.get(i)||i>=p.size()){\n a=i;\n for(int j=a;j>=0;j--){\n if(x_-p.get(j)==0) x_--;\n else if(x_>p.get(j)) break;\n }\n a=Math.abs(x-x_);\n ans=x_;\n x_=x;\n \n for(int j=i;j<p.size();j++){\n if(x_-p.get(j)==0) x_++;\n else if(x_<p.get(j)||x_>x+a-1) break OUT;\n if(j>=p.size()-1) break OUT;\n }\n }\n }\n \n if(Math.abs(x_-x)<a) ans=x_;\n \n System.out.println(ans);\n }",
"main",
"{\n Scanner scn=new Scanner(System.in);\n int x=scn.nextInt();\n int x_=x;\n int n=scn.nextInt();\n ArrayList<Integer> p=new ArrayList<>();\n \n for(int i=0;i<n;i++){\n p.add(scn.nextInt());\n }\n Collections.sort(p);\n int a=0;\n int ans=x;\n \nOUT: for(int i=0;i<p.size();i++){\n if(x<=p.get(i)||i>=p.size()){\n a=i;\n for(int j=a;j>=0;j--){\n if(x_-p.get(j)==0) x_--;\n else if(x_>p.get(j)) break;\n }\n a=Math.abs(x-x_);\n ans=x_;\n x_=x;\n \n for(int j=i;j<p.size();j++){\n if(x_-p.get(j)==0) x_++;\n else if(x_<p.get(j)||x_>x+a-1) break OUT;\n if(j>=p.size()-1) break OUT;\n }\n }\n }\n \n if(Math.abs(x_-x)<a) ans=x_;\n \n System.out.println(ans);\n }",
"Scanner scn=new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int x=scn.nextInt();",
"x",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int x_=x;",
"x_",
"x",
"int n=scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"ArrayList<Integer> p=new ArrayList<>();",
"p",
"new ArrayList<>()",
"for(int i=0;i<n;i++){\n p.add(scn.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p.add(scn.nextInt());\n }",
"{\n p.add(scn.nextInt());\n }",
"p.add(scn.nextInt())",
"p.add",
"p",
"scn.nextInt()",
"scn.nextInt",
"scn",
"Collections.sort(p)",
"Collections.sort",
"Collections",
"p",
"int a=0;",
"a",
"0",
"int ans=x;",
"ans",
"x",
"if(Math.abs(x_-x)<a) ans=x_;",
"Math.abs(x_-x)<a",
"Math.abs(x_-x)",
"Math.abs",
"Math",
"x_-x",
"x_",
"x",
"a",
"ans=x_",
"ans",
"x_",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
]
| import java.util.*;
class Main{
public static void main(String[] args){
Scanner scn=new Scanner(System.in);
int x=scn.nextInt();
int x_=x;
int n=scn.nextInt();
ArrayList<Integer> p=new ArrayList<>();
for(int i=0;i<n;i++){
p.add(scn.nextInt());
}
Collections.sort(p);
int a=0;
int ans=x;
OUT: for(int i=0;i<p.size();i++){
if(x<=p.get(i)||i>=p.size()){
a=i;
for(int j=a;j>=0;j--){
if(x_-p.get(j)==0) x_--;
else if(x_>p.get(j)) break;
}
a=Math.abs(x-x_);
ans=x_;
x_=x;
for(int j=i;j<p.size();j++){
if(x_-p.get(j)==0) x_++;
else if(x_<p.get(j)||x_>x+a-1) break OUT;
if(j>=p.size()-1) break OUT;
}
}
}
if(Math.abs(x_-x)<a) ans=x_;
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
13,
41,
13,
20,
17,
41,
13,
17,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
18,
13,
13,
4,
18,
13,
2,
18,
13,
13,
13,
0,
18,
13,
18,
13,
13,
2,
18,
13,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
4,
18,
13,
17,
14,
2,
18,
13,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
4,
18,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
204,
5
],
[
204,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
8,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
8,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
47,
48
],
[
47,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
42,
53
],
[
54,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
8,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
72,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
98,
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
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
130,
132
],
[
124,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
117,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
144,
155
],
[
156,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
162,
164
],
[
157,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
143,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
176,
181
],
[
181,
182
],
[
181,
183
],
[
175,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
171,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
189,
194
],
[
194,
195
],
[
194,
196
],
[
188,
197
],
[
197,
198
],
[
198,
199
],
[
197,
200
],
[
6,
201
],
[
201,
202
],
[
0,
203
],
[
203,
204
],
[
203,
205
]
]
| [
"import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int X =sc.nextInt();\n int N =sc.nextInt();\n int P[] =new int[N];\n int R[] =new int[N];\n int Q[] =new int[100];\n int x=0;\n Q[0]=1;\n for(int j=1;j<100;j++){\n Q[j]=2;}\n for(int i=0;i<N;i++){\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}\n for(int k=0;k<100;k++){\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }\n }\n}\n \n ",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int X =sc.nextInt();\n int N =sc.nextInt();\n int P[] =new int[N];\n int R[] =new int[N];\n int Q[] =new int[100];\n int x=0;\n Q[0]=1;\n for(int j=1;j<100;j++){\n Q[j]=2;}\n for(int i=0;i<N;i++){\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}\n for(int k=0;k<100;k++){\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int X =sc.nextInt();\n int N =sc.nextInt();\n int P[] =new int[N];\n int R[] =new int[N];\n int Q[] =new int[100];\n int x=0;\n Q[0]=1;\n for(int j=1;j<100;j++){\n Q[j]=2;}\n for(int i=0;i<N;i++){\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}\n for(int k=0;k<100;k++){\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }\n }",
"main",
"{\n Scanner sc =new Scanner(System.in);\n int X =sc.nextInt();\n int N =sc.nextInt();\n int P[] =new int[N];\n int R[] =new int[N];\n int Q[] =new int[100];\n int x=0;\n Q[0]=1;\n for(int j=1;j<100;j++){\n Q[j]=2;}\n for(int i=0;i<N;i++){\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}\n for(int k=0;k<100;k++){\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }\n }",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X =sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N =sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int P[] =new int[N];",
"P",
"new int[N]",
"N",
"int R[] =new int[N];",
"R",
"new int[N]",
"N",
"int Q[] =new int[100];",
"Q",
"new int[100]",
"100",
"int x=0;",
"x",
"0",
"Q[0]=1",
"Q[0]",
"Q",
"0",
"1",
"for(int j=1;j<100;j++){\n Q[j]=2;}",
"int j=1;",
"int j=1;",
"j",
"1",
"j<100",
"j",
"100",
"j++",
"j++",
"j",
"{\n Q[j]=2;}",
"{\n Q[j]=2;}",
"Q[j]=2",
"Q[j]",
"Q",
"j",
"2",
"for(int i=0;i<N;i++){\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}",
"{\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}",
"P[i]=sc.nextInt()",
"P[i]",
"P",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"R[i]=Math.abs(P[i]-X)",
"R[i]",
"R",
"i",
"Math.abs(P[i]-X)",
"Math.abs",
"Math",
"P[i]-X",
"P[i]",
"P",
"i",
"X",
"Q[R[i]]=Q[R[i]]-1",
"Q[R[i]]",
"Q",
"R[i]",
"R",
"i",
"Q[R[i]]-1",
"Q[R[i]]",
"Q",
"R[i]",
"R",
"i",
"1",
"for(int k=0;k<100;k++){\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<100",
"k",
"100",
"k++",
"k++",
"k",
"{\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }",
"{\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }",
"if(Q[k]==2){System.out.println(X-k);System.exit(0);}",
"Q[k]==2",
"Q[k]",
"Q",
"k",
"2",
"{System.out.println(X-k);System.exit(0);}",
"System.out.println(X-k)",
"System.out.println",
"System.out",
"System",
"System.out",
"X-k",
"X",
"k",
"System.exit(0)",
"System.exit",
"System",
"0",
"if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }",
"Q[k]==1",
"Q[k]",
"Q",
"k",
"1",
"{\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }",
"for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}",
"int l=0;",
"int l=0;",
"l",
"0",
"l<N",
"l",
"N",
"l++",
"l++",
"l",
"{\n if(P[l]==X+k){x=x+1;}}",
"{\n if(P[l]==X+k){x=x+1;}}",
"if(P[l]==X+k){x=x+1;}",
"P[l]==X+k",
"P[l]",
"P",
"l",
"X+k",
"X",
"k",
"{x=x+1;}",
"x=x+1",
"x",
"x+1",
"x",
"1",
"if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}",
"x==0",
"x",
"0",
"{System.out.println(X+k);System.exit(0);}",
"System.out.println(X+k)",
"System.out.println",
"System.out",
"System",
"System.out",
"X+k",
"X",
"k",
"System.exit(0)",
"System.exit",
"System",
"0",
"{System.out.println(X-k);System.exit(0);}",
"System.out.println(X-k)",
"System.out.println",
"System.out",
"System",
"System.out",
"X-k",
"X",
"k",
"System.exit(0)",
"System.exit",
"System",
"0",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int X =sc.nextInt();\n int N =sc.nextInt();\n int P[] =new int[N];\n int R[] =new int[N];\n int Q[] =new int[100];\n int x=0;\n Q[0]=1;\n for(int j=1;j<100;j++){\n Q[j]=2;}\n for(int i=0;i<N;i++){\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}\n for(int k=0;k<100;k++){\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int X =sc.nextInt();\n int N =sc.nextInt();\n int P[] =new int[N];\n int R[] =new int[N];\n int Q[] =new int[100];\n int x=0;\n Q[0]=1;\n for(int j=1;j<100;j++){\n Q[j]=2;}\n for(int i=0;i<N;i++){\n P[i]=sc.nextInt();\n R[i]=Math.abs(P[i]-X);\n Q[R[i]]=Q[R[i]]-1;}\n for(int k=0;k<100;k++){\n if(Q[k]==2){System.out.println(X-k);System.exit(0);}\n if(Q[k]==1){\n for(int l=0;l<N;l++){\n if(P[l]==X+k){x=x+1;}}\n if(x==0){System.out.println(X+k);System.exit(0);}\n else{System.out.println(X-k);System.exit(0);}\n }\n }\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int X =sc.nextInt();
int N =sc.nextInt();
int P[] =new int[N];
int R[] =new int[N];
int Q[] =new int[100];
int x=0;
Q[0]=1;
for(int j=1;j<100;j++){
Q[j]=2;}
for(int i=0;i<N;i++){
P[i]=sc.nextInt();
R[i]=Math.abs(P[i]-X);
Q[R[i]]=Q[R[i]]-1;}
for(int k=0;k<100;k++){
if(Q[k]==2){System.out.println(X-k);System.exit(0);}
if(Q[k]==1){
for(int l=0;l<N;l++){
if(P[l]==X+k){x=x+1;}}
if(x==0){System.out.println(X+k);System.exit(0);}
else{System.out.println(X-k);System.exit(0);}
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
13,
41,
13,
13,
11,
1,
41,
13,
13,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
11,
1,
41,
13,
13,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
41,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
131,
5
],
[
131,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
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
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
8,
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
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
8,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
76,
86
],
[
86,
87
],
[
87,
88
],
[
76,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
91,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
8,
102
],
[
102,
103
],
[
102,
104
],
[
8,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
106,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
116,
117
],
[
116,
118
],
[
105,
119
],
[
119,
120
],
[
119,
121
],
[
8,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
6,
128
],
[
128,
129
],
[
0,
130
],
[
130,
131
],
[
130,
132
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> list = new ArrayList<Integer>();\n for(int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n int a = x;\n int b = x;\n for(int i = x; i >= x - 200; i--) {\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }\n for(int i = x; i <= x + 200; i++) {\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }\n int ans = a;\n if(Math.abs(a - x) > Math.abs(b - x)) ans = b;\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> list = new ArrayList<Integer>();\n for(int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n int a = x;\n int b = x;\n for(int i = x; i >= x - 200; i--) {\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }\n for(int i = x; i <= x + 200; i++) {\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }\n int ans = a;\n if(Math.abs(a - x) > Math.abs(b - x)) ans = b;\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> list = new ArrayList<Integer>();\n for(int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n int a = x;\n int b = x;\n for(int i = x; i >= x - 200; i--) {\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }\n for(int i = x; i <= x + 200; i++) {\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }\n int ans = a;\n if(Math.abs(a - x) > Math.abs(b - x)) ans = b;\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> list = new ArrayList<Integer>();\n for(int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n int a = x;\n int b = x;\n for(int i = x; i >= x - 200; i--) {\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }\n for(int i = x; i <= x + 200; i++) {\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }\n int ans = a;\n if(Math.abs(a - x) > Math.abs(b - x)) ans = b;\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ArrayList<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"for(int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n list.add(sc.nextInt());\n }",
"{\n list.add(sc.nextInt());\n }",
"list.add(sc.nextInt())",
"list.add",
"list",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a = x;",
"a",
"x",
"int b = x;",
"b",
"x",
"for(int i = x; i >= x - 200; i--) {\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }",
"int i = x;",
"int i = x;",
"i",
"x",
"i >= x - 200",
"i",
"x - 200",
"x",
"200",
"i--",
"i--",
"i",
"{\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }",
"{\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }",
"if(!list.contains(i)) {\n a = i;\n break; \n }",
"!list.contains(i)",
"list.contains(i)",
"list.contains",
"list",
"i",
"{\n a = i;\n break; \n }",
"a = i",
"a",
"i",
"break;",
"for(int i = x; i <= x + 200; i++) {\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }",
"int i = x;",
"int i = x;",
"i",
"x",
"i <= x + 200",
"i",
"x + 200",
"x",
"200",
"i++",
"i++",
"i",
"{\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }",
"{\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }",
"if(!list.contains(i)) {\n b = i;\n break; \n }",
"!list.contains(i)",
"list.contains(i)",
"list.contains",
"list",
"i",
"{\n b = i;\n break; \n }",
"b = i",
"b",
"i",
"break;",
"int ans = a;",
"ans",
"a",
"if(Math.abs(a - x) > Math.abs(b - x)) ans = b;",
"Math.abs(a - x) > Math.abs(b - x)",
"Math.abs(a - x)",
"Math.abs",
"Math",
"a - x",
"a",
"x",
"Math.abs(b - x)",
"Math.abs",
"Math",
"b - x",
"b",
"x",
"ans = b",
"ans",
"b",
"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 x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> list = new ArrayList<Integer>();\n for(int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n int a = x;\n int b = x;\n for(int i = x; i >= x - 200; i--) {\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }\n for(int i = x; i <= x + 200; i++) {\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }\n int ans = a;\n if(Math.abs(a - x) > Math.abs(b - x)) ans = b;\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 x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> list = new ArrayList<Integer>();\n for(int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n int a = x;\n int b = x;\n for(int i = x; i >= x - 200; i--) {\n if(!list.contains(i)) {\n a = i;\n break; \n }\n }\n for(int i = x; i <= x + 200; i++) {\n if(!list.contains(i)) {\n b = i;\n break; \n }\n }\n int ans = a;\n if(Math.abs(a - x) > Math.abs(b - x)) ans = b;\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
int a = x;
int b = x;
for(int i = x; i >= x - 200; i--) {
if(!list.contains(i)) {
a = i;
break;
}
}
for(int i = x; i <= x + 200; i++) {
if(!list.contains(i)) {
b = i;
break;
}
}
int ans = a;
if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
20,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
17,
30,
4,
18,
13,
2,
13,
17,
28,
13,
13,
30,
30,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
30,
14,
2,
13,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
14,
2,
2,
17,
13,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
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
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
31,
33
],
[
8,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
34,
42
],
[
42,
43
],
[
43,
44
],
[
34,
45
],
[
46,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
46,
52
],
[
52,
53
],
[
53,
54
],
[
52,
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
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
81,
83
],
[
8,
84
],
[
84,
85
],
[
84,
86
],
[
84,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
89,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
98,
107
],
[
107,
108
],
[
107,
109
],
[
8,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
121,
122
],
[
121,
123
],
[
115,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
115,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
110,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
147,
148
],
[
147,
149
],
[
139,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
139,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
6,
164
],
[
164,
165
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n HashSet<Integer> set1 = new HashSet<Integer>();\n HashSet<Integer> set2 = new HashSet<Integer>();\n int sa = 1000;\n int num = 0;\n \n for(int i=0; i<N; i++){\n int n = scanner.nextInt();\n set1.add(n);\n }\n \n for(int i=0; i<100; i++){\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }\n \n for(int i: set2){\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }\n \n if(X<=50){\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }else{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }\n \n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n HashSet<Integer> set1 = new HashSet<Integer>();\n HashSet<Integer> set2 = new HashSet<Integer>();\n int sa = 1000;\n int num = 0;\n \n for(int i=0; i<N; i++){\n int n = scanner.nextInt();\n set1.add(n);\n }\n \n for(int i=0; i<100; i++){\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }\n \n for(int i: set2){\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }\n \n if(X<=50){\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }else{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }\n \n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n HashSet<Integer> set1 = new HashSet<Integer>();\n HashSet<Integer> set2 = new HashSet<Integer>();\n int sa = 1000;\n int num = 0;\n \n for(int i=0; i<N; i++){\n int n = scanner.nextInt();\n set1.add(n);\n }\n \n for(int i=0; i<100; i++){\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }\n \n for(int i: set2){\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }\n \n if(X<=50){\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }else{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }\n \n }",
"main",
"{\n \n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n HashSet<Integer> set1 = new HashSet<Integer>();\n HashSet<Integer> set2 = new HashSet<Integer>();\n int sa = 1000;\n int num = 0;\n \n for(int i=0; i<N; i++){\n int n = scanner.nextInt();\n set1.add(n);\n }\n \n for(int i=0; i<100; i++){\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }\n \n for(int i: set2){\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }\n \n if(X<=50){\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }else{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }\n \n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int X = scanner.nextInt();",
"X",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"HashSet<Integer> set1 = new HashSet<Integer>();",
"set1",
"new HashSet<Integer>()",
"HashSet<Integer> set2 = new HashSet<Integer>();",
"set2",
"new HashSet<Integer>()",
"int sa = 1000;",
"sa",
"1000",
"int num = 0;",
"num",
"0",
"for(int i=0; i<N; i++){\n int n = scanner.nextInt();\n set1.add(n);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int n = scanner.nextInt();\n set1.add(n);\n }",
"{\n int n = scanner.nextInt();\n set1.add(n);\n }",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"set1.add(n)",
"set1.add",
"set1",
"n",
"for(int i=0; i<100; i++){\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<100",
"i",
"100",
"i++",
"i++",
"i",
"{\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }",
"{\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }",
"if(!set1.contains(i+1)){\n set2.add(i+1);\n }",
"!set1.contains(i+1)",
"set1.contains(i+1)",
"set1.contains",
"set1",
"i+1",
"i",
"1",
"{\n set2.add(i+1);\n }",
"set2.add(i+1)",
"set2.add",
"set2",
"i+1",
"i",
"1",
"for(int i: set2){\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }",
"int i",
"set2",
"{\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }",
"{\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }",
"if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }",
"Math.abs(i-X)<sa",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"sa",
"{\n sa = Math.abs(i-X);\n num = i;\n }",
"sa = Math.abs(i-X)",
"sa",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"num = i",
"num",
"i",
"if(X<=50){\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }else{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }",
"X<=50",
"X",
"50",
"{\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }",
"if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }",
"X<=Math.abs(num-X)",
"X",
"Math.abs(num-X)",
"Math.abs",
"Math",
"num-X",
"num",
"X",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n System.out.println(num);\n }",
"System.out.println(num)",
"System.out.println",
"System.out",
"System",
"System.out",
"num",
"{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }",
"if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }",
"101-X<Math.abs(num-X)",
"101-X",
"101",
"X",
"Math.abs(num-X)",
"Math.abs",
"Math",
"num-X",
"num",
"X",
"{\n System.out.println(101);\n }",
"System.out.println(101)",
"System.out.println",
"System.out",
"System",
"System.out",
"101",
"{\n System.out.println(num);\n }",
"System.out.println(num)",
"System.out.println",
"System.out",
"System",
"System.out",
"num",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n HashSet<Integer> set1 = new HashSet<Integer>();\n HashSet<Integer> set2 = new HashSet<Integer>();\n int sa = 1000;\n int num = 0;\n \n for(int i=0; i<N; i++){\n int n = scanner.nextInt();\n set1.add(n);\n }\n \n for(int i=0; i<100; i++){\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }\n \n for(int i: set2){\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }\n \n if(X<=50){\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }else{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }\n \n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n HashSet<Integer> set1 = new HashSet<Integer>();\n HashSet<Integer> set2 = new HashSet<Integer>();\n int sa = 1000;\n int num = 0;\n \n for(int i=0; i<N; i++){\n int n = scanner.nextInt();\n set1.add(n);\n }\n \n for(int i=0; i<100; i++){\n if(!set1.contains(i+1)){\n set2.add(i+1);\n }\n }\n \n for(int i: set2){\n if(Math.abs(i-X)<sa){\n sa = Math.abs(i-X);\n num = i;\n }\n }\n \n if(X<=50){\n if(X<=Math.abs(num-X)){\n System.out.println(0);\n }else{\n System.out.println(num);\n }\n }else{\n if(101-X<Math.abs(num-X)){\n System.out.println(101);\n }else{\n System.out.println(num);\n }\n }\n \n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
int X = scanner.nextInt();
int N = scanner.nextInt();
HashSet<Integer> set1 = new HashSet<Integer>();
HashSet<Integer> set2 = new HashSet<Integer>();
int sa = 1000;
int num = 0;
for(int i=0; i<N; i++){
int n = scanner.nextInt();
set1.add(n);
}
for(int i=0; i<100; i++){
if(!set1.contains(i+1)){
set2.add(i+1);
}
}
for(int i: set2){
if(Math.abs(i-X)<sa){
sa = Math.abs(i-X);
num = i;
}
}
if(X<=50){
if(X<=Math.abs(num-X)){
System.out.println(0);
}else{
System.out.println(num);
}
}else{
if(101-X<Math.abs(num-X)){
System.out.println(101);
}else{
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,
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,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
13,
13,
29,
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,
13,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
40,
13,
30,
41,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
28,
13,
4,
18,
13,
30,
30,
4,
18,
13,
4,
18,
13,
29,
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
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
211,
26
],
[
211,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
29,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
29,
40
],
[
40,
41
],
[
40,
42
],
[
29,
43
],
[
43,
44
],
[
43,
45
],
[
29,
46
],
[
46,
47
],
[
46,
48
],
[
29,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
49,
53
],
[
49,
54
],
[
29,
55
],
[
55,
56
],
[
56,
57
],
[
27,
58
],
[
58,
59
],
[
211,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
71,
72
],
[
64,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
79,
80
],
[
64,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
85,
90
],
[
64,
91
],
[
91,
92
],
[
91,
93
],
[
64,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
95,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
115,
116
],
[
116,
117
],
[
64,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
64,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
64,
127
],
[
127,
128
],
[
127,
129
],
[
64,
130
],
[
130,
131
],
[
130,
132
],
[
64,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
133,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
146,
154
],
[
154,
155
],
[
155,
156
],
[
146,
157
],
[
158,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
162,
164
],
[
159,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
145,
170
],
[
170,
171
],
[
171,
172
],
[
170,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
176,
179
],
[
179,
180
],
[
179,
181
],
[
173,
182
],
[
182,
183
],
[
183,
184
],
[
182,
185
],
[
182,
186
],
[
145,
187
],
[
187,
188
],
[
187,
189
],
[
64,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
190,
195
],
[
196,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
197,
200
],
[
200,
201
],
[
201,
202
],
[
196,
203
],
[
62,
204
],
[
204,
205
],
[
62,
206
],
[
206,
207
],
[
62,
208
],
[
208,
209
],
[
0,
210
],
[
210,
211
],
[
210,
212
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.TreeMap;\nimport java.util.Map;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\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 C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n // 入力\n int x = Integer.parseInt(in.next());\n int n = Integer.parseInt(in.next());\n\n if (n == 0) {\n out.println(x);\n return;\n }\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }\n Arrays.sort(p);\n int ans = Integer.MAX_VALUE;\n boolean ng = false;\n Map<Integer, Integer> mp = new TreeMap<>();\n for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }\n\n // 出力\n for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.TreeMap;",
"TreeMap",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"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 C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n // 入力\n int x = Integer.parseInt(in.next());\n int n = Integer.parseInt(in.next());\n\n if (n == 0) {\n out.println(x);\n return;\n }\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }\n Arrays.sort(p);\n int ans = Integer.MAX_VALUE;\n boolean ng = false;\n Map<Integer, Integer> mp = new TreeMap<>();\n for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }\n\n // 出力\n for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }\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 C solver = new C();\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 C solver = new C();\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)",
"C solver = new C();",
"solver",
"new C()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class C {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n // 入力\n int x = Integer.parseInt(in.next());\n int n = Integer.parseInt(in.next());\n\n if (n == 0) {\n out.println(x);\n return;\n }\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }\n Arrays.sort(p);\n int ans = Integer.MAX_VALUE;\n boolean ng = false;\n Map<Integer, Integer> mp = new TreeMap<>();\n for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }\n\n // 出力\n for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }\n }\n\n }",
"C",
"public void solve(int testNumber, Scanner in, PrintWriter out) {\n // 入力\n int x = Integer.parseInt(in.next());\n int n = Integer.parseInt(in.next());\n\n if (n == 0) {\n out.println(x);\n return;\n }\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }\n Arrays.sort(p);\n int ans = Integer.MAX_VALUE;\n boolean ng = false;\n Map<Integer, Integer> mp = new TreeMap<>();\n for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }\n\n // 出力\n for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }\n }",
"solve",
"{\n // 入力\n int x = Integer.parseInt(in.next());\n int n = Integer.parseInt(in.next());\n\n if (n == 0) {\n out.println(x);\n return;\n }\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }\n Arrays.sort(p);\n int ans = Integer.MAX_VALUE;\n boolean ng = false;\n Map<Integer, Integer> mp = new TreeMap<>();\n for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }\n\n // 出力\n for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }\n }",
"int x = Integer.parseInt(in.next());",
"x",
"Integer.parseInt(in.next())",
"Integer.parseInt",
"Integer",
"in.next()",
"in.next",
"in",
"int n = Integer.parseInt(in.next());",
"n",
"Integer.parseInt(in.next())",
"Integer.parseInt",
"Integer",
"in.next()",
"in.next",
"in",
"if (n == 0) {\n out.println(x);\n return;\n }",
"n == 0",
"n",
"0",
"{\n out.println(x);\n return;\n }",
"out.println(x)",
"out.println",
"out",
"x",
"return;",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i] = Integer.parseInt(in.next());\n }",
"{\n p[i] = Integer.parseInt(in.next());\n }",
"p[i] = Integer.parseInt(in.next())",
"p[i]",
"p",
"i",
"Integer.parseInt(in.next())",
"Integer.parseInt",
"Integer",
"in.next()",
"in.next",
"in",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"int ans = Integer.MAX_VALUE;",
"ans",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"boolean ng = false;",
"ng",
"false",
"Map<Integer, Integer> mp = new TreeMap<>();",
"mp",
"new TreeMap<>()",
"for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }",
"int i = 101;",
"int i = 101;",
"i",
"101",
"i >= 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }",
"{\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }",
"for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if (i == p[j]) {\n ng = true;\n break;\n }\n }",
"{\n if (i == p[j]) {\n ng = true;\n break;\n }\n }",
"if (i == p[j]) {\n ng = true;\n break;\n }",
"i == p[j]",
"i",
"p[j]",
"p",
"j",
"{\n ng = true;\n break;\n }",
"ng = true",
"ng",
"true",
"break;",
"if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }",
"!ng",
"ng",
"{\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }",
"int tmp = Math.abs(x - i);",
"tmp",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"mp.put(tmp, i)",
"mp.put",
"mp",
"tmp",
"i",
"ng = false",
"ng",
"false",
"for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }",
"Integer val",
"mp.values()",
"mp.values",
"mp",
"{\n out.println(val.toString());\n return;\n }",
"{\n out.println(val.toString());\n return;\n }",
"out.println(val.toString())",
"out.println",
"out",
"val.toString()",
"val.toString",
"val",
"return;",
"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 C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n // 入力\n int x = Integer.parseInt(in.next());\n int n = Integer.parseInt(in.next());\n\n if (n == 0) {\n out.println(x);\n return;\n }\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }\n Arrays.sort(p);\n int ans = Integer.MAX_VALUE;\n boolean ng = false;\n Map<Integer, Integer> mp = new TreeMap<>();\n for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }\n\n // 出力\n for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n // 入力\n int x = Integer.parseInt(in.next());\n int n = Integer.parseInt(in.next());\n\n if (n == 0) {\n out.println(x);\n return;\n }\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = Integer.parseInt(in.next());\n }\n Arrays.sort(p);\n int ans = Integer.MAX_VALUE;\n boolean ng = false;\n Map<Integer, Integer> mp = new TreeMap<>();\n for (int i = 101; i >= 0; i--) {\n for (int j = 0; j < n; j++) {\n if (i == p[j]) {\n ng = true;\n break;\n }\n }\n if (!ng) {\n int tmp = Math.abs(x - i);\n mp.put(tmp, i);\n }\n ng = false;\n\n }\n\n // 出力\n for (Integer val : mp.values()) {\n out.println(val.toString());\n return;\n }\n }\n\n }\n}",
"Main"
]
| import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.Map;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
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);
C solver = new C();
solver.solve(1, in, out);
out.close();
}
static class C {
public void solve(int testNumber, Scanner in, PrintWriter out) {
// 入力
int x = Integer.parseInt(in.next());
int n = Integer.parseInt(in.next());
if (n == 0) {
out.println(x);
return;
}
int[] p = new int[n];
for (int i = 0; i < n; i++) {
p[i] = Integer.parseInt(in.next());
}
Arrays.sort(p);
int ans = Integer.MAX_VALUE;
boolean ng = false;
Map<Integer, Integer> mp = new TreeMap<>();
for (int i = 101; i >= 0; i--) {
for (int j = 0; j < n; j++) {
if (i == p[j]) {
ng = true;
break;
}
}
if (!ng) {
int tmp = Math.abs(x - i);
mp.put(tmp, i);
}
ng = false;
}
// 出力
for (Integer val : mp.values()) {
out.println(val.toString());
return;
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
2,
13,
17,
41,
13,
2,
13,
17,
42,
2,
2,
13,
17,
2,
13,
17,
30,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
40,
13,
40,
13,
42,
2,
13,
17,
30,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
40,
13,
42,
2,
13,
40,
17,
30,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
40,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
178,
5
],
[
178,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
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
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
44,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
73,
80
],
[
8,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
8,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
106,
113
],
[
99,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
114,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
120,
127
],
[
99,
128
],
[
128,
129
],
[
99,
130
],
[
130,
131
],
[
8,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
143,
150
],
[
136,
151
],
[
151,
152
],
[
8,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
153,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
159,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
165,
172
],
[
158,
173
],
[
173,
174
],
[
6,
175
],
[
175,
176
],
[
0,
177
],
[
177,
178
],
[
177,
179
]
]
| [
"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\tint x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint hako[] = new int[102];\n\t\tfor(int i=0;i<102;i++) {\n\t\t\thako[i]=0;\n\t\t}\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}\n\t\t\n\t\tif(hako[x]==0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint up=x+1;\n\t\tint down=x-1;\n\t\t\n\t\twhile(up<=101 && down>=0) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}\n\t\twhile(up==102) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}\n\t\twhile(down==-1) {\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}\n\t\t\n\t\t\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint hako[] = new int[102];\n\t\tfor(int i=0;i<102;i++) {\n\t\t\thako[i]=0;\n\t\t}\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}\n\t\t\n\t\tif(hako[x]==0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint up=x+1;\n\t\tint down=x-1;\n\t\t\n\t\twhile(up<=101 && down>=0) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}\n\t\twhile(up==102) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}\n\t\twhile(down==-1) {\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}\n\t\t\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint hako[] = new int[102];\n\t\tfor(int i=0;i<102;i++) {\n\t\t\thako[i]=0;\n\t\t}\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}\n\t\t\n\t\tif(hako[x]==0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint up=x+1;\n\t\tint down=x-1;\n\t\t\n\t\twhile(up<=101 && down>=0) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}\n\t\twhile(up==102) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}\n\t\twhile(down==-1) {\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}\n\t\t\n\t\t\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint hako[] = new int[102];\n\t\tfor(int i=0;i<102;i++) {\n\t\t\thako[i]=0;\n\t\t}\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}\n\t\t\n\t\tif(hako[x]==0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint up=x+1;\n\t\tint down=x-1;\n\t\t\n\t\twhile(up<=101 && down>=0) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}\n\t\twhile(up==102) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}\n\t\twhile(down==-1) {\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}\n\t\t\n\t\t\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int hako[] = new int[102];",
"hako",
"new int[102]",
"102",
"for(int i=0;i<102;i++) {\n\t\t\thako[i]=0;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<102",
"i",
"102",
"i++",
"i++",
"i",
"{\n\t\t\thako[i]=0;\n\t\t}",
"{\n\t\t\thako[i]=0;\n\t\t}",
"hako[i]=0",
"hako[i]",
"hako",
"i",
"0",
"for(int i=0;i<n;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}",
"{\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"hako[a] = 1",
"hako[a]",
"hako",
"a",
"1",
"if(hako[x]==0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"hako[x]==0",
"hako[x]",
"hako",
"x",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int up=x+1;",
"up",
"x+1",
"x",
"1",
"int down=x-1;",
"down",
"x-1",
"x",
"1",
"while(up<=101 && down>=0) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}",
"up<=101 && down>=0",
"up<=101",
"up",
"101",
"down>=0",
"down",
"0",
"{\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}",
"if(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}",
"hako[down] == 0",
"hako[down]",
"hako",
"down",
"0",
"{\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(down)",
"System.out.println",
"System.out",
"System",
"System.out",
"down",
"return;",
"if(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}",
"hako[up] == 0",
"hako[up]",
"hako",
"up",
"0",
"{\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(up)",
"System.out.println",
"System.out",
"System",
"System.out",
"up",
"return;",
"up++",
"up",
"down--",
"down",
"while(up==102) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}",
"up==102",
"up",
"102",
"{\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}",
"if(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}",
"hako[down] == 0",
"hako[down]",
"hako",
"down",
"0",
"{\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(down)",
"System.out.println",
"System.out",
"System",
"System.out",
"down",
"return;",
"down--",
"down",
"while(down==-1) {\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}",
"down==-1",
"down",
"-1",
"1",
"{\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}",
"if(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}",
"hako[up] == 0",
"hako[up]",
"hako",
"up",
"0",
"{\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(up)",
"System.out.println",
"System.out",
"System",
"System.out",
"up",
"return;",
"up++",
"up",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint hako[] = new int[102];\n\t\tfor(int i=0;i<102;i++) {\n\t\t\thako[i]=0;\n\t\t}\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}\n\t\t\n\t\tif(hako[x]==0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint up=x+1;\n\t\tint down=x-1;\n\t\t\n\t\twhile(up<=101 && down>=0) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}\n\t\twhile(up==102) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}\n\t\twhile(down==-1) {\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}\n\t\t\n\t\t\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint hako[] = new int[102];\n\t\tfor(int i=0;i<102;i++) {\n\t\t\thako[i]=0;\n\t\t}\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\thako[a] = 1;\n\t\t}\n\t\t\n\t\tif(hako[x]==0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tint up=x+1;\n\t\tint down=x-1;\n\t\t\n\t\twhile(up<=101 && down>=0) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t\tdown--;\n\t\t}\n\t\twhile(up==102) {\n\t\t\tif(hako[down] == 0) {\n\t\t\t\tSystem.out.println(down);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdown--;\n\t\t}\n\t\twhile(down==-1) {\n\t\t\tif(hako[up] == 0) {\n\t\t\t\tSystem.out.println(up);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tup++;\n\t\t}\n\t\t\n\t\t\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x=sc.nextInt();
int n=sc.nextInt();
int hako[] = new int[102];
for(int i=0;i<102;i++) {
hako[i]=0;
}
for(int i=0;i<n;i++) {
int a = sc.nextInt();
hako[a] = 1;
}
if(hako[x]==0) {
System.out.println(x);
return;
}
int up=x+1;
int down=x-1;
while(up<=101 && down>=0) {
if(hako[down] == 0) {
System.out.println(down);
return;
}
if(hako[up] == 0) {
System.out.println(up);
return;
}
up++;
down--;
}
while(up==102) {
if(hako[down] == 0) {
System.out.println(down);
return;
}
down--;
}
while(down==-1) {
if(hako[up] == 0) {
System.out.println(up);
return;
}
up++;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
14,
2,
13,
17,
30,
29,
13,
41,
13,
4,
13,
13,
13,
11,
1,
41,
13,
13,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
11,
1,
41,
13,
13,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
14,
2,
2,
13,
13,
2,
13,
13,
30,
0,
13,
13,
3,
29,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
140,
8
],
[
140,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
12,
17
],
[
17,
18
],
[
9,
19
],
[
19,
20
],
[
140,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
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
],
[
40,
43
],
[
43,
44
],
[
44,
45
],
[
23,
46
],
[
46,
47
],
[
21,
48
],
[
48,
49
],
[
21,
50
],
[
50,
51
],
[
140,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
56,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
56,
70
],
[
70,
71
],
[
70,
72
],
[
56,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
56,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
82,
85
],
[
56,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
92,
93
],
[
86,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
56,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
113,
114
],
[
107,
115
],
[
116,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
117,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
129,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
123,
136
],
[
56,
137
],
[
137,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
]
]
| [
"import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n System.out.println(run());\n }\n\n private static ArrayList<Integer> nScan(Scanner sc, int n) {\n ArrayList<Integer> al = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n al.add(sc.nextInt());\n }\n return al;\n }\n\n private static Object run() {\n try (Scanner sc = new Scanner(System.in);) {\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }\n }\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n System.out.println(run());\n }\n\n private static ArrayList<Integer> nScan(Scanner sc, int n) {\n ArrayList<Integer> al = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n al.add(sc.nextInt());\n }\n return al;\n }\n\n private static Object run() {\n try (Scanner sc = new Scanner(System.in);) {\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n System.out.println(run());\n }",
"main",
"{\n System.out.println(run());\n }",
"System.out.println(run())",
"System.out.println",
"System.out",
"System",
"System.out",
"run()",
"run",
"String[] args",
"args",
"private static ArrayList<Integer> nScan(Scanner sc, int n) {\n ArrayList<Integer> al = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n al.add(sc.nextInt());\n }\n return al;\n }",
"nScan",
"{\n ArrayList<Integer> al = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n al.add(sc.nextInt());\n }\n return al;\n }",
"ArrayList<Integer> al = new ArrayList<>();",
"al",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n al.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n al.add(sc.nextInt());\n }",
"{\n al.add(sc.nextInt());\n }",
"al.add(sc.nextInt())",
"al.add",
"al",
"sc.nextInt()",
"sc.nextInt",
"sc",
"return al;",
"al",
"Scanner sc",
"sc",
"int n",
"n",
"private static Object run() {\n try (Scanner sc = new Scanner(System.in);) {\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }\n }",
"run",
"{\n try (Scanner sc = new Scanner(System.in);) {\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }\n }",
"try (Scanner sc = new Scanner(System.in);) {\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }",
"{\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int x = sc.nextInt()",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"result = 0;",
"result",
"0",
"if (n == 0) {\n return x;\n }",
"n == 0",
"n",
"0",
"{\n return x;\n }",
"return x;",
"x",
"ArrayList<Integer> p = nScan(sc, n);",
"p",
"nScan(sc, n)",
"nScan",
"sc",
"n",
"for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }",
"int i = x;",
"int i = x;",
"i",
"x",
"i++",
"i++",
"i",
"{\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }",
"{\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }",
"if (!p.contains(i)) {\n result = i;\n break;\n }",
"!p.contains(i)",
"p.contains(i)",
"p.contains",
"p",
"i",
"{\n result = i;\n break;\n }",
"result = i",
"result",
"i",
"break;",
"for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }",
"int i = x;",
"int i = x;",
"i",
"x",
"i--",
"i--",
"i",
"{\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }",
"{\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }",
"if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }",
"!p.contains(i)",
"p.contains(i)",
"p.contains",
"p",
"i",
"{\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }",
"if (result - x >= x - i) {\n result = i;\n }",
"result - x >= x - i",
"result - x",
"result",
"x",
"x - i",
"x",
"i",
"{\n result = i;\n }",
"result = i",
"result",
"i",
"break;",
"return result;",
"result",
"public class Main {\n public static void main(String[] args) {\n System.out.println(run());\n }\n\n private static ArrayList<Integer> nScan(Scanner sc, int n) {\n ArrayList<Integer> al = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n al.add(sc.nextInt());\n }\n return al;\n }\n\n private static Object run() {\n try (Scanner sc = new Scanner(System.in);) {\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n System.out.println(run());\n }\n\n private static ArrayList<Integer> nScan(Scanner sc, int n) {\n ArrayList<Integer> al = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n al.add(sc.nextInt());\n }\n return al;\n }\n\n private static Object run() {\n try (Scanner sc = new Scanner(System.in);) {\n int x = sc.nextInt(), n = sc.nextInt(), result = 0;\n if (n == 0) {\n return x;\n }\n ArrayList<Integer> p = nScan(sc, n);\n for (int i = x;;i++) {\n if (!p.contains(i)) {\n result = i;\n break;\n }\n }\n for (int i = x;;i--) {\n if (!p.contains(i)) {\n if (result - x >= x - i) {\n result = i;\n }\n break;\n }\n }\n return result;\n }\n }\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println(run());
}
private static ArrayList<Integer> nScan(Scanner sc, int n) {
ArrayList<Integer> al = new ArrayList<>();
for (int i = 0; i < n; i++) {
al.add(sc.nextInt());
}
return al;
}
private static Object run() {
try (Scanner sc = new Scanner(System.in);) {
int x = sc.nextInt(), n = sc.nextInt(), result = 0;
if (n == 0) {
return x;
}
ArrayList<Integer> p = nScan(sc, n);
for (int i = x;;i++) {
if (!p.contains(i)) {
result = i;
break;
}
}
for (int i = x;;i--) {
if (!p.contains(i)) {
if (result - x >= x - i) {
result = i;
}
break;
}
}
return result;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
40,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
11,
1,
41,
13,
2,
13,
13,
2,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
18,
4,
18,
13,
13,
13,
9,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
13,
9,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
3,
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
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
54,
61
],
[
8,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
62,
74
],
[
74,
75
],
[
75,
76
],
[
62,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
80,
86
],
[
79,
87
],
[
78,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
99,
100
],
[
99,
101
],
[
88,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
78,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
112,
113
],
[
112,
114
],
[
108,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
118,
119
],
[
118,
120
],
[
107,
121
],
[
8,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
8,
128
],
[
128,
129
],
[
129,
130
],
[
6,
131
],
[
131,
132
]
]
| [
"import java.util.*;\n\nclass Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\tint x = sc.nextInt();\n\tint n = sc.nextInt();\t \n Integer[] p = new Integer[n];\t\n for (int i=0; i<n; i++) {\t\n p[i] =sc.nextInt();\t \n }\t\n int sub = -100;\n if (n==0) {\n System.out.println(x);\n return;\n }\t \t\n for (int i=x-n; i<x+n; i++) {\t\n if ( Arrays.asList(p).contains(i))\n continue;\n if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }\n if ( Math.abs(x-sub) < Math.abs(x-i))\n break; \n }\n System.out.println(sub);\n sc.close();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\tint x = sc.nextInt();\n\tint n = sc.nextInt();\t \n Integer[] p = new Integer[n];\t\n for (int i=0; i<n; i++) {\t\n p[i] =sc.nextInt();\t \n }\t\n int sub = -100;\n if (n==0) {\n System.out.println(x);\n return;\n }\t \t\n for (int i=x-n; i<x+n; i++) {\t\n if ( Arrays.asList(p).contains(i))\n continue;\n if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }\n if ( Math.abs(x-sub) < Math.abs(x-i))\n break; \n }\n System.out.println(sub);\n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\tint x = sc.nextInt();\n\tint n = sc.nextInt();\t \n Integer[] p = new Integer[n];\t\n for (int i=0; i<n; i++) {\t\n p[i] =sc.nextInt();\t \n }\t\n int sub = -100;\n if (n==0) {\n System.out.println(x);\n return;\n }\t \t\n for (int i=x-n; i<x+n; i++) {\t\n if ( Arrays.asList(p).contains(i))\n continue;\n if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }\n if ( Math.abs(x-sub) < Math.abs(x-i))\n break; \n }\n System.out.println(sub);\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\tint x = sc.nextInt();\n\tint n = sc.nextInt();\t \n Integer[] p = new Integer[n];\t\n for (int i=0; i<n; i++) {\t\n p[i] =sc.nextInt();\t \n }\t\n int sub = -100;\n if (n==0) {\n System.out.println(x);\n return;\n }\t \t\n for (int i=x-n; i<x+n; i++) {\t\n if ( Arrays.asList(p).contains(i))\n continue;\n if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }\n if ( Math.abs(x-sub) < Math.abs(x-i))\n break; \n }\n System.out.println(sub);\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Integer[] p = new Integer[n];",
"p",
"new Integer[n]",
"n",
"for (int i=0; i<n; i++) {\t\n p[i] =sc.nextInt();\t \n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\t\n p[i] =sc.nextInt();\t \n }",
"{\t\n p[i] =sc.nextInt();\t \n }",
"p[i] =sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int sub = -100;",
"sub",
"-100",
"100",
"if (n==0) {\n System.out.println(x);\n return;\n }",
"n==0",
"n",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"for (int i=x-n; i<x+n; i++) {\t\n if ( Arrays.asList(p).contains(i))\n continue;\n if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }\n if ( Math.abs(x-sub) < Math.abs(x-i))\n break; \n }",
"int i=x-n;",
"int i=x-n;",
"i",
"x-n",
"x",
"n",
"i<x+n",
"i",
"x+n",
"x",
"n",
"i++",
"i++",
"i",
"{\t\n if ( Arrays.asList(p).contains(i))\n continue;\n if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }\n if ( Math.abs(x-sub) < Math.abs(x-i))\n break; \n }",
"{\t\n if ( Arrays.asList(p).contains(i))\n continue;\n if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }\n if ( Math.abs(x-sub) < Math.abs(x-i))\n break; \n }",
"if ( Arrays.asList(p).contains(i))\n continue;",
"Arrays.asList(p).contains(i)",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"i",
"continue;",
"if ( Math.abs(x-sub) > Math.abs(x-i) ){\n sub = i;\n continue;\n }",
"Math.abs(x-sub) > Math.abs(x-i)",
"Math.abs(x-sub)",
"Math.abs",
"Math",
"x-sub",
"x",
"sub",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"{\n sub = i;\n continue;\n }",
"sub = i",
"sub",
"i",
"continue;",
"if ( Math.abs(x-sub) < Math.abs(x-i))\n break;",
"Math.abs(x-sub) < Math.abs(x-i)",
"Math.abs(x-sub)",
"Math.abs",
"Math",
"x-sub",
"x",
"sub",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"break;",
"System.out.println(sub)",
"System.out.println",
"System.out",
"System",
"System.out",
"sub",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args"
]
| import java.util.*;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
Integer[] p = new Integer[n];
for (int i=0; i<n; i++) {
p[i] =sc.nextInt();
}
int sub = -100;
if (n==0) {
System.out.println(x);
return;
}
for (int i=x-n; i<x+n; i++) {
if ( Arrays.asList(p).contains(i))
continue;
if ( Math.abs(x-sub) > Math.abs(x-i) ){
sub = i;
continue;
}
if ( Math.abs(x-sub) < Math.abs(x-i))
break;
}
System.out.println(sub);
sc.close();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
14,
2,
2,
13,
17,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
118,
5
],
[
118,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
50,
67
],
[
67,
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
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
81,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
88,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
103,
104
],
[
103,
105
],
[
97,
106
],
[
106,
107
],
[
106,
108
],
[
67,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
6,
115
],
[
115,
116
],
[
0,
117
],
[
117,
118
],
[
117,
119
]
]
| [
"import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n //入力\n int x =sc.nextInt();//整数\n int n =sc.nextInt();//数列の長さ\n int ans = 0;\n int min = 100;\n \n //数列listの空箱用意\n List<Integer> s = new ArrayList<Integer>();\n \n //数列のlist作成\n for(int i =0; i<n; i++){\n \t\ts.add(sc.nextInt());\n } \n //数列がないとき\n\t\tif(n == 0 || !(s.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}\n \n \telse {\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n //入力\n int x =sc.nextInt();//整数\n int n =sc.nextInt();//数列の長さ\n int ans = 0;\n int min = 100;\n \n //数列listの空箱用意\n List<Integer> s = new ArrayList<Integer>();\n \n //数列のlist作成\n for(int i =0; i<n; i++){\n \t\ts.add(sc.nextInt());\n } \n //数列がないとき\n\t\tif(n == 0 || !(s.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}\n \n \telse {\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n //入力\n int x =sc.nextInt();//整数\n int n =sc.nextInt();//数列の長さ\n int ans = 0;\n int min = 100;\n \n //数列listの空箱用意\n List<Integer> s = new ArrayList<Integer>();\n \n //数列のlist作成\n for(int i =0; i<n; i++){\n \t\ts.add(sc.nextInt());\n } \n //数列がないとき\n\t\tif(n == 0 || !(s.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}\n \n \telse {\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n //入力\n int x =sc.nextInt();//整数\n int n =sc.nextInt();//数列の長さ\n int ans = 0;\n int min = 100;\n \n //数列listの空箱用意\n List<Integer> s = new ArrayList<Integer>();\n \n //数列のlist作成\n for(int i =0; i<n; i++){\n \t\ts.add(sc.nextInt());\n } \n //数列がないとき\n\t\tif(n == 0 || !(s.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}\n \n \telse {\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x =sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n =sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"int min = 100;",
"min",
"100",
"List<Integer> s = new ArrayList<Integer>();",
"s",
"new ArrayList<Integer>()",
"for(int i =0; i<n; i++){\n \t\ts.add(sc.nextInt());\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \t\ts.add(sc.nextInt());\n }",
"{\n \t\ts.add(sc.nextInt());\n }",
"s.add(sc.nextInt())",
"s.add",
"s",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n == 0 || !(s.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}\n \n \telse {\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }",
"n == 0 || !(s.contains(x))",
"n == 0",
"n",
"0",
"!(s.contains(x))",
"(s.contains(x))",
"s.contains",
"s",
"x",
"{\n\t\t\tSystem.out.println(x);\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }",
"for(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }",
"{\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }",
"if(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }",
"!(s.contains(i))",
"(s.contains(i))",
"s.contains",
"s",
"i",
"{\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }",
"if(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }",
"Math.abs(x - i) < min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"min",
"{\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }",
"min = Math.abs(x - i)",
"min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"ans = i",
"ans",
"i",
"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 \n //入力\n int x =sc.nextInt();//整数\n int n =sc.nextInt();//数列の長さ\n int ans = 0;\n int min = 100;\n \n //数列listの空箱用意\n List<Integer> s = new ArrayList<Integer>();\n \n //数列のlist作成\n for(int i =0; i<n; i++){\n \t\ts.add(sc.nextInt());\n } \n //数列がないとき\n\t\tif(n == 0 || !(s.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}\n \n \telse {\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }\n }\n}",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n //入力\n int x =sc.nextInt();//整数\n int n =sc.nextInt();//数列の長さ\n int ans = 0;\n int min = 100;\n \n //数列listの空箱用意\n List<Integer> s = new ArrayList<Integer>();\n \n //数列のlist作成\n for(int i =0; i<n; i++){\n \t\ts.add(sc.nextInt());\n } \n //数列がないとき\n\t\tif(n == 0 || !(s.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t}\n \n \telse {\n\t\t\tfor(int i =0; i<=200; i++) {\n //数列に含まれていない整数か\n\t\t\t\tif(!(s.contains(i))) {\n //絶対値が小さい整数を求める\n\t\t\t\t\tif(Math.abs(x - i) < min) {\n //最小値を更新する\n\t\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\t\tans = i;\n }\n }\n }\n System.out.println(ans);\n }\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
//入力
int x =sc.nextInt();//整数
int n =sc.nextInt();//数列の長さ
int ans = 0;
int min = 100;
//数列listの空箱用意
List<Integer> s = new ArrayList<Integer>();
//数列のlist作成
for(int i =0; i<n; i++){
s.add(sc.nextInt());
}
//数列がないとき
if(n == 0 || !(s.contains(x))) {
System.out.println(x);
}
else {
for(int i =0; i<=200; i++) {
//数列に含まれていない整数か
if(!(s.contains(i))) {
//絶対値が小さい整数を求める
if(Math.abs(x - i) < min) {
//最小値を更新する
min = Math.abs(x - i);
ans = i;
}
}
}
System.out.println(ans);
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
20,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
4,
18,
13,
13,
30,
41,
13,
20,
42,
2,
40,
13,
17,
4,
18,
13,
4,
18,
13,
41,
13,
17,
42,
17,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
3,
14,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
3,
40,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
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,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
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,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
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,
11,
1,
41,
13,
17,
41,
13,
18,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
4,
18,
13,
2,
13,
13,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
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,
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,
20,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
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,
12,
13,
30,
29,
2,
2,
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
],
[
494,
11
],
[
494,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
14,
21
],
[
21,
22
],
[
21,
23
],
[
14,
24
],
[
24,
25
],
[
24,
26
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
27,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
32,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
55,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
51,
66
],
[
66,
67
],
[
66,
68
],
[
51,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
71,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
88,
93
],
[
82,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
94,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
100,
105
],
[
71,
106
],
[
106,
107
],
[
14,
108
],
[
108,
109
],
[
109,
110
],
[
12,
111
],
[
111,
112
],
[
494,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
113,
121
],
[
121,
122
],
[
113,
123
],
[
123,
124
],
[
113,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
125,
133
],
[
133,
134
],
[
113,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
138,
143
],
[
143,
144
],
[
137,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
153,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
162,
165
],
[
149,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
170,
171
],
[
171,
172
],
[
137,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
113,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
180,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
185,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
180,
194
],
[
194,
195
],
[
194,
196
],
[
180,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
201,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
180,
210
],
[
210,
211
],
[
210,
212
],
[
180,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
218,
219
],
[
219,
220
],
[
219,
221
],
[
218,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
224,
226
],
[
218,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
180,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
113,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
237,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
242,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
237,
251
],
[
251,
252
],
[
251,
253
],
[
237,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
258,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
237,
267
],
[
267,
268
],
[
267,
269
],
[
237,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
270,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
275,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
281,
283
],
[
275,
284
],
[
284,
285
],
[
284,
286
],
[
286,
287
],
[
237,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
113,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
299
],
[
299,
300
],
[
300,
301
],
[
301,
302
],
[
301,
303
],
[
299,
304
],
[
304,
305
],
[
304,
306
],
[
299,
307
],
[
307,
308
],
[
308,
309
],
[
299,
310
],
[
311,
311
],
[
311,
312
],
[
312,
313
],
[
313,
314
],
[
313,
315
],
[
312,
316
],
[
316,
317
],
[
294,
318
],
[
318,
319
],
[
292,
320
],
[
320,
321
],
[
113,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
325,
326
],
[
326,
327
],
[
327,
328
],
[
327,
329
],
[
326,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
332,
334
],
[
325,
335
],
[
335,
336
],
[
335,
337
],
[
325,
338
],
[
338,
339
],
[
339,
340
],
[
325,
341
],
[
342,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
345,
346
],
[
346,
347
],
[
347,
348
],
[
346,
349
],
[
349,
350
],
[
349,
351
],
[
345,
352
],
[
342,
353
],
[
353,
354
],
[
353,
355
],
[
355,
356
],
[
355,
357
],
[
342,
358
],
[
358,
359
],
[
359,
360
],
[
359,
361
],
[
358,
362
],
[
362,
363
],
[
362,
364
],
[
342,
365
],
[
365,
366
],
[
366,
367
],
[
366,
368
],
[
365,
369
],
[
324,
370
],
[
370,
371
],
[
322,
372
],
[
372,
373
],
[
322,
374
],
[
374,
375
],
[
113,
376
],
[
376,
377
],
[
376,
378
],
[
378,
379
],
[
379,
380
],
[
379,
381
],
[
381,
382
],
[
378,
383
],
[
383,
384
],
[
384,
385
],
[
384,
386
],
[
383,
387
],
[
387,
388
],
[
388,
389
],
[
388,
390
],
[
390,
391
],
[
378,
392
],
[
392,
393
],
[
392,
394
],
[
378,
395
],
[
395,
396
],
[
396,
397
],
[
397,
398
],
[
397,
399
],
[
395,
400
],
[
400,
401
],
[
401,
402
],
[
402,
403
],
[
401,
404
],
[
400,
405
],
[
405,
406
],
[
405,
407
],
[
407,
408
],
[
378,
409
],
[
409,
410
],
[
410,
411
],
[
411,
412
],
[
113,
413
],
[
413,
414
],
[
413,
415
],
[
415,
416
],
[
416,
417
],
[
416,
418
],
[
418,
419
],
[
415,
420
],
[
420,
421
],
[
421,
422
],
[
421,
423
],
[
420,
424
],
[
424,
425
],
[
424,
426
],
[
426,
427
],
[
415,
428
],
[
428,
429
],
[
428,
430
],
[
415,
431
],
[
431,
432
],
[
432,
433
],
[
433,
434
],
[
433,
435
],
[
431,
436
],
[
436,
437
],
[
437,
438
],
[
438,
439
],
[
437,
440
],
[
436,
441
],
[
441,
442
],
[
441,
443
],
[
443,
444
],
[
415,
445
],
[
445,
446
],
[
446,
447
],
[
447,
448
],
[
113,
449
],
[
449,
450
],
[
449,
451
],
[
451,
452
],
[
452,
453
],
[
456,
454
],
[
466,
455
],
[
463,
456
],
[
456,
457
],
[
457,
458
],
[
457,
459
],
[
456,
460
],
[
460,
461
],
[
460,
462
],
[
463,
463
],
[
463,
464
],
[
463,
465
],
[
466,
466
],
[
466,
467
],
[
466,
468
],
[
456,
469
],
[
469,
470
],
[
469,
471
],
[
471,
472
],
[
449,
473
],
[
473,
474
],
[
113,
475
],
[
475,
476
],
[
475,
477
],
[
477,
478
],
[
478,
479
],
[
480,
480
],
[
480,
481
],
[
481,
482
],
[
481,
483
],
[
480,
484
],
[
484,
485
],
[
484,
486
],
[
480,
487
],
[
487,
488
],
[
487,
489
],
[
489,
490
],
[
475,
491
],
[
491,
492
],
[
0,
493
],
[
493,
494
],
[
493,
495
]
]
| [
"import java.io.*;\nimport java.lang.reflect.Array;\nimport java.util.*;\npublic class Main {\n\npublic static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }\n pw.close();\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nstatic class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n}\n\n}",
"import java.io.*;",
"io.*",
"java",
"import java.lang.reflect.Array;",
"Array",
"java.lang.reflect",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\npublic static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }\n pw.close();\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nstatic class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n}\n\n}",
"Main",
"public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }\n pw.close();\n\n}",
"main",
"{\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }\n pw.close();\n\n}",
"InputReader sc = new InputReader(System.in);",
"sc",
"new InputReader(System.in)",
"PrintWriter pw = new PrintWriter(System.out);",
"pw",
"new PrintWriter(System.out)",
"Random gen = new Random();",
"gen",
"new Random()",
"int test = 1;",
"test",
"1",
"while(test-->0) {\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }",
"test-->0",
"test--",
"test",
"0",
"{\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }",
"int k = sc.nextInt();",
"k",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }",
"n==0",
"n",
"0",
"pw.println(k)",
"pw.println",
"pw",
"k",
"{\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }",
"ArrayList<Integer> l = new ArrayList<>();",
"l",
"new ArrayList<>()",
"while(n-->0)\n l.add(sc.nextInt());",
"n-->0",
"n--",
"n",
"0",
"l.add(sc.nextInt())",
"l.add",
"l",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int i =0;",
"i",
"0",
"while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }",
"true",
"{\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }",
"int a = k-i;",
"a",
"k-i",
"k",
"i",
"int b = k + i;",
"b",
"k + i",
"k",
"i",
"if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }",
"!l.contains(a)",
"l.contains(a)",
"l.contains",
"l",
"a",
"{\n pw.println(a);\n break;\n }",
"pw.println(a)",
"pw.println",
"pw",
"a",
"break;",
"if(!l.contains(b))\n {\n pw.println(b);\n break;\n }",
"!l.contains(b)",
"l.contains(b)",
"l.contains",
"l",
"b",
"{\n pw.println(b);\n break;\n }",
"pw.println(b)",
"pw.println",
"pw",
"b",
"break;",
"i++",
"i",
"pw.close()",
"pw.close",
"pw",
"String[] args",
"args",
"static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n}",
"InputReader",
"private final InputStream stream;",
"stream",
"private final byte[] buf = new byte[8192];",
"buf",
"new byte[8192]",
"8192",
"private int curChar",
"curChar",
"snumChars;",
"snumChars",
"public InputReader(InputStream st) {\n this.stream = st;\n }",
"InputReader",
"{\n this.stream = st;\n }",
"this.stream = st",
"this.stream",
"this",
"this.stream",
"st",
"InputStream st",
"st",
"public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"read",
"{\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"if (snumChars == -1)\n throw new InputMismatchException();",
"snumChars == -1",
"snumChars",
"-1",
"1",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }",
"curChar >= snumChars",
"curChar",
"snumChars",
"{\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }",
"curChar = 0",
"curChar",
"0",
"try {\n snumChars = 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 snumChars = stream.read(buf);\n }",
"snumChars = stream.read(buf)",
"snumChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (snumChars <= 0)\n return -1;",
"snumChars <= 0",
"snumChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"int res = 0;",
"res",
"0",
"do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n res *= 10;\n res += c - '0';\n c = read();\n }",
"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 long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextLong",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"long res = 0;",
"res",
"0",
"do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n res *= 10;\n res += c - '0';\n c = read();\n }",
"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 int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }",
"nextIntArray",
"{\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }",
"int [] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = nextInt();\n }",
"{\n a[i] = nextInt();\n }",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }",
"shuffle",
"{ for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }",
"for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }",
"int i = 0, n = a.length;",
"int i = 0",
"i",
"0",
"n = a.length;",
"n",
"a.length",
"a",
"a.length",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{ int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }",
"{ int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }",
"int ind = gen.nextInt(n-i)+i;",
"ind",
"gen.nextInt(n-i)+i",
"gen.nextInt(n-i)",
"gen.nextInt",
"gen",
"n-i",
"n",
"i",
"i",
"int d = a[i];",
"d",
"a[i]",
"a",
"i",
"a[i] = a[ind]",
"a[i]",
"a",
"i",
"a[ind]",
"a",
"ind",
"a[ind] = d",
"a[ind]",
"a",
"ind",
"d",
"return a;",
"a",
"int[] a",
"a",
"Random gen",
"gen",
"public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }",
"readString",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n res.appendCodePoint(c);\n c = read();\n }",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = read()",
"c",
"read()",
"read",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }",
"nextLine",
"{\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c))\n c = read();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = read()",
"c",
"read()",
"read",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));",
"!isEndOfLine(c)",
"isEndOfLine(c)",
"isEndOfLine",
"c",
"{\n res.appendCodePoint(c);\n c = read();\n }",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = read()",
"c",
"read()",
"read",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isSpaceChar",
"{\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",
"private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }",
"isEndOfLine",
"{\n return c == '\\n' || c == '\\r' || c == -1;\n }",
"return c == '\\n' || c == '\\r' || c == -1;",
"c == '\\n' || c == '\\r' || c == -1",
"c == '\\n' || c == '\\r' || c == -1",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public class Main {\n\npublic static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }\n pw.close();\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nstatic class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n}\n\n}",
"public class Main {\n\npublic static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n\n int k = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0)\n pw.println(k);\n else {\n ArrayList<Integer> l = new ArrayList<>();\n while(n-->0)\n l.add(sc.nextInt());\n int i =0;\n while(true)\n {\n int a = k-i;\n int b = k + i;\n if(!l.contains(a))\n {\n pw.println(a);\n break;\n }\n else if(!l.contains(b))\n {\n pw.println(b);\n break;\n }\n\n i++;\n }\n }\n }\n pw.close();\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nstatic class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n}\n\n}",
"Main"
]
| import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputReader sc = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
Random gen = new Random();
int test = 1;//sc.nextInt();
while(test-->0) {
int k = sc.nextInt();
int n = sc.nextInt();
if(n==0)
pw.println(k);
else {
ArrayList<Integer> l = new ArrayList<>();
while(n-->0)
l.add(sc.nextInt());
int i =0;
while(true)
{
int a = k-i;
int b = k + i;
if(!l.contains(a))
{
pw.println(a);
break;
}
else if(!l.contains(b))
{
pw.println(b);
break;
}
i++;
}
}
}
pw.close();
}
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputReader(InputStream st) {
this.stream = st;
}
public int read() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int n) {
int [] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
public static int[] shuffle(int[] a, Random gen)
{ for(int i = 0, n = a.length;i < n;i++)
{ int ind = gen.nextInt(n-i)+i;
int d = a[i];
a[i] = a[ind];
a[ind] = d;
}
return a;
}
public String readString() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -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,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
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
],
[
161,
11
],
[
161,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
32,
39
],
[
14,
40
],
[
40,
41
],
[
40,
42
],
[
14,
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
],
[
14,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
14,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
85,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
14,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
14,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
106,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
101,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
119,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
14,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
132,
135
],
[
135,
136
],
[
135,
137
],
[
131,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
141,
142
],
[
141,
143
],
[
130,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
130,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
12,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n List<Integer> ps = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n ps.add(sc.nextInt());\n }\n\n int max = Integer.MAX_VALUE;\n for (int i = 1; i <= n; i++) {\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }\n int min = Integer.MAX_VALUE;\n for (int i = 0; i <= n; i++) {\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }\n\n if (Math.abs(x - min) <= Math.abs(x - max)) {\n System.out.println(min);\n } else {\n System.out.println(max);\n }\n }\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n List<Integer> ps = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n ps.add(sc.nextInt());\n }\n\n int max = Integer.MAX_VALUE;\n for (int i = 1; i <= n; i++) {\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }\n int min = Integer.MAX_VALUE;\n for (int i = 0; i <= n; i++) {\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }\n\n if (Math.abs(x - min) <= Math.abs(x - max)) {\n System.out.println(min);\n } else {\n System.out.println(max);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n List<Integer> ps = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n ps.add(sc.nextInt());\n }\n\n int max = Integer.MAX_VALUE;\n for (int i = 1; i <= n; i++) {\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }\n int min = Integer.MAX_VALUE;\n for (int i = 0; i <= n; i++) {\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }\n\n if (Math.abs(x - min) <= Math.abs(x - max)) {\n System.out.println(min);\n } else {\n System.out.println(max);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n List<Integer> ps = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n ps.add(sc.nextInt());\n }\n\n int max = Integer.MAX_VALUE;\n for (int i = 1; i <= n; i++) {\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }\n int min = Integer.MAX_VALUE;\n for (int i = 0; i <= n; i++) {\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }\n\n if (Math.abs(x - min) <= Math.abs(x - max)) {\n System.out.println(min);\n } else {\n System.out.println(max);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (n == 0) {\n System.out.println(x);\n return;\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"List<Integer> ps = new ArrayList<>();",
"ps",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n ps.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ps.add(sc.nextInt());\n }",
"{\n ps.add(sc.nextInt());\n }",
"ps.add(sc.nextInt())",
"ps.add",
"ps",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int max = Integer.MAX_VALUE;",
"max",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for (int i = 1; i <= n; i++) {\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }",
"{\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }",
"int tmp = x + i;",
"tmp",
"x + i",
"x",
"i",
"if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }",
"!ps.contains(tmp)",
"ps.contains(tmp)",
"ps.contains",
"ps",
"tmp",
"{\n max = tmp;\n break;\n }",
"max = tmp",
"max",
"tmp",
"break;",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for (int i = 0; i <= n; i++) {\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }",
"{\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }",
"int tmp = x - i;",
"tmp",
"x - i",
"x",
"i",
"if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }",
"!ps.contains(tmp)",
"ps.contains(tmp)",
"ps.contains",
"ps",
"tmp",
"{\n min = tmp;\n break;\n }",
"min = tmp",
"min",
"tmp",
"break;",
"if (Math.abs(x - min) <= Math.abs(x - max)) {\n System.out.println(min);\n } else {\n System.out.println(max);\n }",
"Math.abs(x - min) <= Math.abs(x - max)",
"Math.abs(x - min)",
"Math.abs",
"Math",
"x - min",
"x",
"min",
"Math.abs(x - max)",
"Math.abs",
"Math",
"x - max",
"x",
"max",
"{\n System.out.println(min);\n }",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"{\n System.out.println(max);\n }",
"System.out.println(max)",
"System.out.println",
"System.out",
"System",
"System.out",
"max",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n List<Integer> ps = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n ps.add(sc.nextInt());\n }\n\n int max = Integer.MAX_VALUE;\n for (int i = 1; i <= n; i++) {\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }\n int min = Integer.MAX_VALUE;\n for (int i = 0; i <= n; i++) {\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }\n\n if (Math.abs(x - min) <= Math.abs(x - max)) {\n System.out.println(min);\n } else {\n System.out.println(max);\n }\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if (n == 0) {\n System.out.println(x);\n return;\n }\n\n List<Integer> ps = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n ps.add(sc.nextInt());\n }\n\n int max = Integer.MAX_VALUE;\n for (int i = 1; i <= n; i++) {\n int tmp = x + i;\n if (!ps.contains(tmp)) {\n max = tmp;\n break;\n }\n }\n int min = Integer.MAX_VALUE;\n for (int i = 0; i <= n; i++) {\n int tmp = x - i;\n if (!ps.contains(tmp)) {\n min = tmp;\n break;\n }\n }\n\n if (Math.abs(x - min) <= Math.abs(x - max)) {\n System.out.println(min);\n } else {\n System.out.println(max);\n }\n }\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if (n == 0) {
System.out.println(x);
return;
}
List<Integer> ps = new ArrayList<>();
for (int i = 0; i < n; i++) {
ps.add(sc.nextInt());
}
int max = Integer.MAX_VALUE;
for (int i = 1; i <= n; i++) {
int tmp = x + i;
if (!ps.contains(tmp)) {
max = tmp;
break;
}
}
int min = Integer.MAX_VALUE;
for (int i = 0; i <= n; i++) {
int tmp = x - i;
if (!ps.contains(tmp)) {
min = tmp;
break;
}
}
if (Math.abs(x - min) <= Math.abs(x - max)) {
System.out.println(min);
} else {
System.out.println(max);
}
}
}
|
[
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,
4,
18,
13,
41,
13,
20,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
40,
4,
18,
13,
13,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
13,
0,
13,
4,
18,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
105,
11
],
[
105,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
31
],
[
31,
32
],
[
31,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
14,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
55,
61
],
[
61,
62
],
[
61,
63
],
[
55,
64
],
[
64,
65
],
[
65,
66
],
[
55,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
80,
82
],
[
76,
83
],
[
69,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
14,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
12,
102
],
[
102,
103
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\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\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer>p = new ArrayList<>();\n\t\tint a = 0;\n\t\tint min = 101;\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tp.add(sc.nextInt());\n\t\tfor(int i = -1; i <= 200; i++){\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(a);\n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer>p = new ArrayList<>();\n\t\tint a = 0;\n\t\tint min = 101;\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tp.add(sc.nextInt());\n\t\tfor(int i = -1; i <= 200; i++){\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(a);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer>p = new ArrayList<>();\n\t\tint a = 0;\n\t\tint min = 101;\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tp.add(sc.nextInt());\n\t\tfor(int i = -1; i <= 200; i++){\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(a);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer>p = new ArrayList<>();\n\t\tint a = 0;\n\t\tint min = 101;\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tp.add(sc.nextInt());\n\t\tfor(int i = -1; i <= 200; i++){\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(a);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer>p = new ArrayList<>();",
"p",
"new ArrayList<>()",
"int a = 0;",
"a",
"0",
"int min = 101;",
"min",
"101",
"for(int i = 0; i < n; i++)\n\t\t\tp.add(sc.nextInt());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"p.add(sc.nextInt());",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = -1; i <= 200; i++){\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}",
"int i = -1;",
"int i = -1;",
"i",
"-1",
"1",
"i <= 200",
"i",
"200",
"i++",
"i++",
"i",
"{\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}",
"if(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}",
"!p.contains(i) && Math.abs(i - x) < min",
"!p.contains(i)",
"p.contains(i)",
"p.contains",
"p",
"i",
"Math.abs(i - x) < min",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"min",
"{\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}",
"a = i",
"a",
"i",
"min = Math.abs(i - x)",
"min",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"System.out.print(a)",
"System.out.print",
"System.out",
"System",
"System.out",
"a",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer>p = new ArrayList<>();\n\t\tint a = 0;\n\t\tint min = 101;\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tp.add(sc.nextInt());\n\t\tfor(int i = -1; i <= 200; i++){\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(a);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer>p = new ArrayList<>();\n\t\tint a = 0;\n\t\tint min = 101;\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tp.add(sc.nextInt());\n\t\tfor(int i = -1; i <= 200; i++){\n\t\t\tif(!p.contains(i) && Math.abs(i - x) < min){\n\t\t\t\ta = i;\n\t\t\t\tmin = Math.abs(i - x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(a);\n\t}\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
List<Integer>p = new ArrayList<>();
int a = 0;
int min = 101;
for(int i = 0; i < n; i++)
p.add(sc.nextInt());
for(int i = -1; i <= 200; i++){
if(!p.contains(i) && Math.abs(i - x) < min){
a = i;
min = Math.abs(i - x);
}
}
System.out.print(a);
}
}
|
[
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,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
41,
13,
17,
41,
13,
13,
41,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
0,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
3,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
3,
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
],
[
151,
20
],
[
151,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
23,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
35,
36
],
[
36,
37
],
[
23,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
43,
44
],
[
44,
45
],
[
23,
46
],
[
46,
47
],
[
46,
48
],
[
23,
49
],
[
49,
50
],
[
49,
51
],
[
23,
52
],
[
52,
53
],
[
52,
54
],
[
23,
55
],
[
55,
56
],
[
55,
57
],
[
23,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
58,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
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
],
[
86,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
93,
94
],
[
69,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
95,
105
],
[
105,
106
],
[
106,
107
],
[
95,
108
],
[
109,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
109,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
120,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
126,
133
],
[
109,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
134,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
140,
147
],
[
21,
148
],
[
148,
149
],
[
0,
150
],
[
150,
151
],
[
150,
152
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.StringTokenizer;\n\npublic class Main {\n public static void main(String []args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(br.readLine());\n int x=Integer.parseInt(st.nextToken());\n int n=Integer.parseInt(st.nextToken());\n HashSet<Integer> num = new HashSet<>();\n int c=1;\n int temp1=x;\n int temp2=x;\n if(n==0){\n System.out.println(x);\n }\n else {\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n public static void main(String []args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(br.readLine());\n int x=Integer.parseInt(st.nextToken());\n int n=Integer.parseInt(st.nextToken());\n HashSet<Integer> num = new HashSet<>();\n int c=1;\n int temp1=x;\n int temp2=x;\n if(n==0){\n System.out.println(x);\n }\n else {\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }\n }\n}",
"Main",
"public static void main(String []args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(br.readLine());\n int x=Integer.parseInt(st.nextToken());\n int n=Integer.parseInt(st.nextToken());\n HashSet<Integer> num = new HashSet<>();\n int c=1;\n int temp1=x;\n int temp2=x;\n if(n==0){\n System.out.println(x);\n }\n else {\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }\n }",
"main",
"{\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(br.readLine());\n int x=Integer.parseInt(st.nextToken());\n int n=Integer.parseInt(st.nextToken());\n HashSet<Integer> num = new HashSet<>();\n int c=1;\n int temp1=x;\n int temp2=x;\n if(n==0){\n System.out.println(x);\n }\n else {\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }\n }",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringTokenizer st=new StringTokenizer(br.readLine());",
"st",
"new StringTokenizer(br.readLine())",
"int x=Integer.parseInt(st.nextToken());",
"x",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"int n=Integer.parseInt(st.nextToken());",
"n",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"HashSet<Integer> num = new HashSet<>();",
"num",
"new HashSet<>()",
"int c=1;",
"c",
"1",
"int temp1=x;",
"temp1",
"x",
"int temp2=x;",
"temp2",
"x",
"if(n==0){\n System.out.println(x);\n }\n else {\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }",
"n==0",
"n",
"0",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n num.add(Integer.parseInt(st.nextToken()));\n }",
"{\n num.add(Integer.parseInt(st.nextToken()));\n }",
"num.add(Integer.parseInt(st.nextToken()))",
"num.add",
"num",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }",
"c=0;",
"c=0",
"c",
"0",
"c<n+1",
"c",
"n+1",
"n",
"1",
"c++",
"c++",
"c",
"{\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }",
"{\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }",
"temp1 = x + c",
"temp1",
"x + c",
"x",
"c",
"temp2 = x - c",
"temp2",
"x - c",
"x",
"c",
"if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }",
"!num.contains(temp2)",
"num.contains(temp2)",
"num.contains",
"num",
"temp2",
"{\n System.out.println(temp2);\n break;\n }",
"System.out.println(temp2)",
"System.out.println",
"System.out",
"System",
"System.out",
"temp2",
"break;",
"if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }",
"!num.contains(temp1)",
"num.contains(temp1)",
"num.contains",
"num",
"temp1",
"{\n System.out.println(temp1);\n break;\n }",
"System.out.println(temp1)",
"System.out.println",
"System.out",
"System",
"System.out",
"temp1",
"break;",
"String []args",
"args",
"public class Main {\n public static void main(String []args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(br.readLine());\n int x=Integer.parseInt(st.nextToken());\n int n=Integer.parseInt(st.nextToken());\n HashSet<Integer> num = new HashSet<>();\n int c=1;\n int temp1=x;\n int temp2=x;\n if(n==0){\n System.out.println(x);\n }\n else {\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }\n }\n}",
"public class Main {\n public static void main(String []args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(br.readLine());\n int x=Integer.parseInt(st.nextToken());\n int n=Integer.parseInt(st.nextToken());\n HashSet<Integer> num = new HashSet<>();\n int c=1;\n int temp1=x;\n int temp2=x;\n if(n==0){\n System.out.println(x);\n }\n else {\n st = new StringTokenizer(br.readLine());\n for (int i = 0; i < n; i++) {\n num.add(Integer.parseInt(st.nextToken()));\n }\n for(c=0;c<n+1;c++) {\n temp1 = x + c;\n temp2 = x - c;\n if (!num.contains(temp2)) {\n System.out.println(temp2);\n break;\n }\n if (!num.contains(temp1)) {\n System.out.println(temp1);\n break;\n }\n }\n\n }\n }\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;
public class Main {
public static void main(String []args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer(br.readLine());
int x=Integer.parseInt(st.nextToken());
int n=Integer.parseInt(st.nextToken());
HashSet<Integer> num = new HashSet<>();
int c=1;
int temp1=x;
int temp2=x;
if(n==0){
System.out.println(x);
}
else {
st = new StringTokenizer(br.readLine());
for (int i = 0; i < n; i++) {
num.add(Integer.parseInt(st.nextToken()));
}
for(c=0;c<n+1;c++) {
temp1 = x + c;
temp2 = x - c;
if (!num.contains(temp2)) {
System.out.println(temp2);
break;
}
if (!num.contains(temp1)) {
System.out.println(temp1);
break;
}
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
2,
13,
17,
40,
17,
14,
2,
18,
13,
2,
13,
17,
40,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
17,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
40,
17,
30,
9,
41,
13,
2,
13,
18,
13,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
14,
2,
13,
17,
30,
0,
13,
40,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
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
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
26,
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
],
[
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
],
[
74,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
82,
83
],
[
8,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
91,
92
],
[
84,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
93,
100
],
[
8,
101
],
[
101,
102
],
[
101,
103
],
[
8,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
108,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
121,
128
],
[
128,
129
],
[
120,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
120,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
141,
148
],
[
120,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
120,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
8,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
6,
177
],
[
177,
178
],
[
0,
179
],
[
179,
180
],
[
179,
181
]
]
| [
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n\n Scanner scan = new Scanner(System.in);\n int x = scan.nextInt();\n int n = scan.nextInt();\n if (n == 0){\n System.out.println(x);\n return;\n }\n int [] a = new int[103];\n\n for (int i=0;i<103;i++){\n a[i] = i-1;\n }\n\n for (int j=0;j<n;j++){\n int t = scan.nextInt();\n a[t+1] = -2;\n }\n\n if (a[x+1] != -2){\n System.out.println(x);\n return;\n }\n\n int small = 104;\n int val = -3;\n for (int p=0;p<103;p++){\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }\n\n System.out.println(val);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n\n Scanner scan = new Scanner(System.in);\n int x = scan.nextInt();\n int n = scan.nextInt();\n if (n == 0){\n System.out.println(x);\n return;\n }\n int [] a = new int[103];\n\n for (int i=0;i<103;i++){\n a[i] = i-1;\n }\n\n for (int j=0;j<n;j++){\n int t = scan.nextInt();\n a[t+1] = -2;\n }\n\n if (a[x+1] != -2){\n System.out.println(x);\n return;\n }\n\n int small = 104;\n int val = -3;\n for (int p=0;p<103;p++){\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }\n\n System.out.println(val);\n }\n}",
"Main",
"public static void main(String[] args){\n\n Scanner scan = new Scanner(System.in);\n int x = scan.nextInt();\n int n = scan.nextInt();\n if (n == 0){\n System.out.println(x);\n return;\n }\n int [] a = new int[103];\n\n for (int i=0;i<103;i++){\n a[i] = i-1;\n }\n\n for (int j=0;j<n;j++){\n int t = scan.nextInt();\n a[t+1] = -2;\n }\n\n if (a[x+1] != -2){\n System.out.println(x);\n return;\n }\n\n int small = 104;\n int val = -3;\n for (int p=0;p<103;p++){\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }\n\n System.out.println(val);\n }",
"main",
"{\n\n Scanner scan = new Scanner(System.in);\n int x = scan.nextInt();\n int n = scan.nextInt();\n if (n == 0){\n System.out.println(x);\n return;\n }\n int [] a = new int[103];\n\n for (int i=0;i<103;i++){\n a[i] = i-1;\n }\n\n for (int j=0;j<n;j++){\n int t = scan.nextInt();\n a[t+1] = -2;\n }\n\n if (a[x+1] != -2){\n System.out.println(x);\n return;\n }\n\n int small = 104;\n int val = -3;\n for (int p=0;p<103;p++){\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }\n\n System.out.println(val);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int x = scan.nextInt();",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if (n == 0){\n System.out.println(x);\n return;\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int [] a = new int[103];",
"a",
"new int[103]",
"103",
"for (int i=0;i<103;i++){\n a[i] = i-1;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<103",
"i",
"103",
"i++",
"i++",
"i",
"{\n a[i] = i-1;\n }",
"{\n a[i] = i-1;\n }",
"a[i] = i-1",
"a[i]",
"a",
"i",
"i-1",
"i",
"1",
"for (int j=0;j<n;j++){\n int t = scan.nextInt();\n a[t+1] = -2;\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n int t = scan.nextInt();\n a[t+1] = -2;\n }",
"{\n int t = scan.nextInt();\n a[t+1] = -2;\n }",
"int t = scan.nextInt();",
"t",
"scan.nextInt()",
"scan.nextInt",
"scan",
"a[t+1] = -2",
"a[t+1]",
"a",
"t+1",
"t",
"1",
"-2",
"2",
"if (a[x+1] != -2){\n System.out.println(x);\n return;\n }",
"a[x+1] != -2",
"a[x+1]",
"a",
"x+1",
"x",
"1",
"-2",
"2",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int small = 104;",
"small",
"104",
"int val = -3;",
"val",
"-3",
"3",
"for (int p=0;p<103;p++){\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }",
"int p=0;",
"int p=0;",
"p",
"0",
"p<103",
"p",
"103",
"p++",
"p++",
"p",
"{\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }",
"{\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }",
"if (a[p] == -2){\n continue;\n }",
"a[p] == -2",
"a[p]",
"a",
"p",
"-2",
"2",
"{\n continue;\n }",
"continue;",
"int abs = x-a[p];",
"abs",
"x-a[p]",
"x",
"a[p]",
"a",
"p",
"if (abs == 0){\n System.out.println(x);\n return;\n }",
"abs == 0",
"abs",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"if (abs < 0){\n abs = -abs;\n }",
"abs < 0",
"abs",
"0",
"{\n abs = -abs;\n }",
"abs = -abs",
"abs",
"-abs",
"abs",
"if (abs < small){\n small = abs;\n val = a[p];\n }",
"abs < small",
"abs",
"small",
"{\n small = abs;\n val = a[p];\n }",
"small = abs",
"small",
"abs",
"val = a[p]",
"val",
"a[p]",
"a",
"p",
"System.out.println(val)",
"System.out.println",
"System.out",
"System",
"System.out",
"val",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n\n Scanner scan = new Scanner(System.in);\n int x = scan.nextInt();\n int n = scan.nextInt();\n if (n == 0){\n System.out.println(x);\n return;\n }\n int [] a = new int[103];\n\n for (int i=0;i<103;i++){\n a[i] = i-1;\n }\n\n for (int j=0;j<n;j++){\n int t = scan.nextInt();\n a[t+1] = -2;\n }\n\n if (a[x+1] != -2){\n System.out.println(x);\n return;\n }\n\n int small = 104;\n int val = -3;\n for (int p=0;p<103;p++){\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }\n\n System.out.println(val);\n }\n}",
"public class Main{\n public static void main(String[] args){\n\n Scanner scan = new Scanner(System.in);\n int x = scan.nextInt();\n int n = scan.nextInt();\n if (n == 0){\n System.out.println(x);\n return;\n }\n int [] a = new int[103];\n\n for (int i=0;i<103;i++){\n a[i] = i-1;\n }\n\n for (int j=0;j<n;j++){\n int t = scan.nextInt();\n a[t+1] = -2;\n }\n\n if (a[x+1] != -2){\n System.out.println(x);\n return;\n }\n\n int small = 104;\n int val = -3;\n for (int p=0;p<103;p++){\n if (a[p] == -2){\n continue;\n }\n int abs = x-a[p];\n if (abs == 0){\n System.out.println(x);\n return;\n }\n\n if (abs < 0){\n abs = -abs;\n }\n if (abs < small){\n small = abs;\n val = a[p];\n }\n }\n\n System.out.println(val);\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int n = scan.nextInt();
if (n == 0){
System.out.println(x);
return;
}
int [] a = new int[103];
for (int i=0;i<103;i++){
a[i] = i-1;
}
for (int j=0;j<n;j++){
int t = scan.nextInt();
a[t+1] = -2;
}
if (a[x+1] != -2){
System.out.println(x);
return;
}
int small = 104;
int val = -3;
for (int p=0;p<103;p++){
if (a[p] == -2){
continue;
}
int abs = x-a[p];
if (abs == 0){
System.out.println(x);
return;
}
if (abs < 0){
abs = -abs;
}
if (abs < small){
small = abs;
val = a[p];
}
}
System.out.println(val);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
2,
13,
17,
41,
13,
2,
13,
17,
14,
2,
4,
18,
13,
2,
4,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
11,
1,
30,
30,
14,
4,
18,
13,
13,
30,
40,
13,
30,
4,
18,
18,
13,
13,
13,
29,
14,
4,
18,
13,
13,
30,
40,
13,
30,
4,
18,
18,
13,
13,
13,
29,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
115,
8
],
[
115,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
49,
51
],
[
11,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
11,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
62,
67
],
[
57,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
68,
75
],
[
11,
76
],
[
76,
77
],
[
76,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
80,
85
],
[
85,
86
],
[
86,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
88,
95
],
[
79,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
96,
101
],
[
101,
102
],
[
102,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
104,
111
],
[
9,
112
],
[
112,
113
],
[
0,
114
],
[
114,
115
],
[
114,
116
]
]
| [
"import java.util.HashSet;\nimport java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint integerX = sc.nextInt(); //元の整数\n\t\tint youso = sc.nextInt(); //整数列の要素数\n\t\tHashSet<Integer> list = new HashSet<Integer>(); //整数列を入れるリスト\n\n\t\t//配列を入力\n\t\tfor(int i=0 ; i<youso ; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tint i = integerX-1;\n\t\tint j = integerX+1;\n\n\t\tif(list.isEmpty() || list.contains(integerX) != true) {\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}\n\n\t\tfor(;;) {\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint integerX = sc.nextInt(); //元の整数\n\t\tint youso = sc.nextInt(); //整数列の要素数\n\t\tHashSet<Integer> list = new HashSet<Integer>(); //整数列を入れるリスト\n\n\t\t//配列を入力\n\t\tfor(int i=0 ; i<youso ; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tint i = integerX-1;\n\t\tint j = integerX+1;\n\n\t\tif(list.isEmpty() || list.contains(integerX) != true) {\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}\n\n\t\tfor(;;) {\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint integerX = sc.nextInt(); //元の整数\n\t\tint youso = sc.nextInt(); //整数列の要素数\n\t\tHashSet<Integer> list = new HashSet<Integer>(); //整数列を入れるリスト\n\n\t\t//配列を入力\n\t\tfor(int i=0 ; i<youso ; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tint i = integerX-1;\n\t\tint j = integerX+1;\n\n\t\tif(list.isEmpty() || list.contains(integerX) != true) {\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}\n\n\t\tfor(;;) {\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint integerX = sc.nextInt(); //元の整数\n\t\tint youso = sc.nextInt(); //整数列の要素数\n\t\tHashSet<Integer> list = new HashSet<Integer>(); //整数列を入れるリスト\n\n\t\t//配列を入力\n\t\tfor(int i=0 ; i<youso ; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tint i = integerX-1;\n\t\tint j = integerX+1;\n\n\t\tif(list.isEmpty() || list.contains(integerX) != true) {\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}\n\n\t\tfor(;;) {\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int integerX = sc.nextInt();",
"integerX",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int youso = sc.nextInt();",
"youso",
"sc.nextInt()",
"sc.nextInt",
"sc",
"HashSet<Integer> list = new HashSet<Integer>();",
"list",
"new HashSet<Integer>()",
"for(int i=0 ; i<youso ; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i<youso",
"i",
"youso",
"i++",
"i++",
"i",
"{\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"list.add(sc.nextInt())",
"list.add",
"list",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int i = integerX-1;",
"i",
"integerX-1",
"integerX",
"1",
"int j = integerX+1;",
"j",
"integerX+1",
"integerX",
"1",
"if(list.isEmpty() || list.contains(integerX) != true) {\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}",
"list.isEmpty() || list.contains(integerX) != true",
"list.isEmpty()",
"list.isEmpty",
"list",
"list.contains(integerX) != true",
"list.contains(integerX)",
"list.contains",
"list",
"integerX",
"true",
"{\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}",
"System.out.println(integerX)",
"System.out.println",
"System.out",
"System",
"System.out",
"integerX",
"return;",
"for(;;) {\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
";",
"{\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"if(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}",
"list.contains(i)",
"list.contains",
"list",
"i",
"{\n\t\t\t\ti--;\n\t\t\t}",
"i--",
"i",
"{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(i)",
"System.out.println",
"System.out",
"System",
"System.out",
"i",
"return;",
"if(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}",
"list.contains(j)",
"list.contains",
"list",
"j",
"{\n\t\t\t\tj++;\n\t\t\t}",
"j++",
"j",
"{\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(j)",
"System.out.println",
"System.out",
"System",
"System.out",
"j",
"return;",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint integerX = sc.nextInt(); //元の整数\n\t\tint youso = sc.nextInt(); //整数列の要素数\n\t\tHashSet<Integer> list = new HashSet<Integer>(); //整数列を入れるリスト\n\n\t\t//配列を入力\n\t\tfor(int i=0 ; i<youso ; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tint i = integerX-1;\n\t\tint j = integerX+1;\n\n\t\tif(list.isEmpty() || list.contains(integerX) != true) {\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}\n\n\t\tfor(;;) {\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint integerX = sc.nextInt(); //元の整数\n\t\tint youso = sc.nextInt(); //整数列の要素数\n\t\tHashSet<Integer> list = new HashSet<Integer>(); //整数列を入れるリスト\n\n\t\t//配列を入力\n\t\tfor(int i=0 ; i<youso ; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tint i = integerX-1;\n\t\tint j = integerX+1;\n\n\t\tif(list.isEmpty() || list.contains(integerX) != true) {\n\t\t\tSystem.out.println(integerX);\n\t\t\treturn;\n\t\t}\n\n\t\tfor(;;) {\n\t\t\tif(list.contains(i)) {\n\t\t\t\ti--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(list.contains(j)) {\n\t\t\t\tj++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(j);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int integerX = sc.nextInt(); //元の整数
int youso = sc.nextInt(); //整数列の要素数
HashSet<Integer> list = new HashSet<Integer>(); //整数列を入れるリスト
//配列を入力
for(int i=0 ; i<youso ; i++) {
list.add(sc.nextInt());
}
int i = integerX-1;
int j = integerX+1;
if(list.isEmpty() || list.contains(integerX) != true) {
System.out.println(integerX);
return;
}
for(;;) {
if(list.contains(i)) {
i--;
}
else{
System.out.println(i);
return;
}
if(list.contains(j)) {
j++;
}
else {
System.out.println(j);
return;
}
}
}
} |
[
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,
4,
18,
13,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
4,
18,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
40,
17,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
2,
2,
13,
17,
13,
4,
18,
13,
13,
30,
0,
13,
2,
2,
13,
17,
13,
3,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
4,
18,
13,
13,
30,
0,
13,
2,
13,
13,
3,
14,
2,
2,
4,
18,
13,
17,
2,
4,
18,
13,
17,
30,
14,
2,
13,
40,
17,
30,
0,
13,
2,
4,
18,
13,
2,
4,
18,
13,
17,
17,
14,
2,
13,
40,
17,
30,
0,
13,
2,
4,
18,
13,
2,
4,
18,
13,
17,
17,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
14,
2,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
13,
14,
2,
4,
18,
13,
17,
30,
14,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
17,
30,
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
],
[
285,
11
],
[
285,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
31
],
[
31,
32
],
[
31,
33
],
[
14,
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
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
46,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
52,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
14,
66
],
[
66,
67
],
[
67,
68
],
[
14,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
14,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
14,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
14,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
14,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
14,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
89,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
107,
107
],
[
107,
108
],
[
107,
109
],
[
107,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
104,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
119,
119
],
[
119,
120
],
[
119,
121
],
[
119,
122
],
[
115,
123
],
[
14,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
124,
134
],
[
134,
135
],
[
135,
136
],
[
124,
137
],
[
138,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
139,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
148,
154
],
[
14,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
157,
161
],
[
156,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
162,
166
],
[
155,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
168,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
180,
184
],
[
176,
185
],
[
167,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
186,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
195,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
198,
202
],
[
194,
203
],
[
167,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
209,
210
],
[
209,
211
],
[
204,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
204,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
220,
224
],
[
224,
225
],
[
224,
226
],
[
219,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
228,
233
],
[
219,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
237,
239
],
[
235,
240
],
[
155,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
244,
245
],
[
242,
246
],
[
241,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
248,
253
],
[
241,
254
],
[
254,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
255,
259
],
[
254,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
262,
265
],
[
261,
266
],
[
266,
267
],
[
267,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
267,
272
],
[
272,
273
],
[
272,
274
],
[
261,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
276,
281
],
[
12,
282
],
[
282,
283
],
[
0,
284
],
[
284,
285
],
[
284,
286
]
]
| [
"import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n ArrayList<Integer> smaller = new ArrayList<>();\n ArrayList<Integer> bigger = new ArrayList<>();\n\n for (int i = 0; i < N; i++) {\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }\n\n scanner.close();\n\n Collections.sort(smaller);\n Collections.reverse(smaller);\n Collections.sort(bigger);\n\n int small = -1;\n int big = -1;\n for (int i = 0; i < smaller.size(); i++) {\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }\n\n for (int i = 0; i < bigger.size(); i++) {\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }\n\n if (bigger.size() > 0 && smaller.size() > 0) {\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n } else if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }\n\n }\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"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 X = scanner.nextInt();\n int N = scanner.nextInt();\n\n ArrayList<Integer> smaller = new ArrayList<>();\n ArrayList<Integer> bigger = new ArrayList<>();\n\n for (int i = 0; i < N; i++) {\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }\n\n scanner.close();\n\n Collections.sort(smaller);\n Collections.reverse(smaller);\n Collections.sort(bigger);\n\n int small = -1;\n int big = -1;\n for (int i = 0; i < smaller.size(); i++) {\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }\n\n for (int i = 0; i < bigger.size(); i++) {\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }\n\n if (bigger.size() > 0 && smaller.size() > 0) {\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n } else if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n ArrayList<Integer> smaller = new ArrayList<>();\n ArrayList<Integer> bigger = new ArrayList<>();\n\n for (int i = 0; i < N; i++) {\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }\n\n scanner.close();\n\n Collections.sort(smaller);\n Collections.reverse(smaller);\n Collections.sort(bigger);\n\n int small = -1;\n int big = -1;\n for (int i = 0; i < smaller.size(); i++) {\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }\n\n for (int i = 0; i < bigger.size(); i++) {\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }\n\n if (bigger.size() > 0 && smaller.size() > 0) {\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n } else if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }\n\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n ArrayList<Integer> smaller = new ArrayList<>();\n ArrayList<Integer> bigger = new ArrayList<>();\n\n for (int i = 0; i < N; i++) {\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }\n\n scanner.close();\n\n Collections.sort(smaller);\n Collections.reverse(smaller);\n Collections.sort(bigger);\n\n int small = -1;\n int big = -1;\n for (int i = 0; i < smaller.size(); i++) {\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }\n\n for (int i = 0; i < bigger.size(); i++) {\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }\n\n if (bigger.size() > 0 && smaller.size() > 0) {\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n } else if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }\n\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int X = scanner.nextInt();",
"X",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"ArrayList<Integer> smaller = new ArrayList<>();",
"smaller",
"new ArrayList<>()",
"ArrayList<Integer> bigger = new ArrayList<>();",
"bigger",
"new ArrayList<>()",
"for (int i = 0; i < N; i++) {\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }",
"{\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }",
"int temp = scanner.nextInt();",
"temp",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }",
"temp < X",
"temp",
"X",
"{\n smaller.add(temp);\n }",
"smaller.add(temp)",
"smaller.add",
"smaller",
"temp",
"{\n bigger.add(temp);\n }",
"bigger.add(temp)",
"bigger.add",
"bigger",
"temp",
"scanner.close()",
"scanner.close",
"scanner",
"Collections.sort(smaller)",
"Collections.sort",
"Collections",
"smaller",
"Collections.reverse(smaller)",
"Collections.reverse",
"Collections",
"smaller",
"Collections.sort(bigger)",
"Collections.sort",
"Collections",
"bigger",
"int small = -1;",
"small",
"-1",
"1",
"int big = -1;",
"big",
"-1",
"1",
"for (int i = 0; i < smaller.size(); i++) {\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < smaller.size()",
"i",
"smaller.size()",
"smaller.size",
"smaller",
"i++",
"i++",
"i",
"{\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }",
"{\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }",
"if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }",
"X - 1 - i != smaller.get(i)",
"X - 1 - i",
"X - 1 - i",
"X",
"1",
"i",
"smaller.get(i)",
"smaller.get",
"smaller",
"i",
"{\n small = X - 1 - i;\n break;\n }",
"small = X - 1 - i",
"small",
"X - 1 - i",
"X - 1 - i",
"X",
"1",
"i",
"break;",
"for (int i = 0; i < bigger.size(); i++) {\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < bigger.size()",
"i",
"bigger.size()",
"bigger.size",
"bigger",
"i++",
"i++",
"i",
"{\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }",
"{\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }",
"if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }",
"X + i != bigger.get(i)",
"X + i",
"X",
"i",
"bigger.get(i)",
"bigger.get",
"bigger",
"i",
"{\n big = X + i;\n break;\n }",
"big = X + i",
"big",
"X + i",
"X",
"i",
"break;",
"if (bigger.size() > 0 && smaller.size() > 0) {\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n } else if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }",
"bigger.size() > 0 && smaller.size() > 0",
"bigger.size() > 0",
"bigger.size()",
"bigger.size",
"bigger",
"0",
"smaller.size() > 0",
"smaller.size()",
"smaller.size",
"smaller",
"0",
"{\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n }",
"if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }",
"small == -1",
"small",
"-1",
"1",
"{\n small = smaller.get(smaller.size() - 1) - 1;\n }",
"small = smaller.get(smaller.size() - 1) - 1",
"small",
"smaller.get(smaller.size() - 1) - 1",
"smaller.get(smaller.size() - 1)",
"smaller.get",
"smaller",
"smaller.size() - 1",
"smaller.size()",
"smaller.size",
"smaller",
"1",
"1",
"if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }",
"big == -1",
"big",
"-1",
"1",
"{\n big = bigger.get(bigger.size() - 1) + 1;\n }",
"big = bigger.get(bigger.size() - 1) + 1",
"big",
"bigger.get(bigger.size() - 1) + 1",
"bigger.get(bigger.size() - 1)",
"bigger.get",
"bigger",
"bigger.size() - 1",
"bigger.size()",
"bigger.size",
"bigger",
"1",
"1",
"if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }",
"X - small < big - X",
"X - small",
"X",
"small",
"big - X",
"big",
"X",
"{\n System.out.println(small);\n }",
"System.out.println(small)",
"System.out.println",
"System.out",
"System",
"System.out",
"small",
"if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }",
"X - small > big - X",
"X - small",
"X",
"small",
"big - X",
"big",
"X",
"{\n System.out.println(big);\n }",
"System.out.println(big)",
"System.out.println",
"System.out",
"System",
"System.out",
"big",
"{\n System.out.println(small);\n }",
"System.out.println(small)",
"System.out.println",
"System.out",
"System",
"System.out",
"small",
"if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }",
"bigger.size() == 0",
"bigger.size()",
"bigger.size",
"bigger",
"0",
"{\n System.out.println(X);\n }",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }",
"smaller.size() == 0",
"smaller.size()",
"smaller.size",
"smaller",
"0",
"{\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }",
"if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }",
"bigger.contains(X)",
"bigger.contains",
"bigger",
"X",
"{\n System.out.println(X - 1);\n }",
"System.out.println(X - 1)",
"System.out.println",
"System.out",
"System",
"System.out",
"X - 1",
"X",
"1",
"{\n System.out.println(X);\n }",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n ArrayList<Integer> smaller = new ArrayList<>();\n ArrayList<Integer> bigger = new ArrayList<>();\n\n for (int i = 0; i < N; i++) {\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }\n\n scanner.close();\n\n Collections.sort(smaller);\n Collections.reverse(smaller);\n Collections.sort(bigger);\n\n int small = -1;\n int big = -1;\n for (int i = 0; i < smaller.size(); i++) {\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }\n\n for (int i = 0; i < bigger.size(); i++) {\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }\n\n if (bigger.size() > 0 && smaller.size() > 0) {\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n } else if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n ArrayList<Integer> smaller = new ArrayList<>();\n ArrayList<Integer> bigger = new ArrayList<>();\n\n for (int i = 0; i < N; i++) {\n int temp = scanner.nextInt();\n if (temp < X) {\n smaller.add(temp);\n } else {\n bigger.add(temp);\n }\n }\n\n scanner.close();\n\n Collections.sort(smaller);\n Collections.reverse(smaller);\n Collections.sort(bigger);\n\n int small = -1;\n int big = -1;\n for (int i = 0; i < smaller.size(); i++) {\n if (X - 1 - i != smaller.get(i)) {\n small = X - 1 - i;\n break;\n }\n }\n\n for (int i = 0; i < bigger.size(); i++) {\n if (X + i != bigger.get(i)) {\n big = X + i;\n break;\n }\n }\n\n if (bigger.size() > 0 && smaller.size() > 0) {\n if (small == -1) {\n small = smaller.get(smaller.size() - 1) - 1;\n }\n if (big == -1) {\n big = bigger.get(bigger.size() - 1) + 1;\n }\n\n if (X - small < big - X) {\n System.out.println(small);\n } else if (X - small > big - X) {\n System.out.println(big);\n } else {\n System.out.println(small);\n }\n } else if (bigger.size() == 0) {\n System.out.println(X);\n } else if (smaller.size() == 0) {\n if (bigger.contains(X)) {\n System.out.println(X - 1);\n } else {\n System.out.println(X);\n }\n }\n\n }\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int X = scanner.nextInt();
int N = scanner.nextInt();
ArrayList<Integer> smaller = new ArrayList<>();
ArrayList<Integer> bigger = new ArrayList<>();
for (int i = 0; i < N; i++) {
int temp = scanner.nextInt();
if (temp < X) {
smaller.add(temp);
} else {
bigger.add(temp);
}
}
scanner.close();
Collections.sort(smaller);
Collections.reverse(smaller);
Collections.sort(bigger);
int small = -1;
int big = -1;
for (int i = 0; i < smaller.size(); i++) {
if (X - 1 - i != smaller.get(i)) {
small = X - 1 - i;
break;
}
}
for (int i = 0; i < bigger.size(); i++) {
if (X + i != bigger.get(i)) {
big = X + i;
break;
}
}
if (bigger.size() > 0 && smaller.size() > 0) {
if (small == -1) {
small = smaller.get(smaller.size() - 1) - 1;
}
if (big == -1) {
big = bigger.get(bigger.size() - 1) + 1;
}
if (X - small < big - X) {
System.out.println(small);
} else if (X - small > big - X) {
System.out.println(big);
} else {
System.out.println(small);
}
} else if (bigger.size() == 0) {
System.out.println(X);
} else if (smaller.size() == 0) {
if (bigger.contains(X)) {
System.out.println(X - 1);
} else {
System.out.println(X);
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
17,
14,
2,
4,
18,
13,
18,
13,
17,
17,
30,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
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,
4,
18,
13,
18,
13,
17,
41,
13,
13,
41,
13,
17,
42,
17,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
40,
13,
0,
13,
2,
13,
17,
42,
17,
30,
14,
40,
4,
18,
13,
13,
30,
14,
2,
2,
13,
13,
2,
13,
13,
30,
0,
13,
13,
3,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
4,
18,
13,
30,
29,
8,
2,
13,
17,
17,
17,
14,
2,
18,
18,
18,
13,
13,
13,
13,
17,
30,
29,
18,
18,
18,
13,
13,
13,
13,
14,
2,
4,
18,
13,
13,
17,
30,
0,
18,
18,
18,
13,
13,
13,
13,
4,
18,
13,
4,
13,
2,
13,
18,
13,
13,
13,
13,
2,
13,
17,
13,
2,
13,
17,
4,
13,
13,
13,
13,
2,
13,
17,
13,
13,
30,
0,
18,
18,
18,
13,
13,
13,
13,
4,
18,
13,
4,
13,
2,
13,
18,
13,
13,
13,
13,
2,
13,
17,
2,
13,
17,
13,
4,
13,
13,
13,
13,
2,
13,
17,
13,
13,
29,
18,
18,
18,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
13,
0,
13,
13,
23,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
13,
17
],
[
17,
18
],
[
13,
19
],
[
19,
20
],
[
19,
21
],
[
13,
22
],
[
22,
23
],
[
22,
24
],
[
13,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
33,
38
],
[
27,
39
],
[
39,
40
],
[
39,
41
],
[
27,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
48,
49
],
[
48,
50
],
[
44,
51
],
[
43,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
55,
60
],
[
27,
61
],
[
61,
62
],
[
61,
63
],
[
27,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
64,
74
],
[
74,
75
],
[
75,
76
],
[
64,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
85,
86
],
[
85,
87
],
[
27,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
27,
96
],
[
96,
97
],
[
96,
98
],
[
27,
99
],
[
99,
100
],
[
99,
101
],
[
27,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
104,
116
],
[
116,
117
],
[
27,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
27,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
126,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
132,
145
],
[
125,
146
],
[
146,
147
],
[
27,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
25,
154
],
[
154,
155
],
[
13,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
159,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
167,
172
],
[
158,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
175,
181
],
[
174,
182
],
[
173,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
185,
191
],
[
158,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
194,
197
],
[
193,
198
],
[
192,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
202,
206
],
[
201,
207
],
[
200,
208
],
[
208,
209
],
[
209,
210
],
[
208,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
215,
217
],
[
211,
218
],
[
211,
219
],
[
211,
220
],
[
220,
221
],
[
220,
222
],
[
211,
223
],
[
211,
224
],
[
224,
225
],
[
224,
226
],
[
208,
227
],
[
227,
228
],
[
227,
229
],
[
227,
230
],
[
227,
231
],
[
227,
232
],
[
232,
233
],
[
232,
234
],
[
227,
235
],
[
227,
236
],
[
192,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
239,
245
],
[
238,
246
],
[
246,
247
],
[
247,
248
],
[
246,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
253,
255
],
[
249,
256
],
[
249,
257
],
[
249,
258
],
[
258,
259
],
[
258,
260
],
[
249,
261
],
[
261,
262
],
[
261,
263
],
[
249,
264
],
[
246,
265
],
[
265,
266
],
[
265,
267
],
[
265,
268
],
[
265,
269
],
[
265,
270
],
[
270,
271
],
[
270,
272
],
[
265,
273
],
[
265,
274
],
[
158,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
277,
281
],
[
276,
282
],
[
156,
283
],
[
283,
284
],
[
156,
285
],
[
285,
286
],
[
156,
287
],
[
287,
288
],
[
156,
289
],
[
289,
290
],
[
156,
291
],
[
291,
292
],
[
156,
293
],
[
293,
294
],
[
0,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
295,
299
],
[
299,
300
],
[
295,
301
],
[
301,
302
],
[
301,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
303,
307
],
[
307,
308
],
[
307,
309
],
[
301,
310
],
[
310,
311
],
[
301,
312
],
[
312,
313
]
]
| [
"import java.util.*;\nimport java.io.*;\nimport java.math.BigDecimal; \nimport java.math.BigInteger; \nclass Main\n{\n\tstatic boolean visited[];\n\tstatic long dp[][][];\n\tstatic long MOD=1000000007L;\n\tstatic Hashtable<String , Long>hash=new Hashtable<>();\n\tpublic static void main(String args[]) throws java.lang.Exception\n\t{\n\t\tBufferedReader inp = new BufferedReader (new InputStreamReader(System.in));\n\t\tString h[]=inp.readLine().split(\" \");\n\t\tString hh[]=new String[0];\n\t\tif(Integer.parseInt(h[1])!=0){hh=inp.readLine().split(\" \");}\n\t\tHashSet<Integer>hash=new HashSet<>();\n\t\tfor(int i=0;i<hh.length;i++){hash.add(Integer.parseInt(hh[i]));}\n\t\t// Arrays.sort(arr);\n\t\tint x=Integer.parseInt(h[0]);\n\t\tint x1=x;\n\t\tint ans=0;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){ans=x1;break;}\n\t\t\tx1++;\n\t\t}\n\t\tx1=x-1;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}\n\t\t\tx1--;\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\tstatic long get(long x, String s, long arr[], int i,int a, int b)\n\t{\n\t\tif(i==s.length()){return x==0?1:2;}\n\t\t// String ss=i+\" \"+x;\n\t\t// if(hash.containsKey(ss)){return hash.get(ss);}\n\t\tif(dp[i][a][b]!=0){return dp[i][a][b];}\n\t\tif(s.charAt(i)=='1')\n\t\t{\n\t\t\t\tdp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b));\n\t\t}\n\t\telse{\n\t\tdp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b));}\n\t\treturn dp[i][a][b];\n\t}\n\n\t\t// System.out.println(a);\n\t\t\n\t\n\t// static long get(int i,int pre, int n, int arr[],boolean visited[])\n\t// {\n\t// \tif(i==n){return 1;}\n\t// \tlong ans=0;\n\t// \tif(dp[i][pre]!=-1){return dp[i][pre];}\n\t// \tif(arr[i]==1)\n\t// \t{\n\t// \t\tfor(int k=pre+1;k<=n;k++)\n\t// \t\t{\n\t// \t\t\tif(!visited[k])\n\t// \t\t\t{\n\t// \t\t\t\tvisited[k]=true;\n\t// \t\t\t\tans=(ans%MOD+get(i+1,k,n,arr,visited)%MOD)%MOD;\n\t// \t\t\t\tvisited[k]=false;\n\t// \t\t\t}\n\t// \t\t}\n\t// \t\tdp[i][pre]=ans;\n\t// \t\treturn ans;\n\t// \t}\n\t// \tfor(int k=1;k<pre;k++)\n\t// \t{\n\t// \t\tif(!visited[k])\n\t// \t\t{\n\t// \t\t\tvisited[k]=true;\n\t// \t\t\tans=(ans%MOD+get(i+1,k,n,arr,visited)%MOD)%MOD;\n\t// \t\t\tvisited[k]=false;\n\t// \t\t}\n\t// \t}\n\t// \tdp[i][pre]=ans;\n\t// \treturn ans;\n\n\t// }\n\t// static long getall(int gg[], long arr[][], int i, int g)\n\t// {\n\t// \tif(i==arr.length)\n\t// \t{\n\t// \t\tlong ans=0;\n\t// \t\tfor(int j=0;j<=g;j++)\n\t// \t\t{\n\t// \t\t\tArrayList<Integer>arr1=new ArrayList<>();\n\t// \t\t\tfor(int k=0;k<gg.length;k++)\n\t// \t\t\t{\n\t// \t\t\t\tif(gg[k]==j){arr1.add(k);}\n\t// \t\t\t}\n\t// \t\t\tfor(int k=0;k<arr1.size()-1;k++)\n\t// \t\t\t{\n\t// \t\t\t\tfor(int l=k+1;l<arr1.size();l++)\n\t// \t\t\t\t{\n\t// \t\t\t\t\tans+=arr[arr1.get(k)][arr1.get(l)];\n\t// \t\t\t\t}\n\t// \t\t\t}\n\t// \t\t}\n\t// \t\treturn ans;\n\t// \t}\n\t// \tString s=Arrays.toString(gg);\n\t// \t// if(hash.containsKey(s)){return hash.get(s);}\n\t// \tif(dp[i][g]!=0){return dp[i][g];}\n\t// \tgg[i]=g+1;\n\t// \tlong max=getall(gg,arr,i+1,g+1);\n\t// \tfor(int k=0;k<=g;k++)\n\t// \t{\n\t// \t\tgg[i]=k;\n\t// \t\tmax=Math.max(getall(gg,arr,i+1,g),max);\n\t// \t}\n\t// \tdp[i][g]=max;\n\t// \t// hash.put(s,max);\n\t// \treturn max;\n\t// }\n\t// static boolean prime(long n)\n\t// {\n\t// \tif(n==1){return false;}\n // if (n <= 3) \n // return true; \n \n // if (n % 2 == 0 || n % 3 == 0) \n // return false; \n \n // for (int i = 5; i * i <= n; i = i + 6) \n // if (n % i == 0 || n % (i + 2) == 0) \n // return false; \n \n // return true; \n\t// }\n\t// static int[] gg(String y){\n\t// \tint a[]=new int[y.length()];\n\t// \tfor(int i=0;i<y.length();i++)\n\t// \t{\n\t// \t\ta[i]=(int)y.charAt(i)-(int)'0';\n\t// \t}\n\t// \treturn a;\n\t// }\n\t// static long get(int a[], int d, int sum, int tight, int i)\n\t// {\n\t// \tif(i==a.length){if(sum%d==0){return 1;}return 0;}\n\t// \t// if(dp[i][sum][tight]!=-1){return dp[i][sum][tight];}\n\t// \t// String s=i+\" \"+sum+\" \"+tight;\n\t// \tif(dp[i][sum][tight]!=-1){return dp[i][sum][tight];}\n\t// \tlong ans=0;\n\t\t\n\t// \tint limit=(tight==0?9:a[i]);\n\t// \t\tfor(int j=0;j<=limit;j++)\n\t// \t\t{\n\t// \t\t\tint newt=(a[i]==j?tight:0);\n\n\t// \t\t\tans=(ans%MOD+get(a,d,(sum+j)%d,newt,i+1)%MOD)%MOD;\n\t// \t\t}\n\t// \t\tdp[i][sum%d][tight]=ans;\n\t// \t\t// hash.put(s,ans);\n\t// \t\treturn ans;\t\n\t// }\n\n\n\t\n\t// static long bfs(int src, ArrayList<ArrayList<Integer>>arr)\n\t// {\n\t// \tQueue<Pair>q=new LinkedList<>();\n\t// \tq.add(new Pair(src,1,1));\n\t// \tvisited[src]=true;\n\t// \tlong ans=0;\n\t// \twhile(q.size()!=0)\n\t// \t{\n\t// \t\tans=0;\n\t// \t\tint size=q.size();\n\t// \t\tfor(int j=0;j<size;j++)\n\t// \t\t{\n\t// \t\t\tPair t=q.poll();\n\t// \t\t\tans=(ans%MOD+(t.b%MOD+t.c%MOD)%MOD)%MOD;\n\t// \t\t\tfor(Integer node:arr.get(t.a))\n\t// \t\t\t{\n\t// \t\t\t\tif(!visited[node])\n\t// \t\t\t\t{\n\t// \t\t\t\t\tvisited[node]=true;\n\t// \t\t\t\t\tq.add(new Pair(node,t.b+t.c,t.b));\n\t// \t\t\t\t}\n\t// \t\t\t}\n\t// \t\t}\n\t// \t}\n\t// \treturn ans%MOD;\n\t// }\n}\nclass Pair\n{\n\t\n\tlong a;\n\tlong b;\n\tPair(long f, long h)\n\t{\n\t\t\n\t\ta=f;\n\t\tb=h;\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"class Main\n{\n\tstatic boolean visited[];\n\tstatic long dp[][][];\n\tstatic long MOD=1000000007L;\n\tstatic Hashtable<String , Long>hash=new Hashtable<>();\n\tpublic static void main(String args[]) throws java.lang.Exception\n\t{\n\t\tBufferedReader inp = new BufferedReader (new InputStreamReader(System.in));\n\t\tString h[]=inp.readLine().split(\" \");\n\t\tString hh[]=new String[0];\n\t\tif(Integer.parseInt(h[1])!=0){hh=inp.readLine().split(\" \");}\n\t\tHashSet<Integer>hash=new HashSet<>();\n\t\tfor(int i=0;i<hh.length;i++){hash.add(Integer.parseInt(hh[i]));}\n\t\t// Arrays.sort(arr);\n\t\tint x=Integer.parseInt(h[0]);\n\t\tint x1=x;\n\t\tint ans=0;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){ans=x1;break;}\n\t\t\tx1++;\n\t\t}\n\t\tx1=x-1;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}\n\t\t\tx1--;\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\tstatic long get(long x, String s, long arr[], int i,int a, int b)\n\t{\n\t\tif(i==s.length()){return x==0?1:2;}\n\t\t// String ss=i+\" \"+x;\n\t\t// if(hash.containsKey(ss)){return hash.get(ss);}\n\t\tif(dp[i][a][b]!=0){return dp[i][a][b];}\n\t\tif(s.charAt(i)=='1')\n\t\t{\n\t\t\t\tdp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b));\n\t\t}\n\t\telse{\n\t\tdp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b));}\n\t\treturn dp[i][a][b];\n\t}\n\n\t\t// System.out.println(a);\n\t\t\n\t\n\t// static long get(int i,int pre, int n, int arr[],boolean visited[])\n\t// {\n\t// \tif(i==n){return 1;}\n\t// \tlong ans=0;\n\t// \tif(dp[i][pre]!=-1){return dp[i][pre];}\n\t// \tif(arr[i]==1)\n\t// \t{\n\t// \t\tfor(int k=pre+1;k<=n;k++)\n\t// \t\t{\n\t// \t\t\tif(!visited[k])\n\t// \t\t\t{\n\t// \t\t\t\tvisited[k]=true;\n\t// \t\t\t\tans=(ans%MOD+get(i+1,k,n,arr,visited)%MOD)%MOD;\n\t// \t\t\t\tvisited[k]=false;\n\t// \t\t\t}\n\t// \t\t}\n\t// \t\tdp[i][pre]=ans;\n\t// \t\treturn ans;\n\t// \t}\n\t// \tfor(int k=1;k<pre;k++)\n\t// \t{\n\t// \t\tif(!visited[k])\n\t// \t\t{\n\t// \t\t\tvisited[k]=true;\n\t// \t\t\tans=(ans%MOD+get(i+1,k,n,arr,visited)%MOD)%MOD;\n\t// \t\t\tvisited[k]=false;\n\t// \t\t}\n\t// \t}\n\t// \tdp[i][pre]=ans;\n\t// \treturn ans;\n\n\t// }\n\t// static long getall(int gg[], long arr[][], int i, int g)\n\t// {\n\t// \tif(i==arr.length)\n\t// \t{\n\t// \t\tlong ans=0;\n\t// \t\tfor(int j=0;j<=g;j++)\n\t// \t\t{\n\t// \t\t\tArrayList<Integer>arr1=new ArrayList<>();\n\t// \t\t\tfor(int k=0;k<gg.length;k++)\n\t// \t\t\t{\n\t// \t\t\t\tif(gg[k]==j){arr1.add(k);}\n\t// \t\t\t}\n\t// \t\t\tfor(int k=0;k<arr1.size()-1;k++)\n\t// \t\t\t{\n\t// \t\t\t\tfor(int l=k+1;l<arr1.size();l++)\n\t// \t\t\t\t{\n\t// \t\t\t\t\tans+=arr[arr1.get(k)][arr1.get(l)];\n\t// \t\t\t\t}\n\t// \t\t\t}\n\t// \t\t}\n\t// \t\treturn ans;\n\t// \t}\n\t// \tString s=Arrays.toString(gg);\n\t// \t// if(hash.containsKey(s)){return hash.get(s);}\n\t// \tif(dp[i][g]!=0){return dp[i][g];}\n\t// \tgg[i]=g+1;\n\t// \tlong max=getall(gg,arr,i+1,g+1);\n\t// \tfor(int k=0;k<=g;k++)\n\t// \t{\n\t// \t\tgg[i]=k;\n\t// \t\tmax=Math.max(getall(gg,arr,i+1,g),max);\n\t// \t}\n\t// \tdp[i][g]=max;\n\t// \t// hash.put(s,max);\n\t// \treturn max;\n\t// }\n\t// static boolean prime(long n)\n\t// {\n\t// \tif(n==1){return false;}\n // if (n <= 3) \n // return true; \n \n // if (n % 2 == 0 || n % 3 == 0) \n // return false; \n \n // for (int i = 5; i * i <= n; i = i + 6) \n // if (n % i == 0 || n % (i + 2) == 0) \n // return false; \n \n // return true; \n\t// }\n\t// static int[] gg(String y){\n\t// \tint a[]=new int[y.length()];\n\t// \tfor(int i=0;i<y.length();i++)\n\t// \t{\n\t// \t\ta[i]=(int)y.charAt(i)-(int)'0';\n\t// \t}\n\t// \treturn a;\n\t// }\n\t// static long get(int a[], int d, int sum, int tight, int i)\n\t// {\n\t// \tif(i==a.length){if(sum%d==0){return 1;}return 0;}\n\t// \t// if(dp[i][sum][tight]!=-1){return dp[i][sum][tight];}\n\t// \t// String s=i+\" \"+sum+\" \"+tight;\n\t// \tif(dp[i][sum][tight]!=-1){return dp[i][sum][tight];}\n\t// \tlong ans=0;\n\t\t\n\t// \tint limit=(tight==0?9:a[i]);\n\t// \t\tfor(int j=0;j<=limit;j++)\n\t// \t\t{\n\t// \t\t\tint newt=(a[i]==j?tight:0);\n\n\t// \t\t\tans=(ans%MOD+get(a,d,(sum+j)%d,newt,i+1)%MOD)%MOD;\n\t// \t\t}\n\t// \t\tdp[i][sum%d][tight]=ans;\n\t// \t\t// hash.put(s,ans);\n\t// \t\treturn ans;\t\n\t// }\n\n\n\t\n\t// static long bfs(int src, ArrayList<ArrayList<Integer>>arr)\n\t// {\n\t// \tQueue<Pair>q=new LinkedList<>();\n\t// \tq.add(new Pair(src,1,1));\n\t// \tvisited[src]=true;\n\t// \tlong ans=0;\n\t// \twhile(q.size()!=0)\n\t// \t{\n\t// \t\tans=0;\n\t// \t\tint size=q.size();\n\t// \t\tfor(int j=0;j<size;j++)\n\t// \t\t{\n\t// \t\t\tPair t=q.poll();\n\t// \t\t\tans=(ans%MOD+(t.b%MOD+t.c%MOD)%MOD)%MOD;\n\t// \t\t\tfor(Integer node:arr.get(t.a))\n\t// \t\t\t{\n\t// \t\t\t\tif(!visited[node])\n\t// \t\t\t\t{\n\t// \t\t\t\t\tvisited[node]=true;\n\t// \t\t\t\t\tq.add(new Pair(node,t.b+t.c,t.b));\n\t// \t\t\t\t}\n\t// \t\t\t}\n\t// \t\t}\n\t// \t}\n\t// \treturn ans%MOD;\n\t// }\n}",
"Main",
"static boolean visited[];",
"visited",
"static long dp[][][];",
"dp",
"static long MOD=1000000007L;",
"MOD",
"1000000007L",
"static Hashtable<String , Long>hash=new Hashtable<>();",
"hash",
"new Hashtable<>()",
"public static void main(String args[]) throws java.lang.Exception\n\t{\n\t\tBufferedReader inp = new BufferedReader (new InputStreamReader(System.in));\n\t\tString h[]=inp.readLine().split(\" \");\n\t\tString hh[]=new String[0];\n\t\tif(Integer.parseInt(h[1])!=0){hh=inp.readLine().split(\" \");}\n\t\tHashSet<Integer>hash=new HashSet<>();\n\t\tfor(int i=0;i<hh.length;i++){hash.add(Integer.parseInt(hh[i]));}\n\t\t// Arrays.sort(arr);\n\t\tint x=Integer.parseInt(h[0]);\n\t\tint x1=x;\n\t\tint ans=0;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){ans=x1;break;}\n\t\t\tx1++;\n\t\t}\n\t\tx1=x-1;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}\n\t\t\tx1--;\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}",
"main",
"{\n\t\tBufferedReader inp = new BufferedReader (new InputStreamReader(System.in));\n\t\tString h[]=inp.readLine().split(\" \");\n\t\tString hh[]=new String[0];\n\t\tif(Integer.parseInt(h[1])!=0){hh=inp.readLine().split(\" \");}\n\t\tHashSet<Integer>hash=new HashSet<>();\n\t\tfor(int i=0;i<hh.length;i++){hash.add(Integer.parseInt(hh[i]));}\n\t\t// Arrays.sort(arr);\n\t\tint x=Integer.parseInt(h[0]);\n\t\tint x1=x;\n\t\tint ans=0;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){ans=x1;break;}\n\t\t\tx1++;\n\t\t}\n\t\tx1=x-1;\n\t\twhile(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}\n\t\t\tx1--;\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}",
"BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));",
"inp",
"new BufferedReader (new InputStreamReader(System.in))",
"String h[]=inp.readLine().split(\" \");",
"h",
"inp.readLine().split(\" \")",
"inp.readLine().split",
"inp.readLine()",
"inp.readLine",
"inp",
"\" \"",
"String hh[]=new String[0];",
"hh",
"new String[0]",
"0",
"if(Integer.parseInt(h[1])!=0){hh=inp.readLine().split(\" \");}",
"Integer.parseInt(h[1])!=0",
"Integer.parseInt(h[1])",
"Integer.parseInt",
"Integer",
"h[1]",
"h",
"1",
"0",
"{hh=inp.readLine().split(\" \");}",
"hh=inp.readLine().split(\" \")",
"hh",
"inp.readLine().split(\" \")",
"inp.readLine().split",
"inp.readLine()",
"inp.readLine",
"inp",
"\" \"",
"HashSet<Integer>hash=new HashSet<>();",
"hash",
"new HashSet<>()",
"for(int i=0;i<hh.length;i++){hash.add(Integer.parseInt(hh[i]));}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<hh.length",
"i",
"hh.length",
"hh",
"hh.length",
"i++",
"i++",
"i",
"{hash.add(Integer.parseInt(hh[i]));}",
"{hash.add(Integer.parseInt(hh[i]));}",
"hash.add(Integer.parseInt(hh[i]))",
"hash.add",
"hash",
"Integer.parseInt(hh[i])",
"Integer.parseInt",
"Integer",
"hh[i]",
"hh",
"i",
"int x=Integer.parseInt(h[0]);",
"x",
"Integer.parseInt(h[0])",
"Integer.parseInt",
"Integer",
"h[0]",
"h",
"0",
"int x1=x;",
"x1",
"x",
"int ans=0;",
"ans",
"0",
"while(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){ans=x1;break;}\n\t\t\tx1++;\n\t\t}",
"true",
"{\n\t\t\tif(!hash.contains(x1)){ans=x1;break;}\n\t\t\tx1++;\n\t\t}",
"if(!hash.contains(x1)){ans=x1;break;}",
"!hash.contains(x1)",
"hash.contains(x1)",
"hash.contains",
"hash",
"x1",
"{ans=x1;break;}",
"ans=x1",
"ans",
"x1",
"break;",
"x1++",
"x1",
"x1=x-1",
"x1",
"x-1",
"x",
"1",
"while(true)\n\t\t{\n\t\t\tif(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}\n\t\t\tx1--;\n\t\t}",
"true",
"{\n\t\t\tif(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}\n\t\t\tx1--;\n\t\t}",
"if(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}",
"!hash.contains(x1)",
"hash.contains(x1)",
"hash.contains",
"hash",
"x1",
"{if(x-x1<=ans-x){ans=x1;}break;}",
"if(x-x1<=ans-x){ans=x1;}",
"x-x1<=ans-x",
"x-x1",
"x",
"x1",
"ans-x",
"ans",
"x",
"{ans=x1;}",
"ans=x1",
"ans",
"x1",
"break;",
"x1--",
"x1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args",
"static long get(long x, String s, long arr[], int i,int a, int b)\n\t{\n\t\tif(i==s.length()){return x==0?1:2;}\n\t\t// String ss=i+\" \"+x;\n\t\t// if(hash.containsKey(ss)){return hash.get(ss);}\n\t\tif(dp[i][a][b]!=0){return dp[i][a][b];}\n\t\tif(s.charAt(i)=='1')\n\t\t{\n\t\t\t\tdp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b));\n\t\t}\n\t\telse{\n\t\tdp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b));}\n\t\treturn dp[i][a][b];\n\t}",
"get",
"{\n\t\tif(i==s.length()){return x==0?1:2;}\n\t\t// String ss=i+\" \"+x;\n\t\t// if(hash.containsKey(ss)){return hash.get(ss);}\n\t\tif(dp[i][a][b]!=0){return dp[i][a][b];}\n\t\tif(s.charAt(i)=='1')\n\t\t{\n\t\t\t\tdp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b));\n\t\t}\n\t\telse{\n\t\tdp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b));}\n\t\treturn dp[i][a][b];\n\t}",
"if(i==s.length()){return x==0?1:2;}",
"i==s.length()",
"i",
"s.length()",
"s.length",
"s",
"{return x==0?1:2;}",
"return x==0?1:2;",
"x==0?1:2",
"x==0",
"x",
"0",
"1",
"2",
"if(dp[i][a][b]!=0){return dp[i][a][b];}",
"dp[i][a][b]!=0",
"dp[i][a][b]",
"dp[i][a]",
"dp[i]",
"dp",
"i",
"a",
"b",
"0",
"{return dp[i][a][b];}",
"return dp[i][a][b];",
"dp[i][a][b]",
"dp[i][a]",
"dp[i]",
"dp",
"i",
"a",
"b",
"if(s.charAt(i)=='1')\n\t\t{\n\t\t\t\tdp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b));\n\t\t}\n\t\telse{\n\t\tdp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b));}",
"s.charAt(i)=='1'",
"s.charAt(i)",
"s.charAt",
"s",
"i",
"'1'",
"{\n\t\t\t\tdp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b));\n\t\t}",
"dp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b))",
"dp[i][a][b]",
"dp[i][a]",
"dp[i]",
"dp",
"i",
"a",
"b",
"Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b))",
"Math.max",
"Math",
"get(x^arr[i],s,arr,i+1,a,b+1)",
"get",
"x^arr[i]",
"x",
"arr[i]",
"arr",
"i",
"s",
"arr",
"i+1",
"i",
"1",
"a",
"b+1",
"b",
"1",
"get(x,s,arr,i+1,a,b)",
"get",
"x",
"s",
"arr",
"i+1",
"i",
"1",
"a",
"b",
"{\n\t\tdp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b));}",
"dp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b))",
"dp[i][a][b]",
"dp[i][a]",
"dp[i]",
"dp",
"i",
"a",
"b",
"Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b))",
"Math.min",
"Math",
"get(x^arr[i],s,arr,i+1,a+1,b)",
"get",
"x^arr[i]",
"x",
"arr[i]",
"arr",
"i",
"s",
"arr",
"i+1",
"i",
"1",
"a+1",
"a",
"1",
"b",
"get(x,s,arr,i+1,a,b)",
"get",
"x",
"s",
"arr",
"i+1",
"i",
"1",
"a",
"b",
"return dp[i][a][b];",
"dp[i][a][b]",
"dp[i][a]",
"dp[i]",
"dp",
"i",
"a",
"b",
"long x",
"x",
"String s",
"s",
"long arr[]",
"arr",
"int i",
"i",
"int a",
"a",
"int b",
"b",
"class Pair\n{\n\t\n\tlong a;\n\tlong b;\n\tPair(long f, long h)\n\t{\n\t\t\n\t\ta=f;\n\t\tb=h;\n\t}\n}",
"Pair",
"long a;",
"a",
"long b;",
"b",
"Pair(long f, long h)\n\t{\n\t\t\n\t\ta=f;\n\t\tb=h;\n\t}",
"Pair",
"{\n\t\t\n\t\ta=f;\n\t\tb=h;\n\t}",
"a=f",
"a",
"f",
"b=h",
"b",
"h",
"long f",
"f",
"long h",
"h"
]
| import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
class Main
{
static boolean visited[];
static long dp[][][];
static long MOD=1000000007L;
static Hashtable<String , Long>hash=new Hashtable<>();
public static void main(String args[]) throws java.lang.Exception
{
BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));
String h[]=inp.readLine().split(" ");
String hh[]=new String[0];
if(Integer.parseInt(h[1])!=0){hh=inp.readLine().split(" ");}
HashSet<Integer>hash=new HashSet<>();
for(int i=0;i<hh.length;i++){hash.add(Integer.parseInt(hh[i]));}
// Arrays.sort(arr);
int x=Integer.parseInt(h[0]);
int x1=x;
int ans=0;
while(true)
{
if(!hash.contains(x1)){ans=x1;break;}
x1++;
}
x1=x-1;
while(true)
{
if(!hash.contains(x1)){if(x-x1<=ans-x){ans=x1;}break;}
x1--;
}
System.out.println(ans);
}
static long get(long x, String s, long arr[], int i,int a, int b)
{
if(i==s.length()){return x==0?1:2;}
// String ss=i+" "+x;
// if(hash.containsKey(ss)){return hash.get(ss);}
if(dp[i][a][b]!=0){return dp[i][a][b];}
if(s.charAt(i)=='1')
{
dp[i][a][b]=Math.max(get(x^arr[i],s,arr,i+1,a,b+1),get(x,s,arr,i+1,a,b));
}
else{
dp[i][a][b]=Math.min(get(x^arr[i],s,arr,i+1,a+1,b),get(x,s,arr,i+1,a,b));}
return dp[i][a][b];
}
// System.out.println(a);
// static long get(int i,int pre, int n, int arr[],boolean visited[])
// {
// if(i==n){return 1;}
// long ans=0;
// if(dp[i][pre]!=-1){return dp[i][pre];}
// if(arr[i]==1)
// {
// for(int k=pre+1;k<=n;k++)
// {
// if(!visited[k])
// {
// visited[k]=true;
// ans=(ans%MOD+get(i+1,k,n,arr,visited)%MOD)%MOD;
// visited[k]=false;
// }
// }
// dp[i][pre]=ans;
// return ans;
// }
// for(int k=1;k<pre;k++)
// {
// if(!visited[k])
// {
// visited[k]=true;
// ans=(ans%MOD+get(i+1,k,n,arr,visited)%MOD)%MOD;
// visited[k]=false;
// }
// }
// dp[i][pre]=ans;
// return ans;
// }
// static long getall(int gg[], long arr[][], int i, int g)
// {
// if(i==arr.length)
// {
// long ans=0;
// for(int j=0;j<=g;j++)
// {
// ArrayList<Integer>arr1=new ArrayList<>();
// for(int k=0;k<gg.length;k++)
// {
// if(gg[k]==j){arr1.add(k);}
// }
// for(int k=0;k<arr1.size()-1;k++)
// {
// for(int l=k+1;l<arr1.size();l++)
// {
// ans+=arr[arr1.get(k)][arr1.get(l)];
// }
// }
// }
// return ans;
// }
// String s=Arrays.toString(gg);
// // if(hash.containsKey(s)){return hash.get(s);}
// if(dp[i][g]!=0){return dp[i][g];}
// gg[i]=g+1;
// long max=getall(gg,arr,i+1,g+1);
// for(int k=0;k<=g;k++)
// {
// gg[i]=k;
// max=Math.max(getall(gg,arr,i+1,g),max);
// }
// dp[i][g]=max;
// // hash.put(s,max);
// return max;
// }
// static boolean prime(long n)
// {
// if(n==1){return false;}
// if (n <= 3)
// return true;
// if (n % 2 == 0 || n % 3 == 0)
// return false;
// for (int i = 5; i * i <= n; i = i + 6)
// if (n % i == 0 || n % (i + 2) == 0)
// return false;
// return true;
// }
// static int[] gg(String y){
// int a[]=new int[y.length()];
// for(int i=0;i<y.length();i++)
// {
// a[i]=(int)y.charAt(i)-(int)'0';
// }
// return a;
// }
// static long get(int a[], int d, int sum, int tight, int i)
// {
// if(i==a.length){if(sum%d==0){return 1;}return 0;}
// // if(dp[i][sum][tight]!=-1){return dp[i][sum][tight];}
// // String s=i+" "+sum+" "+tight;
// if(dp[i][sum][tight]!=-1){return dp[i][sum][tight];}
// long ans=0;
// int limit=(tight==0?9:a[i]);
// for(int j=0;j<=limit;j++)
// {
// int newt=(a[i]==j?tight:0);
// ans=(ans%MOD+get(a,d,(sum+j)%d,newt,i+1)%MOD)%MOD;
// }
// dp[i][sum%d][tight]=ans;
// // hash.put(s,ans);
// return ans;
// }
// static long bfs(int src, ArrayList<ArrayList<Integer>>arr)
// {
// Queue<Pair>q=new LinkedList<>();
// q.add(new Pair(src,1,1));
// visited[src]=true;
// long ans=0;
// while(q.size()!=0)
// {
// ans=0;
// int size=q.size();
// for(int j=0;j<size;j++)
// {
// Pair t=q.poll();
// ans=(ans%MOD+(t.b%MOD+t.c%MOD)%MOD)%MOD;
// for(Integer node:arr.get(t.a))
// {
// if(!visited[node])
// {
// visited[node]=true;
// q.add(new Pair(node,t.b+t.c,t.b));
// }
// }
// }
// }
// return ans%MOD;
// }
}
class Pair
{
long a;
long b;
Pair(long f, long h)
{
a=f;
b=h;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
17,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
14,
40,
4,
18,
4,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
14,
40,
4,
18,
4,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
125,
5
],
[
125,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
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
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
46,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
58,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
58,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
58,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
58,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
83,
89
],
[
81,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
90,
99
],
[
58,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
102,
108
],
[
100,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
115,
117
],
[
109,
118
],
[
8,
119
],
[
119,
120
],
[
120,
121
],
[
6,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
]
| [
"\nimport java.util.*;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int x = scn.nextInt();\n int n = scn.nextInt();\n String[] p = new String[n];\n for(int i=0;i<n;i++){\n p[i]=scn.next();\n }\n for(int j=0;j<=51;j++){\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }\n scn.close();\n\n }\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int x = scn.nextInt();\n int n = scn.nextInt();\n String[] p = new String[n];\n for(int i=0;i<n;i++){\n p[i]=scn.next();\n }\n for(int j=0;j<=51;j++){\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }\n scn.close();\n\n }\n\n}",
"Main",
"public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int x = scn.nextInt();\n int n = scn.nextInt();\n String[] p = new String[n];\n for(int i=0;i<n;i++){\n p[i]=scn.next();\n }\n for(int j=0;j<=51;j++){\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }\n scn.close();\n\n }",
"main",
"{\n Scanner scn = new Scanner(System.in);\n int x = scn.nextInt();\n int n = scn.nextInt();\n String[] p = new String[n];\n for(int i=0;i<n;i++){\n p[i]=scn.next();\n }\n for(int j=0;j<=51;j++){\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }\n scn.close();\n\n }",
"Scanner scn = new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int x = scn.nextInt();",
"x",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int n = scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"String[] p = new String[n];",
"p",
"new String[n]",
"n",
"for(int i=0;i<n;i++){\n p[i]=scn.next();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i]=scn.next();\n }",
"{\n p[i]=scn.next();\n }",
"p[i]=scn.next()",
"p[i]",
"p",
"i",
"scn.next()",
"scn.next",
"scn",
"for(int j=0;j<=51;j++){\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<=51",
"j",
"51",
"j++",
"j++",
"j",
"{\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }",
"{\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }",
"int min = x-j;",
"min",
"x-j",
"x",
"j",
"int max = x+j;",
"max",
"x+j",
"x",
"j",
"String mi = String.valueOf(min);",
"mi",
"String.valueOf(min)",
"String.valueOf",
"String",
"min",
"String ma = String.valueOf(max);",
"ma",
"String.valueOf(max)",
"String.valueOf",
"String",
"max",
"if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }",
"!Arrays.asList(p).contains(mi)",
"Arrays.asList(p).contains(mi)",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"mi",
"{\n System.out.println(x-j);\n return;\n }",
"System.out.println(x-j)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-j",
"x",
"j",
"return;",
"if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }",
"!Arrays.asList(p).contains(ma)",
"Arrays.asList(p).contains(ma)",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"ma",
"{\n System.out.println(x+j);\n return;\n }",
"System.out.println(x+j)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+j",
"x",
"j",
"return;",
"scn.close()",
"scn.close",
"scn",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int x = scn.nextInt();\n int n = scn.nextInt();\n String[] p = new String[n];\n for(int i=0;i<n;i++){\n p[i]=scn.next();\n }\n for(int j=0;j<=51;j++){\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }\n scn.close();\n\n }\n\n}",
"public class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int x = scn.nextInt();\n int n = scn.nextInt();\n String[] p = new String[n];\n for(int i=0;i<n;i++){\n p[i]=scn.next();\n }\n for(int j=0;j<=51;j++){\n int min = x-j;\n int max = x+j;\n String mi = String.valueOf(min);\n String ma = String.valueOf(max);\n\n if(!Arrays.asList(p).contains(mi)){\n System.out.println(x-j);\n return;\n }\n if(!Arrays.asList(p).contains(ma)){\n System.out.println(x+j);\n return;\n }\n\n }\n scn.close();\n\n }\n\n}",
"Main"
]
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int x = scn.nextInt();
int n = scn.nextInt();
String[] p = new String[n];
for(int i=0;i<n;i++){
p[i]=scn.next();
}
for(int j=0;j<=51;j++){
int min = x-j;
int max = x+j;
String mi = String.valueOf(min);
String ma = String.valueOf(max);
if(!Arrays.asList(p).contains(mi)){
System.out.println(x-j);
return;
}
if(!Arrays.asList(p).contains(ma)){
System.out.println(x+j);
return;
}
}
scn.close();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
42,
17,
30,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
29,
0,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
29,
40,
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
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
72,
79
],
[
60,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
60,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
85,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
91,
98
],
[
60,
99
],
[
99,
100
],
[
6,
101
],
[
101,
102
]
]
| [
"import java.util.*;\nclass Main {\n public static void main(String []args) {\n Scanner scn= new Scanner(System.in);\n int x= scn.nextInt();\n int n=scn.nextInt();\n int []arr= new int[n];\n HashSet<Integer> map= new HashSet<>();\n for(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n map.add(arr[i]);\n }\n int diff=0;\n while(true){\n int no=x-diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n no=x+diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n diff++;\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String []args) {\n Scanner scn= new Scanner(System.in);\n int x= scn.nextInt();\n int n=scn.nextInt();\n int []arr= new int[n];\n HashSet<Integer> map= new HashSet<>();\n for(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n map.add(arr[i]);\n }\n int diff=0;\n while(true){\n int no=x-diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n no=x+diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n diff++;\n }\n }\n}",
"Main",
"public static void main(String []args) {\n Scanner scn= new Scanner(System.in);\n int x= scn.nextInt();\n int n=scn.nextInt();\n int []arr= new int[n];\n HashSet<Integer> map= new HashSet<>();\n for(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n map.add(arr[i]);\n }\n int diff=0;\n while(true){\n int no=x-diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n no=x+diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n diff++;\n }\n }",
"main",
"{\n Scanner scn= new Scanner(System.in);\n int x= scn.nextInt();\n int n=scn.nextInt();\n int []arr= new int[n];\n HashSet<Integer> map= new HashSet<>();\n for(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n map.add(arr[i]);\n }\n int diff=0;\n while(true){\n int no=x-diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n no=x+diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n diff++;\n }\n }",
"Scanner scn= new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int x= scn.nextInt();",
"x",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int n=scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int []arr= new int[n];",
"arr",
"new int[n]",
"n",
"HashSet<Integer> map= new HashSet<>();",
"map",
"new HashSet<>()",
"for(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n map.add(arr[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i]=scn.nextInt();\n map.add(arr[i]);\n }",
"{\n arr[i]=scn.nextInt();\n map.add(arr[i]);\n }",
"arr[i]=scn.nextInt()",
"arr[i]",
"arr",
"i",
"scn.nextInt()",
"scn.nextInt",
"scn",
"map.add(arr[i])",
"map.add",
"map",
"arr[i]",
"arr",
"i",
"int diff=0;",
"diff",
"0",
"while(true){\n int no=x-diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n no=x+diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n diff++;\n }",
"true",
"{\n int no=x-diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n no=x+diff;\n if(!map.contains(no)){\n System.out.println(no);\n return;\n }\n diff++;\n }",
"int no=x-diff;",
"no",
"x-diff",
"x",
"diff",
"if(!map.contains(no)){\n System.out.println(no);\n return;\n }",
"!map.contains(no)",
"map.contains(no)",
"map.contains",
"map",
"no",
"{\n System.out.println(no);\n return;\n }",
"System.out.println(no)",
"System.out.println",
"System.out",
"System",
"System.out",
"no",
"return;",
"no=x+diff",
"no",
"x+diff",
"x",
"diff",
"if(!map.contains(no)){\n System.out.println(no);\n return;\n }",
"!map.contains(no)",
"map.contains(no)",
"map.contains",
"map",
"no",
"{\n System.out.println(no);\n return;\n }",
"System.out.println(no)",
"System.out.println",
"System.out",
"System",
"System.out",
"no",
"return;",
"diff++",
"diff",
"String []args",
"args"
]
| import java.util.*;
class Main {
public static void main(String []args) {
Scanner scn= new Scanner(System.in);
int x= scn.nextInt();
int n=scn.nextInt();
int []arr= new int[n];
HashSet<Integer> map= new HashSet<>();
for(int i=0;i<n;i++){
arr[i]=scn.nextInt();
map.add(arr[i]);
}
int diff=0;
while(true){
int no=x-diff;
if(!map.contains(no)){
System.out.println(no);
return;
}
no=x+diff;
if(!map.contains(no)){
System.out.println(no);
return;
}
diff++;
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
4,
18,
13,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
3,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
30,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
4,
18,
13,
13,
29,
4,
13,
13,
23,
13,
12,
13,
30,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
6,
13,
12,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
362,
26
],
[
362,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
29,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
29,
40
],
[
40,
41
],
[
40,
42
],
[
29,
43
],
[
43,
44
],
[
43,
45
],
[
29,
46
],
[
46,
47
],
[
46,
48
],
[
29,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
49,
53
],
[
49,
54
],
[
29,
55
],
[
55,
56
],
[
56,
57
],
[
27,
58
],
[
58,
59
],
[
362,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
64,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
99,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
83,
109
],
[
109,
110
],
[
109,
111
],
[
83,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
118,
119
],
[
112,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
122,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
121,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
141,
147
],
[
121,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
153,
154
],
[
153,
155
],
[
148,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
156,
162
],
[
83,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
62,
167
],
[
167,
168
],
[
62,
169
],
[
169,
170
],
[
62,
171
],
[
171,
172
],
[
362,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
173,
177
],
[
177,
178
],
[
177,
179
],
[
173,
181
],
[
181,
182
],
[
173,
183
],
[
183,
184
],
[
173,
185
],
[
185,
186
],
[
173,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
187,
195
],
[
195,
196
],
[
173,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
200,
205
],
[
205,
206
],
[
206,
207
],
[
199,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
212,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
216,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
225,
228
],
[
212,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
229,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
199,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
173,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
244,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
244,
258
],
[
258,
259
],
[
258,
260
],
[
244,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
261,
265
],
[
265,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
265,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
244,
274
],
[
274,
275
],
[
274,
276
],
[
244,
277
],
[
277,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
277,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
285,
287
],
[
284,
288
],
[
288,
289
],
[
288,
290
],
[
283,
291
],
[
291,
292
],
[
292,
293
],
[
282,
294
],
[
294,
295
],
[
294,
296
],
[
282,
297
],
[
297,
298
],
[
297,
299
],
[
299,
300
],
[
299,
301
],
[
282,
302
],
[
302,
303
],
[
302,
304
],
[
304,
305
],
[
244,
306
],
[
306,
307
],
[
307,
308
],
[
307,
309
],
[
173,
310
],
[
310,
311
],
[
310,
312
],
[
312,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
313,
317
],
[
317,
318
],
[
318,
319
],
[
319,
320
],
[
320,
321
],
[
319,
322
],
[
312,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
310,
327
],
[
327,
328
],
[
173,
329
],
[
329,
330
],
[
329,
331
],
[
331,
332
],
[
332,
333
],
[
336,
334
],
[
346,
335
],
[
343,
336
],
[
336,
337
],
[
337,
338
],
[
337,
339
],
[
336,
340
],
[
340,
341
],
[
340,
342
],
[
343,
343
],
[
343,
344
],
[
343,
345
],
[
346,
346
],
[
346,
347
],
[
346,
348
],
[
336,
349
],
[
349,
350
],
[
349,
351
],
[
351,
352
],
[
329,
353
],
[
353,
354
],
[
173,
355
],
[
355,
356
],
[
355,
357
],
[
357,
358
],
[
357,
359
],
[
359,
360
],
[
0,
361
],
[
361,
362
],
[
361,
363
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Vishal Burman\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n",
"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.HashSet;",
"HashSet",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"CForbiddenList solver = new CForbiddenList();",
"solver",
"new CForbiddenList()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class CForbiddenList {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }\n }\n\n }",
"CForbiddenList",
"public void solve(int testNumber, InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }\n }",
"solve",
"{\n int x = in.nextInt();\n int n = in.nextInt();\n if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }\n }",
"int x = in.nextInt();",
"x",
"in.nextInt()",
"in.nextInt",
"in",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }",
"n == 0",
"n",
"0",
"out.println(x)",
"out.println",
"out",
"x",
"{\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }",
"HashSet<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int num = in.nextInt();\n set.add(num);\n }",
"{\n int num = in.nextInt();\n set.add(num);\n }",
"int num = in.nextInt();",
"num",
"in.nextInt()",
"in.nextInt",
"in",
"set.add(num)",
"set.add",
"set",
"num",
"int ans = 0;",
"ans",
"0",
"for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i++",
"i++",
"i",
"{\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }",
"{\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }",
"if (!set.contains(x)) {\n ans = x;\n break;\n }",
"!set.contains(x)",
"set.contains(x)",
"set.contains",
"set",
"x",
"{\n ans = x;\n break;\n }",
"ans = x",
"ans",
"x",
"break;",
"if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }",
"!set.contains(x - i)",
"set.contains(x - i)",
"set.contains",
"set",
"x - i",
"x",
"i",
"{\n ans = x - i;\n break;\n }",
"ans = x - i",
"ans",
"x - i",
"x",
"i",
"break;",
"if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }",
"!set.contains(x + i)",
"set.contains(x + i)",
"set.contains",
"set",
"x + i",
"x",
"i",
"{\n ans = x + i;\n break;\n }",
"ans = x + i",
"ans",
"x + i",
"x",
"i",
"break;",
"out.println(ans)",
"out.println",
"out",
"ans",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"PrintWriter out",
"out",
"static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private InputReader.SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"read",
"{\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"if (numChars == -1) {\n throw new InputMismatchException();\n }",
"numChars == -1",
"numChars",
"-1",
"1",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0) {\n return -1;\n }",
"numChars <= 0",
"numChars",
"0",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }",
"if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"isSpaceChar",
"{\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"if (filter != null) {\n return filter.isSpaceChar(c);\n }",
"filter != null",
"filter",
"null",
"{\n return filter.isSpaceChar(c);\n }",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return isWhitespace(c);",
"isWhitespace(c)",
"isWhitespace",
"c",
"int c",
"c",
"public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isWhitespace",
"{\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CForbiddenList solver = new CForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CForbiddenList {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n if (n == 0)\n out.println(x);\n else {\n HashSet<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n int num = in.nextInt();\n set.add(num);\n }\n int ans = 0;\n for (int i = 1; ; i++) {\n if (!set.contains(x)) {\n ans = x;\n break;\n }\n if (!set.contains(x - i)) {\n ans = x - i;\n break;\n }\n if (!set.contains(x + i)) {\n ans = x + i;\n break;\n }\n }\n out.println(ans);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"Main"
]
| import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Vishal Burman
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
CForbiddenList solver = new CForbiddenList();
solver.solve(1, in, out);
out.close();
}
static class CForbiddenList {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int x = in.nextInt();
int n = in.nextInt();
if (n == 0)
out.println(x);
else {
HashSet<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
int num = in.nextInt();
set.add(num);
}
int ans = 0;
for (int i = 1; ; i++) {
if (!set.contains(x)) {
ans = x;
break;
}
if (!set.contains(x - i)) {
ans = x - i;
break;
}
if (!set.contains(x + i)) {
ans = x + i;
break;
}
}
out.println(ans);
}
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
20,
14,
40,
4,
18,
4,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
29,
4,
18,
13,
13,
41,
13,
4,
18,
4,
18,
13,
13,
13,
41,
13,
4,
18,
13,
41,
13,
17,
42,
2,
13,
4,
18,
18,
13,
2,
18,
13,
13,
17,
30,
40,
13,
0,
13,
2,
4,
18,
13,
13,
14,
40,
4,
18,
4,
18,
13,
13,
20,
30,
3,
0,
13,
4,
18,
13,
41,
13,
17,
42,
2,
4,
18,
18,
13,
17,
13,
30,
40,
13,
0,
13,
2,
4,
18,
13,
13,
14,
40,
4,
18,
4,
18,
13,
13,
20,
30,
3,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
4,
18,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
194,
5
],
[
194,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
17,
20
],
[
20,
21
],
[
21,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
27,
34
],
[
8,
35
],
[
35,
36
],
[
35,
37
],
[
8,
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
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
59,
65
],
[
57,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
66,
73
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
8,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
80,
86
],
[
8,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
8,
92
],
[
92,
93
],
[
92,
94
],
[
8,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
95,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
112,
116
],
[
107,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
119,
125
],
[
117,
126
],
[
126,
127
],
[
8,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
8,
133
],
[
133,
134
],
[
133,
135
],
[
8,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
137,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
149,
153
],
[
144,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
158,
161
],
[
156,
162
],
[
154,
163
],
[
163,
164
],
[
8,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
175,
179
],
[
165,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
181,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
186,
190
],
[
6,
191
],
[
191,
192
],
[
0,
193
],
[
193,
194
],
[
193,
195
]
]
| [
"\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger target = new Integer(Integer.parseInt(sc.next()));\n\t\tint n = Integer.parseInt(sc.next()); // 禁止リストの長さ\n\n\t\t// 禁止リストがない場合は目標がそのまま答え\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// 入力(続き)\n\t\tInteger x[] = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}\n\n\t\t// 目標が禁止されていない場合は目標がそのまま答え\n\t\tif (!Arrays.asList(x).contains(target)) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// ソート\n\t\tArrays.sort(x);\n\t\t// System.out.println(Arrays.toString(x));\n\n\t\t// 目標は禁止リストの何番目?\n\t\tint index = Arrays.asList(x).indexOf(target);\n\n\t\t// 左方向に答えを探していく\n\t\tint now = target.intValue();\n\t\tint minus = 0;\n\t\twhile (now <= x[x.length - 1].intValue()) {\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// 右方向に答えを探していく\n\t\tnow = target.intValue();\n\t\tint plus = 0;\n\t\twhile (x[0].intValue() <= now) {\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// System.out.println(minus + \" \" + target + \" \" + plus);\n\n\t\t// 最も近いほうを出力\n\t\tif (minus <= plus) {\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t} else {\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}\n\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger target = new Integer(Integer.parseInt(sc.next()));\n\t\tint n = Integer.parseInt(sc.next()); // 禁止リストの長さ\n\n\t\t// 禁止リストがない場合は目標がそのまま答え\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// 入力(続き)\n\t\tInteger x[] = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}\n\n\t\t// 目標が禁止されていない場合は目標がそのまま答え\n\t\tif (!Arrays.asList(x).contains(target)) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// ソート\n\t\tArrays.sort(x);\n\t\t// System.out.println(Arrays.toString(x));\n\n\t\t// 目標は禁止リストの何番目?\n\t\tint index = Arrays.asList(x).indexOf(target);\n\n\t\t// 左方向に答えを探していく\n\t\tint now = target.intValue();\n\t\tint minus = 0;\n\t\twhile (now <= x[x.length - 1].intValue()) {\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// 右方向に答えを探していく\n\t\tnow = target.intValue();\n\t\tint plus = 0;\n\t\twhile (x[0].intValue() <= now) {\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// System.out.println(minus + \" \" + target + \" \" + plus);\n\n\t\t// 最も近いほうを出力\n\t\tif (minus <= plus) {\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t} else {\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger target = new Integer(Integer.parseInt(sc.next()));\n\t\tint n = Integer.parseInt(sc.next()); // 禁止リストの長さ\n\n\t\t// 禁止リストがない場合は目標がそのまま答え\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// 入力(続き)\n\t\tInteger x[] = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}\n\n\t\t// 目標が禁止されていない場合は目標がそのまま答え\n\t\tif (!Arrays.asList(x).contains(target)) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// ソート\n\t\tArrays.sort(x);\n\t\t// System.out.println(Arrays.toString(x));\n\n\t\t// 目標は禁止リストの何番目?\n\t\tint index = Arrays.asList(x).indexOf(target);\n\n\t\t// 左方向に答えを探していく\n\t\tint now = target.intValue();\n\t\tint minus = 0;\n\t\twhile (now <= x[x.length - 1].intValue()) {\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// 右方向に答えを探していく\n\t\tnow = target.intValue();\n\t\tint plus = 0;\n\t\twhile (x[0].intValue() <= now) {\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// System.out.println(minus + \" \" + target + \" \" + plus);\n\n\t\t// 最も近いほうを出力\n\t\tif (minus <= plus) {\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t} else {\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}\n\n\t}",
"main",
"{\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger target = new Integer(Integer.parseInt(sc.next()));\n\t\tint n = Integer.parseInt(sc.next()); // 禁止リストの長さ\n\n\t\t// 禁止リストがない場合は目標がそのまま答え\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// 入力(続き)\n\t\tInteger x[] = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}\n\n\t\t// 目標が禁止されていない場合は目標がそのまま答え\n\t\tif (!Arrays.asList(x).contains(target)) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// ソート\n\t\tArrays.sort(x);\n\t\t// System.out.println(Arrays.toString(x));\n\n\t\t// 目標は禁止リストの何番目?\n\t\tint index = Arrays.asList(x).indexOf(target);\n\n\t\t// 左方向に答えを探していく\n\t\tint now = target.intValue();\n\t\tint minus = 0;\n\t\twhile (now <= x[x.length - 1].intValue()) {\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// 右方向に答えを探していく\n\t\tnow = target.intValue();\n\t\tint plus = 0;\n\t\twhile (x[0].intValue() <= now) {\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// System.out.println(minus + \" \" + target + \" \" + plus);\n\n\t\t// 最も近いほうを出力\n\t\tif (minus <= plus) {\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t} else {\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"Integer target = new Integer(Integer.parseInt(sc.next()));",
"target",
"new Integer(Integer.parseInt(sc.next()))",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"if (n == 0) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}",
"System.out.println(target)",
"System.out.println",
"System.out",
"System",
"System.out",
"target",
"return;",
"Integer x[] = new Integer[n];",
"x",
"new Integer[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}",
"{\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}",
"x[i] = new Integer(Integer.parseInt(sc.next()))",
"x[i]",
"x",
"i",
"new Integer(Integer.parseInt(sc.next()))",
"if (!Arrays.asList(x).contains(target)) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}",
"!Arrays.asList(x).contains(target)",
"Arrays.asList(x).contains(target)",
"Arrays.asList(x).contains",
"Arrays.asList(x)",
"Arrays.asList",
"Arrays",
"x",
"target",
"{\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}",
"System.out.println(target)",
"System.out.println",
"System.out",
"System",
"System.out",
"target",
"return;",
"Arrays.sort(x)",
"Arrays.sort",
"Arrays",
"x",
"int index = Arrays.asList(x).indexOf(target);",
"index",
"Arrays.asList(x).indexOf(target)",
"Arrays.asList(x).indexOf",
"Arrays.asList(x)",
"Arrays.asList",
"Arrays",
"x",
"target",
"int now = target.intValue();",
"now",
"target.intValue()",
"target.intValue",
"target",
"int minus = 0;",
"minus",
"0",
"while (now <= x[x.length - 1].intValue()) {\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"now <= x[x.length - 1].intValue()",
"now",
"x[x.length - 1].intValue()",
"x[x.length - 1].intValue",
"x[x.length - 1]",
"x",
"x.length - 1",
"x.length",
"x",
"x.length",
"1",
"{\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"minus++",
"minus",
"now = target.intValue() - minus",
"now",
"target.intValue() - minus",
"target.intValue()",
"target.intValue",
"target",
"minus",
"if (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}",
"!Arrays.asList(x).contains(new Integer(now))",
"Arrays.asList(x).contains(new Integer(now))",
"Arrays.asList(x).contains",
"Arrays.asList(x)",
"Arrays.asList",
"Arrays",
"x",
"new Integer(now)",
"{\n\t\t\t\tbreak;\n\t\t\t}",
"break;",
"now = target.intValue()",
"now",
"target.intValue()",
"target.intValue",
"target",
"int plus = 0;",
"plus",
"0",
"while (x[0].intValue() <= now) {\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"x[0].intValue() <= now",
"x[0].intValue()",
"x[0].intValue",
"x[0]",
"x",
"0",
"now",
"{\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"plus++",
"plus",
"now = target.intValue() + plus",
"now",
"target.intValue() + plus",
"target.intValue()",
"target.intValue",
"target",
"plus",
"if (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}",
"!Arrays.asList(x).contains(new Integer(now))",
"Arrays.asList(x).contains(new Integer(now))",
"Arrays.asList(x).contains",
"Arrays.asList(x)",
"Arrays.asList",
"Arrays",
"x",
"new Integer(now)",
"{\n\t\t\t\tbreak;\n\t\t\t}",
"break;",
"if (minus <= plus) {\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t} else {\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}",
"minus <= plus",
"minus",
"plus",
"{\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t}",
"System.out.println(target.intValue() - minus)",
"System.out.println",
"System.out",
"System",
"System.out",
"target.intValue() - minus",
"target.intValue()",
"target.intValue",
"target",
"minus",
"{\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}",
"System.out.println(target.intValue() + plus)",
"System.out.println",
"System.out",
"System",
"System.out",
"target.intValue() + plus",
"target.intValue()",
"target.intValue",
"target",
"plus",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger target = new Integer(Integer.parseInt(sc.next()));\n\t\tint n = Integer.parseInt(sc.next()); // 禁止リストの長さ\n\n\t\t// 禁止リストがない場合は目標がそのまま答え\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// 入力(続き)\n\t\tInteger x[] = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}\n\n\t\t// 目標が禁止されていない場合は目標がそのまま答え\n\t\tif (!Arrays.asList(x).contains(target)) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// ソート\n\t\tArrays.sort(x);\n\t\t// System.out.println(Arrays.toString(x));\n\n\t\t// 目標は禁止リストの何番目?\n\t\tint index = Arrays.asList(x).indexOf(target);\n\n\t\t// 左方向に答えを探していく\n\t\tint now = target.intValue();\n\t\tint minus = 0;\n\t\twhile (now <= x[x.length - 1].intValue()) {\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// 右方向に答えを探していく\n\t\tnow = target.intValue();\n\t\tint plus = 0;\n\t\twhile (x[0].intValue() <= now) {\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// System.out.println(minus + \" \" + target + \" \" + plus);\n\n\t\t// 最も近いほうを出力\n\t\tif (minus <= plus) {\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t} else {\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}\n\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger target = new Integer(Integer.parseInt(sc.next()));\n\t\tint n = Integer.parseInt(sc.next()); // 禁止リストの長さ\n\n\t\t// 禁止リストがない場合は目標がそのまま答え\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// 入力(続き)\n\t\tInteger x[] = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = new Integer(Integer.parseInt(sc.next()));\n\t\t}\n\n\t\t// 目標が禁止されていない場合は目標がそのまま答え\n\t\tif (!Arrays.asList(x).contains(target)) {\n\t\t\tSystem.out.println(target);\n\t\t\treturn;\n\t\t}\n\n\t\t// ソート\n\t\tArrays.sort(x);\n\t\t// System.out.println(Arrays.toString(x));\n\n\t\t// 目標は禁止リストの何番目?\n\t\tint index = Arrays.asList(x).indexOf(target);\n\n\t\t// 左方向に答えを探していく\n\t\tint now = target.intValue();\n\t\tint minus = 0;\n\t\twhile (now <= x[x.length - 1].intValue()) {\n\n\t\t\t// 1歩く\n\t\t\tminus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() - minus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// 右方向に答えを探していく\n\t\tnow = target.intValue();\n\t\tint plus = 0;\n\t\twhile (x[0].intValue() <= now) {\n\n\t\t\t// 1歩く\n\t\t\tplus++;\n\n\t\t\t// そこは?\n\t\t\tnow = target.intValue() + plus;\n\t\t\t// System.out.println(\"ここは\" + now);\n\n\t\t\t// 禁止リストにない数に到達したらwhileループを抜ける\n\t\t\tif (!Arrays.asList(x).contains(new Integer(now))) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// System.out.println(minus + \" \" + target + \" \" + plus);\n\n\t\t// 最も近いほうを出力\n\t\tif (minus <= plus) {\n\t\t\tSystem.out.println(target.intValue() - minus);\n\t\t} else {\n\t\t\tSystem.out.println(target.intValue() + plus);\n\t\t}\n\n\t}\n}",
"Main"
]
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// 入力
Scanner sc = new Scanner(System.in);
Integer target = new Integer(Integer.parseInt(sc.next()));
int n = Integer.parseInt(sc.next()); // 禁止リストの長さ
// 禁止リストがない場合は目標がそのまま答え
if (n == 0) {
System.out.println(target);
return;
}
// 入力(続き)
Integer x[] = new Integer[n];
for (int i = 0; i < n; i++) {
x[i] = new Integer(Integer.parseInt(sc.next()));
}
// 目標が禁止されていない場合は目標がそのまま答え
if (!Arrays.asList(x).contains(target)) {
System.out.println(target);
return;
}
// ソート
Arrays.sort(x);
// System.out.println(Arrays.toString(x));
// 目標は禁止リストの何番目?
int index = Arrays.asList(x).indexOf(target);
// 左方向に答えを探していく
int now = target.intValue();
int minus = 0;
while (now <= x[x.length - 1].intValue()) {
// 1歩く
minus++;
// そこは?
now = target.intValue() - minus;
// System.out.println("ここは" + now);
// 禁止リストにない数に到達したらwhileループを抜ける
if (!Arrays.asList(x).contains(new Integer(now))) {
break;
}
}
// 右方向に答えを探していく
now = target.intValue();
int plus = 0;
while (x[0].intValue() <= now) {
// 1歩く
plus++;
// そこは?
now = target.intValue() + plus;
// System.out.println("ここは" + now);
// 禁止リストにない数に到達したらwhileループを抜ける
if (!Arrays.asList(x).contains(new Integer(now))) {
break;
}
}
// System.out.println(minus + " " + target + " " + plus);
// 最も近いほうを出力
if (minus <= plus) {
System.out.println(target.intValue() - minus);
} else {
System.out.println(target.intValue() + plus);
}
}
} |
[
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,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
13,
42,
2,
13,
17,
30,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
13,
40,
13,
0,
13,
13,
42,
2,
13,
17,
30,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
13,
40,
13,
41,
13,
4,
18,
13,
2,
13,
13,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
29,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
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
],
[
162,
11
],
[
162,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
32,
39
],
[
14,
40
],
[
40,
41
],
[
40,
42
],
[
14,
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
],
[
14,
62
],
[
62,
63
],
[
63,
64
],
[
14,
65
],
[
65,
66
],
[
65,
67
],
[
14,
68
],
[
68,
69
],
[
68,
70
],
[
14,
71
],
[
71,
72
],
[
71,
73
],
[
14,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
80,
85
],
[
79,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
78,
90
],
[
90,
91
],
[
14,
92
],
[
92,
93
],
[
92,
94
],
[
14,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
101,
106
],
[
100,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
99,
111
],
[
111,
112
],
[
14,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
118,
119
],
[
118,
120
],
[
14,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
126,
127
],
[
126,
128
],
[
14,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
133,
140
],
[
14,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
141,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
12,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
]
| [
"import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tsc.close();\n\n\t\tInteger underPos = null;\n\t\tInteger upwardPos = null;\n\n\t\t// 下方向探索\n\t\tint startPos = x;\n\t\twhile (underPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}\n\t\t// 上方向探索\n\t\tstartPos = x;\n\t\twhile (upwardPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}\n\t\t// 差分を出す\n\t\tint underDist = Math.abs(x - underPos);\n\t\tint upwardDist = Math.abs(x - upwardPos);\n\t\tif (underDist == upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}\n\n\t\tif (underDist < upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t} else {\n\t\t\tSystem.out.println(upwardPos);\n\t\t}\n\n\t}\n}",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tsc.close();\n\n\t\tInteger underPos = null;\n\t\tInteger upwardPos = null;\n\n\t\t// 下方向探索\n\t\tint startPos = x;\n\t\twhile (underPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}\n\t\t// 上方向探索\n\t\tstartPos = x;\n\t\twhile (upwardPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}\n\t\t// 差分を出す\n\t\tint underDist = Math.abs(x - underPos);\n\t\tint upwardDist = Math.abs(x - upwardPos);\n\t\tif (underDist == upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}\n\n\t\tif (underDist < upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t} else {\n\t\t\tSystem.out.println(upwardPos);\n\t\t}\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tsc.close();\n\n\t\tInteger underPos = null;\n\t\tInteger upwardPos = null;\n\n\t\t// 下方向探索\n\t\tint startPos = x;\n\t\twhile (underPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}\n\t\t// 上方向探索\n\t\tstartPos = x;\n\t\twhile (upwardPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}\n\t\t// 差分を出す\n\t\tint underDist = Math.abs(x - underPos);\n\t\tint upwardDist = Math.abs(x - upwardPos);\n\t\tif (underDist == upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}\n\n\t\tif (underDist < upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t} else {\n\t\t\tSystem.out.println(upwardPos);\n\t\t}\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tsc.close();\n\n\t\tInteger underPos = null;\n\t\tInteger upwardPos = null;\n\n\t\t// 下方向探索\n\t\tint startPos = x;\n\t\twhile (underPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}\n\t\t// 上方向探索\n\t\tstartPos = x;\n\t\twhile (upwardPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}\n\t\t// 差分を出す\n\t\tint underDist = Math.abs(x - underPos);\n\t\tint upwardDist = Math.abs(x - upwardPos);\n\t\tif (underDist == upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}\n\n\t\tif (underDist < upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t} else {\n\t\t\tSystem.out.println(upwardPos);\n\t\t}\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"Set<Integer> p = new HashSet<>();",
"p",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.close()",
"sc.close",
"sc",
"Integer underPos = null;",
"underPos",
"null",
"Integer upwardPos = null;",
"upwardPos",
"null",
"int startPos = x;",
"startPos",
"x",
"while (underPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}",
"underPos == null",
"underPos",
"null",
"{\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}",
"if (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}",
"p.contains(startPos) != true",
"p.contains(startPos)",
"p.contains",
"p",
"startPos",
"true",
"{\n\t\t\t\tunderPos = startPos;\n\t\t\t}",
"underPos = startPos",
"underPos",
"startPos",
"startPos--",
"startPos",
"startPos = x",
"startPos",
"x",
"while (upwardPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}",
"upwardPos == null",
"upwardPos",
"null",
"{\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}",
"if (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}",
"p.contains(startPos) != true",
"p.contains(startPos)",
"p.contains",
"p",
"startPos",
"true",
"{\n\t\t\t\tupwardPos = startPos;\n\t\t\t}",
"upwardPos = startPos",
"upwardPos",
"startPos",
"startPos++",
"startPos",
"int underDist = Math.abs(x - underPos);",
"underDist",
"Math.abs(x - underPos)",
"Math.abs",
"Math",
"x - underPos",
"x",
"underPos",
"int upwardDist = Math.abs(x - upwardPos);",
"upwardDist",
"Math.abs(x - upwardPos)",
"Math.abs",
"Math",
"x - upwardPos",
"x",
"upwardPos",
"if (underDist == upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}",
"underDist == upwardDist",
"underDist",
"upwardDist",
"{\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}",
"System.out.println(underPos)",
"System.out.println",
"System.out",
"System",
"System.out",
"underPos",
"return;",
"if (underDist < upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t} else {\n\t\t\tSystem.out.println(upwardPos);\n\t\t}",
"underDist < upwardDist",
"underDist",
"upwardDist",
"{\n\t\t\tSystem.out.println(underPos);\n\t\t}",
"System.out.println(underPos)",
"System.out.println",
"System.out",
"System",
"System.out",
"underPos",
"{\n\t\t\tSystem.out.println(upwardPos);\n\t\t}",
"System.out.println(upwardPos)",
"System.out.println",
"System.out",
"System",
"System.out",
"upwardPos",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tsc.close();\n\n\t\tInteger underPos = null;\n\t\tInteger upwardPos = null;\n\n\t\t// 下方向探索\n\t\tint startPos = x;\n\t\twhile (underPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}\n\t\t// 上方向探索\n\t\tstartPos = x;\n\t\twhile (upwardPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}\n\t\t// 差分を出す\n\t\tint underDist = Math.abs(x - underPos);\n\t\tint upwardDist = Math.abs(x - upwardPos);\n\t\tif (underDist == upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}\n\n\t\tif (underDist < upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t} else {\n\t\t\tSystem.out.println(upwardPos);\n\t\t}\n\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif (n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\tsc.close();\n\n\t\tInteger underPos = null;\n\t\tInteger upwardPos = null;\n\n\t\t// 下方向探索\n\t\tint startPos = x;\n\t\twhile (underPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tunderPos = startPos;\n\t\t\t}\n\t\t\tstartPos--;\n\t\t}\n\t\t// 上方向探索\n\t\tstartPos = x;\n\t\twhile (upwardPos == null) {\n\t\t\tif (p.contains(startPos) != true) {\n\t\t\t\tupwardPos = startPos;\n\t\t\t}\n\t\t\tstartPos++;\n\t\t}\n\t\t// 差分を出す\n\t\tint underDist = Math.abs(x - underPos);\n\t\tint upwardDist = Math.abs(x - upwardPos);\n\t\tif (underDist == upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t\treturn;\n\t\t}\n\n\t\tif (underDist < upwardDist) {\n\t\t\tSystem.out.println(underPos);\n\t\t} else {\n\t\t\tSystem.out.println(upwardPos);\n\t\t}\n\n\t}\n}",
"Main"
]
| import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if (n == 0) {
System.out.println(x);
return;
}
Set<Integer> p = new HashSet<>();
for (int i = 0; i < n; i++) {
p.add(sc.nextInt());
}
sc.close();
Integer underPos = null;
Integer upwardPos = null;
// 下方向探索
int startPos = x;
while (underPos == null) {
if (p.contains(startPos) != true) {
underPos = startPos;
}
startPos--;
}
// 上方向探索
startPos = x;
while (upwardPos == null) {
if (p.contains(startPos) != true) {
upwardPos = startPos;
}
startPos++;
}
// 差分を出す
int underDist = Math.abs(x - underPos);
int upwardDist = Math.abs(x - upwardPos);
if (underDist == upwardDist) {
System.out.println(underPos);
return;
}
if (underDist < upwardDist) {
System.out.println(underPos);
} else {
System.out.println(upwardPos);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
2,
4,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
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
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
25,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
36,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
60,
65
],
[
59,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
59,
72
],
[
72,
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
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
91,
93
],
[
87,
94
],
[
86,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
95,
104
],
[
85,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
106,
113
],
[
105,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
114,
123
],
[
9,
124
],
[
124,
125
],
[
0,
126
],
[
126,
127
],
[
126,
128
]
]
| [
"import java.util.*;\nimport java.io.*;\npublic class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n if(y == 0) {\n System.out.println(x);\n }\n else {\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n if(y == 0) {\n System.out.println(x);\n }\n else {\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }\n }\n}",
"Main",
"public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n if(y == 0) {\n System.out.println(x);\n }\n else {\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n if(y == 0) {\n System.out.println(x);\n }\n else {\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int y = sc.nextInt();",
"y",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(y == 0) {\n System.out.println(x);\n }\n else {\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }",
"y == 0",
"y",
"0",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }",
"HashSet<Integer> hs = new HashSet<Integer>();",
"hs",
"new HashSet<Integer>()",
"for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < y",
"i",
"y",
"i++",
"i++",
"i",
"{\n hs.add(sc.nextInt());\n }",
"{\n hs.add(sc.nextInt());\n }",
"hs.add(sc.nextInt())",
"hs.add",
"hs",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}",
"hs.contains(x) == false",
"hs.contains(x)",
"hs.contains",
"hs",
"x",
"false",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}",
"for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }",
"{\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }",
"if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }",
"hs.contains(x-i) == false",
"hs.contains(x-i)",
"hs.contains",
"hs",
"x-i",
"x",
"i",
"false",
"{\n System.out.println(x-i);\n break;\n }",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"break;",
"if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }",
"hs.contains(x+i) == false",
"hs.contains(x+i)",
"hs.contains",
"hs",
"x+i",
"x",
"i",
"false",
"{\n System.out.println(x+i); \n break;\n }",
"System.out.println(x+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"break;",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n if(y == 0) {\n System.out.println(x);\n }\n else {\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }\n }\n}",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n if(y == 0) {\n System.out.println(x);\n }\n else {\n HashSet<Integer> hs = new HashSet<Integer>();\n for(int i = 0; i < y; i++) {\n hs.add(sc.nextInt());\n }\n if(hs.contains(x) == false) \n System.out.println(x);\n else {\n for(int i = 1; i <= 100; i++) {\n \n if(hs.contains(x-i) == false) {\n System.out.println(x-i);\n break;\n }\n if(hs.contains(x+i) == false) {\n System.out.println(x+i); \n break;\n }\n }\n}\n }\n }\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
if(y == 0) {
System.out.println(x);
}
else {
HashSet<Integer> hs = new HashSet<Integer>();
for(int i = 0; i < y; i++) {
hs.add(sc.nextInt());
}
if(hs.contains(x) == false)
System.out.println(x);
else {
for(int i = 1; i <= 100; i++) {
if(hs.contains(x-i) == false) {
System.out.println(x-i);
break;
}
if(hs.contains(x+i) == false) {
System.out.println(x+i);
break;
}
}
}
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
4,
18,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
2,
13,
13,
17,
40,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
14,
2,
2,
2,
13,
13,
17,
40,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
119,
5
],
[
119,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
16,
19
],
[
19,
20
],
[
20,
21
],
[
10,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
24,
27
],
[
27,
28
],
[
28,
29
],
[
10,
30
],
[
30,
31
],
[
30,
32
],
[
10,
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
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
53,
54
],
[
54,
55
],
[
47,
56
],
[
10,
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
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
70,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
83,
92
],
[
69,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
94,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
93,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
106,
115
],
[
6,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\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 int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\n }\n }",
"main",
"{\n try (Scanner sc = new Scanner(System.in)) {\n int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\n }",
"{\n int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int X = Integer.parseInt(sc.next());",
"X",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int N = Integer.parseInt(sc.next());",
"N",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"boolean[] p = new boolean[102];",
"p",
"new boolean[102]",
"102",
"for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n p[Integer.parseInt(sc.next())] = true;\n }",
"{\n p[Integer.parseInt(sc.next())] = true;\n }",
"p[Integer.parseInt(sc.next())] = true",
"p[Integer.parseInt(sc.next())]",
"p",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"true",
"for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 50",
"i",
"50",
"i++",
"i++",
"i",
"{\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }",
"{\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }",
"if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }",
"X - i >= 0 && !p[X - i]",
"X - i >= 0",
"X - i",
"X",
"i",
"0",
"!p[X - i]",
"p[X - i]",
"p",
"X - i",
"X",
"i",
"{\n System.out.println(X - i);\n return;\n }",
"System.out.println(X - i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X - i",
"X",
"i",
"return;",
"if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }",
"X + i <= 101 && !p[X + i]",
"X + i <= 101",
"X + i",
"X",
"i",
"101",
"!p[X + i]",
"p[X + i]",
"p",
"X + i",
"X",
"i",
"{\n System.out.println(X + i);\n return;\n }",
"System.out.println(X + i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X + i",
"X",
"i",
"return;",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int X = Integer.parseInt(sc.next());\n int N = Integer.parseInt(sc.next());\n boolean[] p = new boolean[102];\n\n for (int i = 0; i < N; i++) {\n p[Integer.parseInt(sc.next())] = true;\n }\n for (int i = 0; i <= 50; i++) {\n if (X - i >= 0 && !p[X - i]) {\n System.out.println(X - i);\n return;\n }\n if (X + i <= 101 && !p[X + i]) {\n System.out.println(X + i);\n return;\n }\n }\n }\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
int X = Integer.parseInt(sc.next());
int N = Integer.parseInt(sc.next());
boolean[] p = new boolean[102];
for (int i = 0; i < N; i++) {
p[Integer.parseInt(sc.next())] = true;
}
for (int i = 0; i <= 50; i++) {
if (X - i >= 0 && !p[X - i]) {
System.out.println(X - i);
return;
}
if (X + i <= 101 && !p[X + i]) {
System.out.println(X + i);
return;
}
}
}
}
}
|
[
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,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
11,
1,
41,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
13,
2,
13,
13,
29,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
13,
2,
13,
13,
29,
23,
13,
23,
13,
12,
13,
30,
41,
13,
8,
4,
18,
13,
18,
13,
13,
20,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
4,
13,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
20,
0,
18,
36,
13,
17,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
237,
32
],
[
237,
33
],
[
33,
34
],
[
33,
35
],
[
237,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
49,
50
],
[
49,
51
],
[
38,
53
],
[
53,
54
],
[
53,
55
],
[
38,
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
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
38,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
88,
89
],
[
82,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
100,
107
],
[
91,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
120,
121
],
[
120,
122
],
[
116,
123
],
[
36,
124
],
[
124,
125
],
[
36,
126
],
[
126,
127
],
[
237,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
133,
137
],
[
137,
138
],
[
137,
139
],
[
133,
140
],
[
130,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
130,
146
],
[
146,
147
],
[
146,
148
],
[
130,
149
],
[
149,
150
],
[
149,
151
],
[
130,
152
],
[
152,
153
],
[
152,
154
],
[
152,
155
],
[
130,
156
],
[
156,
157
],
[
157,
158
],
[
128,
159
],
[
159,
160
],
[
237,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
161,
165
],
[
165,
166
],
[
161,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
169,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
167,
180
],
[
180,
181
],
[
161,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
185,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
195,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
184,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
161,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
213,
216
],
[
216,
217
],
[
161,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
222,
225
],
[
225,
226
],
[
161,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
231,
234
],
[
234,
235
],
[
0,
236
],
[
236,
237
],
[
236,
238
]
]
| [
"\nimport java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.HashSet;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n private static final String INPUT_FILE_PATH = \"\";\n\n static void solve(InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int[] p = new int[n];\n HashSet<Integer> s = new HashSet();\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n s.add(p[i]);\n }\n for (int dist = 0; ; dist++) {\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }\n }\n\n private static class InputReader {\n private BufferedReader br;\n private StringTokenizer st;\n\n public InputReader(InputStream inputStream) {\n this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);\n this.st = null;\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n }\n\n public static void main(String[] args) throws Exception {\n InputStream inputStream = INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH));\n OutputStream outputStream = System.out;\n\n InputReader inputReader = new InputReader(inputStream);\n PrintWriter printWriter = new PrintWriter(outputStream);\n\n solve(inputReader, printWriter);\n\n printWriter.close();\n }\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.File;",
"File",
"java.io",
"import java.io.FileInputStream;",
"FileInputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\n private static final String INPUT_FILE_PATH = \"\";\n\n static void solve(InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int[] p = new int[n];\n HashSet<Integer> s = new HashSet();\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n s.add(p[i]);\n }\n for (int dist = 0; ; dist++) {\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }\n }\n\n private static class InputReader {\n private BufferedReader br;\n private StringTokenizer st;\n\n public InputReader(InputStream inputStream) {\n this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);\n this.st = null;\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n }\n\n public static void main(String[] args) throws Exception {\n InputStream inputStream = INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH));\n OutputStream outputStream = System.out;\n\n InputReader inputReader = new InputReader(inputStream);\n PrintWriter printWriter = new PrintWriter(outputStream);\n\n solve(inputReader, printWriter);\n\n printWriter.close();\n }\n\n}",
"Main",
"private static final String INPUT_FILE_PATH = \"\";",
"INPUT_FILE_PATH",
"\"\"",
"static void solve(InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int[] p = new int[n];\n HashSet<Integer> s = new HashSet();\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n s.add(p[i]);\n }\n for (int dist = 0; ; dist++) {\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }\n }",
"solve",
"{\n int x = in.nextInt();\n int n = in.nextInt();\n int[] p = new int[n];\n HashSet<Integer> s = new HashSet();\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n s.add(p[i]);\n }\n for (int dist = 0; ; dist++) {\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }\n }",
"int x = in.nextInt();",
"x",
"in.nextInt()",
"in.nextInt",
"in",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"HashSet<Integer> s = new HashSet();",
"s",
"new HashSet()",
"for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n s.add(p[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i] = in.nextInt();\n s.add(p[i]);\n }",
"{\n p[i] = in.nextInt();\n s.add(p[i]);\n }",
"p[i] = in.nextInt()",
"p[i]",
"p",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"s.add(p[i])",
"s.add",
"s",
"p[i]",
"p",
"i",
"for (int dist = 0; ; dist++) {\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }",
"int dist = 0;",
"int dist = 0;",
"dist",
"0",
"dist++",
"dist++",
"dist",
"{\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }",
"{\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }",
"if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }",
"!s.contains(x - dist)",
"s.contains(x - dist)",
"s.contains",
"s",
"x - dist",
"x",
"dist",
"{\n out.println(x - dist);\n return;\n }",
"out.println(x - dist)",
"out.println",
"out",
"x - dist",
"x",
"dist",
"return;",
"if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }",
"!s.contains(x + dist)",
"s.contains(x + dist)",
"s.contains",
"s",
"x + dist",
"x",
"dist",
"{\n out.println(x + dist);\n return;\n }",
"out.println(x + dist)",
"out.println",
"out",
"x + dist",
"x",
"dist",
"return;",
"InputReader in",
"in",
"PrintWriter out",
"out",
"public static void main(String[] args) throws Exception {\n InputStream inputStream = INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH));\n OutputStream outputStream = System.out;\n\n InputReader inputReader = new InputReader(inputStream);\n PrintWriter printWriter = new PrintWriter(outputStream);\n\n solve(inputReader, printWriter);\n\n printWriter.close();\n }",
"main",
"{\n InputStream inputStream = INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH));\n OutputStream outputStream = System.out;\n\n InputReader inputReader = new InputReader(inputStream);\n PrintWriter printWriter = new PrintWriter(outputStream);\n\n solve(inputReader, printWriter);\n\n printWriter.close();\n }",
"InputStream inputStream = INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH));",
"inputStream",
"INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH))",
"INPUT_FILE_PATH.isEmpty()",
"INPUT_FILE_PATH.isEmpty",
"INPUT_FILE_PATH",
"System.in",
"System",
"System.in",
"new FileInputStream(new File(INPUT_FILE_PATH))",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader inputReader = new InputReader(inputStream);",
"inputReader",
"new InputReader(inputStream)",
"PrintWriter printWriter = new PrintWriter(outputStream);",
"printWriter",
"new PrintWriter(outputStream)",
"solve(inputReader, printWriter)",
"solve",
"inputReader",
"printWriter",
"printWriter.close()",
"printWriter.close",
"printWriter",
"String[] args",
"args",
"private static class InputReader {\n private BufferedReader br;\n private StringTokenizer st;\n\n public InputReader(InputStream inputStream) {\n this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);\n this.st = null;\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n }",
"InputReader",
"private BufferedReader br;",
"br",
"private StringTokenizer st;",
"st",
"public InputReader(InputStream inputStream) {\n this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);\n this.st = null;\n }",
"InputReader",
"{\n this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);\n this.st = null;\n }",
"this.br = new BufferedReader(new InputStreamReader(inputStream), 32768)",
"this.br",
"this",
"this.br",
"new BufferedReader(new InputStreamReader(inputStream), 32768)",
"this.st = null",
"this.st",
"this",
"this.st",
"null",
"InputStream inputStream",
"inputStream",
"public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }",
"nextToken",
"{\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }",
"while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public int nextInt() {\n return Integer.parseInt(nextToken());\n }",
"nextInt",
"{\n return Integer.parseInt(nextToken());\n }",
"return Integer.parseInt(nextToken());",
"Integer.parseInt(nextToken())",
"Integer.parseInt",
"Integer",
"nextToken()",
"nextToken",
"public long nextLong() {\n return Long.parseLong(nextToken());\n }",
"nextLong",
"{\n return Long.parseLong(nextToken());\n }",
"return Long.parseLong(nextToken());",
"Long.parseLong(nextToken())",
"Long.parseLong",
"Long",
"nextToken()",
"nextToken",
"public double nextDouble() {\n return Double.parseDouble(nextToken());\n }",
"nextDouble",
"{\n return Double.parseDouble(nextToken());\n }",
"return Double.parseDouble(nextToken());",
"Double.parseDouble(nextToken())",
"Double.parseDouble",
"Double",
"nextToken()",
"nextToken",
"public class Main {\n\n private static final String INPUT_FILE_PATH = \"\";\n\n static void solve(InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int[] p = new int[n];\n HashSet<Integer> s = new HashSet();\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n s.add(p[i]);\n }\n for (int dist = 0; ; dist++) {\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }\n }\n\n private static class InputReader {\n private BufferedReader br;\n private StringTokenizer st;\n\n public InputReader(InputStream inputStream) {\n this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);\n this.st = null;\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n }\n\n public static void main(String[] args) throws Exception {\n InputStream inputStream = INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH));\n OutputStream outputStream = System.out;\n\n InputReader inputReader = new InputReader(inputStream);\n PrintWriter printWriter = new PrintWriter(outputStream);\n\n solve(inputReader, printWriter);\n\n printWriter.close();\n }\n\n}",
"public class Main {\n\n private static final String INPUT_FILE_PATH = \"\";\n\n static void solve(InputReader in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n int[] p = new int[n];\n HashSet<Integer> s = new HashSet();\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n s.add(p[i]);\n }\n for (int dist = 0; ; dist++) {\n if (!s.contains(x - dist)) {\n out.println(x - dist);\n return;\n }\n if (!s.contains(x + dist)) {\n out.println(x + dist);\n return;\n }\n }\n }\n\n private static class InputReader {\n private BufferedReader br;\n private StringTokenizer st;\n\n public InputReader(InputStream inputStream) {\n this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);\n this.st = null;\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n }\n\n public static void main(String[] args) throws Exception {\n InputStream inputStream = INPUT_FILE_PATH.isEmpty()\n ? System.in\n : new FileInputStream(new File(INPUT_FILE_PATH));\n OutputStream outputStream = System.out;\n\n InputReader inputReader = new InputReader(inputStream);\n PrintWriter printWriter = new PrintWriter(outputStream);\n\n solve(inputReader, printWriter);\n\n printWriter.close();\n }\n\n}",
"Main"
]
|
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
public class Main {
private static final String INPUT_FILE_PATH = "";
static void solve(InputReader in, PrintWriter out) {
int x = in.nextInt();
int n = in.nextInt();
int[] p = new int[n];
HashSet<Integer> s = new HashSet();
for (int i = 0; i < n; i++) {
p[i] = in.nextInt();
s.add(p[i]);
}
for (int dist = 0; ; dist++) {
if (!s.contains(x - dist)) {
out.println(x - dist);
return;
}
if (!s.contains(x + dist)) {
out.println(x + dist);
return;
}
}
}
private static class InputReader {
private BufferedReader br;
private StringTokenizer st;
public InputReader(InputStream inputStream) {
this.br = new BufferedReader(new InputStreamReader(inputStream), 32768);
this.st = null;
}
public String nextToken() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(nextToken());
}
public long nextLong() {
return Long.parseLong(nextToken());
}
public double nextDouble() {
return Double.parseDouble(nextToken());
}
}
public static void main(String[] args) throws Exception {
InputStream inputStream = INPUT_FILE_PATH.isEmpty()
? System.in
: new FileInputStream(new File(INPUT_FILE_PATH));
OutputStream outputStream = System.out;
InputReader inputReader = new InputReader(inputStream);
PrintWriter printWriter = new PrintWriter(outputStream);
solve(inputReader, printWriter);
printWriter.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
17,
14,
40,
13,
30,
0,
13,
2,
13,
13,
3,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
0,
13,
17,
14,
40,
13,
30,
0,
13,
2,
13,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
147,
5
],
[
147,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
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
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
61,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
61,
100
],
[
100,
101
],
[
100,
102
],
[
61,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
108,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
103,
114
],
[
115,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
61,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
8,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
6,
144
],
[
144,
145
],
[
0,
146
],
[
146,
147
],
[
146,
148
]
]
| [
"import java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] pArray = new int[n];\n int answer = 0;\n\n for (int i = 0; i < n; i++) {\n pArray[i] = sc.nextInt();\n }\n\n for (int i = 0; i < 100; i++) {\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }\n\n System.out.println(answer);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] pArray = new int[n];\n int answer = 0;\n\n for (int i = 0; i < n; i++) {\n pArray[i] = sc.nextInt();\n }\n\n for (int i = 0; i < 100; i++) {\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }\n\n System.out.println(answer);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] pArray = new int[n];\n int answer = 0;\n\n for (int i = 0; i < n; i++) {\n pArray[i] = sc.nextInt();\n }\n\n for (int i = 0; i < 100; i++) {\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }\n\n System.out.println(answer);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] pArray = new int[n];\n int answer = 0;\n\n for (int i = 0; i < n; i++) {\n pArray[i] = sc.nextInt();\n }\n\n for (int i = 0; i < 100; i++) {\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }\n\n System.out.println(answer);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] pArray = new int[n];",
"pArray",
"new int[n]",
"n",
"int answer = 0;",
"answer",
"0",
"for (int i = 0; i < n; i++) {\n pArray[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n pArray[i] = sc.nextInt();\n }",
"{\n pArray[i] = sc.nextInt();\n }",
"pArray[i] = sc.nextInt()",
"pArray[i]",
"pArray",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < 100; i++) {\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }",
"{\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }",
"boolean existFlag = false;",
"existFlag",
"false",
"for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }",
"{\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }",
"if (pArray[j] == x - i) {\n existFlag = true;\n }",
"pArray[j] == x - i",
"pArray[j]",
"pArray",
"j",
"x - i",
"x",
"i",
"{\n existFlag = true;\n }",
"existFlag = true",
"existFlag",
"true",
"if (!existFlag) {\n answer = x - i;\n break;\n }",
"!existFlag",
"existFlag",
"{\n answer = x - i;\n break;\n }",
"answer = x - i",
"answer",
"x - i",
"x",
"i",
"break;",
"boolean existFlag2 = false;",
"existFlag2",
"false",
"for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }",
"{\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }",
"if (pArray[j] == x + i) {\n existFlag2 = true;\n }",
"pArray[j] == x + i",
"pArray[j]",
"pArray",
"j",
"x + i",
"x",
"i",
"{\n existFlag2 = true;\n }",
"existFlag2 = true",
"existFlag2",
"true",
"if (!existFlag2) {\n answer = x + i;\n break;\n }",
"!existFlag2",
"existFlag2",
"{\n answer = x + i;\n break;\n }",
"answer = x + i",
"answer",
"x + i",
"x",
"i",
"break;",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] pArray = new int[n];\n int answer = 0;\n\n for (int i = 0; i < n; i++) {\n pArray[i] = sc.nextInt();\n }\n\n for (int i = 0; i < 100; i++) {\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }\n\n System.out.println(answer);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] pArray = new int[n];\n int answer = 0;\n\n for (int i = 0; i < n; i++) {\n pArray[i] = sc.nextInt();\n }\n\n for (int i = 0; i < 100; i++) {\n // x ± iがpArrayの中に存在しなかったらそれを答えとする\n boolean existFlag = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x - i) {\n existFlag = true;\n }\n }\n if (!existFlag) {\n answer = x - i;\n break;\n }\n boolean existFlag2 = false;\n for (int j = 0; j < n; j++) {\n if (pArray[j] == x + i) {\n existFlag2 = true;\n }\n }\n if (!existFlag2) {\n answer = x + i;\n break;\n }\n }\n\n System.out.println(answer);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int[] pArray = new int[n];
int answer = 0;
for (int i = 0; i < n; i++) {
pArray[i] = sc.nextInt();
}
for (int i = 0; i < 100; i++) {
// x ± iがpArrayの中に存在しなかったらそれを答えとする
boolean existFlag = false;
for (int j = 0; j < n; j++) {
if (pArray[j] == x - i) {
existFlag = true;
}
}
if (!existFlag) {
answer = x - i;
break;
}
boolean existFlag2 = false;
for (int j = 0; j < n; j++) {
if (pArray[j] == x + i) {
existFlag2 = true;
}
}
if (!existFlag2) {
answer = x + i;
break;
}
}
System.out.println(answer);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
42,
17,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
40,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
97,
8
],
[
97,
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
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
11,
47
],
[
47,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
11,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
64,
73
],
[
55,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
82,
91
],
[
55,
92
],
[
92,
93
],
[
9,
94
],
[
94,
95
],
[
0,
96
],
[
96,
97
],
[
96,
98
]
]
| [
"\n\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner=new Scanner(System.in);\n\n\n\t\tint x =scanner.nextInt();\n\t\tint n =scanner.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tlist.add(scanner.nextInt());\n\t\t}\n\t\tscanner.close();\n\n\t\tint d = 0;\n\t\twhile(true) {\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}\n\n\t}\n\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner=new Scanner(System.in);\n\n\n\t\tint x =scanner.nextInt();\n\t\tint n =scanner.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tlist.add(scanner.nextInt());\n\t\t}\n\t\tscanner.close();\n\n\t\tint d = 0;\n\t\twhile(true) {\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner scanner=new Scanner(System.in);\n\n\n\t\tint x =scanner.nextInt();\n\t\tint n =scanner.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tlist.add(scanner.nextInt());\n\t\t}\n\t\tscanner.close();\n\n\t\tint d = 0;\n\t\twhile(true) {\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}\n\n\t}",
"main",
"{\n\n\t\tScanner scanner=new Scanner(System.in);\n\n\n\t\tint x =scanner.nextInt();\n\t\tint n =scanner.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tlist.add(scanner.nextInt());\n\t\t}\n\t\tscanner.close();\n\n\t\tint d = 0;\n\t\twhile(true) {\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}\n\n\t}",
"Scanner scanner=new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int x =scanner.nextInt();",
"x",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int n =scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"ArrayList<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"for(int i=0 ; i<n ; i++) {\n\t\t\tlist.add(scanner.nextInt());\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlist.add(scanner.nextInt());\n\t\t}",
"{\n\t\t\tlist.add(scanner.nextInt());\n\t\t}",
"list.add(scanner.nextInt())",
"list.add",
"list",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"scanner.close()",
"scanner.close",
"scanner",
"int d = 0;",
"d",
"0",
"while(true) {\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}",
"true",
"{\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}",
"if(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x-d)",
"list.contains(x-d)",
"list.contains",
"list",
"x-d",
"x",
"d",
"{\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x-d)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-d",
"x",
"d",
"break;",
"if(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x+d)",
"list.contains(x+d)",
"list.contains",
"list",
"x+d",
"x",
"d",
"{\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x+d)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+d",
"x",
"d",
"break;",
"d++",
"d",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner=new Scanner(System.in);\n\n\n\t\tint x =scanner.nextInt();\n\t\tint n =scanner.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tlist.add(scanner.nextInt());\n\t\t}\n\t\tscanner.close();\n\n\t\tint d = 0;\n\t\twhile(true) {\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner=new Scanner(System.in);\n\n\n\t\tint x =scanner.nextInt();\n\t\tint n =scanner.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0 ; i<n ; i++) {\n\t\t\tlist.add(scanner.nextInt());\n\t\t}\n\t\tscanner.close();\n\n\t\tint d = 0;\n\t\twhile(true) {\n\t\t\tif(!list.contains(x-d)) {\n\t\t\t\tSystem.out.println(x-d);;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(!list.contains(x+d)) {\n\t\t\t\tSystem.out.println(x+d);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\td++;\n\t\t}\n\n\t}\n\n}",
"Main"
]
|
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int x =scanner.nextInt();
int n =scanner.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i=0 ; i<n ; i++) {
list.add(scanner.nextInt());
}
scanner.close();
int d = 0;
while(true) {
if(!list.contains(x-d)) {
System.out.println(x-d);;
break;
}
if(!list.contains(x+d)) {
System.out.println(x+d);
break;
}
d++;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
14,
40,
4,
18,
13,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
29,
41,
13,
20,
42,
4,
18,
13,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
42,
17,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
2,
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
],
[
117,
8
],
[
117,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
23,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
28,
35
],
[
11,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
11,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
45,
55
],
[
11,
56
],
[
56,
57
],
[
56,
58
],
[
11,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
68,
69
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
75,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
99,
105
],
[
75,
106
],
[
106,
107
],
[
11,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
9,
114
],
[
114,
115
],
[
0,
116
],
[
116,
117
],
[
116,
118
]
]
| [
"import java.util.*;\nimport java.lang.Integer; \n\npublic class Main {\n public static void main(String[] args){\n \n int answer = 0; // 返却値\n // 入力\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(!sc.hasNext()){\n System.out.println(answer);\n return;\n }\n int n = sc.nextInt();\n \n // nが0のとき\n if(n == 0){\n answer = x;\n System.out.println(answer);\n return;\n }\n \n // 入力値の読み込み\n Set<Integer> pSet = new HashSet<Integer>();\n while(sc.hasNext()){\n pSet.add(sc.nextInt());\n }\n \n // 数字を検索する\n int a = 0;\n while(true){\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }\n // 出力\n System.out.println(answer);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.Integer;",
"Integer",
"java.lang",
"public class Main {\n public static void main(String[] args){\n \n int answer = 0; // 返却値\n // 入力\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(!sc.hasNext()){\n System.out.println(answer);\n return;\n }\n int n = sc.nextInt();\n \n // nが0のとき\n if(n == 0){\n answer = x;\n System.out.println(answer);\n return;\n }\n \n // 入力値の読み込み\n Set<Integer> pSet = new HashSet<Integer>();\n while(sc.hasNext()){\n pSet.add(sc.nextInt());\n }\n \n // 数字を検索する\n int a = 0;\n while(true){\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }\n // 出力\n System.out.println(answer);\n }\n}",
"Main",
"public static void main(String[] args){\n \n int answer = 0; // 返却値\n // 入力\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(!sc.hasNext()){\n System.out.println(answer);\n return;\n }\n int n = sc.nextInt();\n \n // nが0のとき\n if(n == 0){\n answer = x;\n System.out.println(answer);\n return;\n }\n \n // 入力値の読み込み\n Set<Integer> pSet = new HashSet<Integer>();\n while(sc.hasNext()){\n pSet.add(sc.nextInt());\n }\n \n // 数字を検索する\n int a = 0;\n while(true){\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }\n // 出力\n System.out.println(answer);\n }",
"main",
"{\n \n int answer = 0; // 返却値\n // 入力\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(!sc.hasNext()){\n System.out.println(answer);\n return;\n }\n int n = sc.nextInt();\n \n // nが0のとき\n if(n == 0){\n answer = x;\n System.out.println(answer);\n return;\n }\n \n // 入力値の読み込み\n Set<Integer> pSet = new HashSet<Integer>();\n while(sc.hasNext()){\n pSet.add(sc.nextInt());\n }\n \n // 数字を検索する\n int a = 0;\n while(true){\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }\n // 出力\n System.out.println(answer);\n }",
"int answer = 0;",
"answer",
"0",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(!sc.hasNext()){\n System.out.println(answer);\n return;\n }",
"!sc.hasNext()",
"sc.hasNext()",
"sc.hasNext",
"sc",
"{\n System.out.println(answer);\n return;\n }",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"return;",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n == 0){\n answer = x;\n System.out.println(answer);\n return;\n }",
"n == 0",
"n",
"0",
"{\n answer = x;\n System.out.println(answer);\n return;\n }",
"answer = x",
"answer",
"x",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"return;",
"Set<Integer> pSet = new HashSet<Integer>();",
"pSet",
"new HashSet<Integer>()",
"while(sc.hasNext()){\n pSet.add(sc.nextInt());\n }",
"sc.hasNext()",
"sc.hasNext",
"sc",
"{\n pSet.add(sc.nextInt());\n }",
"pSet.add(sc.nextInt())",
"pSet.add",
"pSet",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a = 0;",
"a",
"0",
"while(true){\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }",
"true",
"{\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }",
"if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }",
"!pSet.contains(x - a)",
"pSet.contains(x - a)",
"pSet.contains",
"pSet",
"x - a",
"x",
"a",
"{\n answer = x - a;\n break;\n }",
"answer = x - a",
"answer",
"x - a",
"x",
"a",
"break;",
"if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }",
"!pSet.contains(x + a)",
"pSet.contains(x + a)",
"pSet.contains",
"pSet",
"x + a",
"x",
"a",
"{\n answer = x + a;\n break;\n }",
"answer = x + a",
"answer",
"x + a",
"x",
"a",
"break;",
"a++",
"a",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n \n int answer = 0; // 返却値\n // 入力\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(!sc.hasNext()){\n System.out.println(answer);\n return;\n }\n int n = sc.nextInt();\n \n // nが0のとき\n if(n == 0){\n answer = x;\n System.out.println(answer);\n return;\n }\n \n // 入力値の読み込み\n Set<Integer> pSet = new HashSet<Integer>();\n while(sc.hasNext()){\n pSet.add(sc.nextInt());\n }\n \n // 数字を検索する\n int a = 0;\n while(true){\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }\n // 出力\n System.out.println(answer);\n }\n}",
"public class Main {\n public static void main(String[] args){\n \n int answer = 0; // 返却値\n // 入力\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(!sc.hasNext()){\n System.out.println(answer);\n return;\n }\n int n = sc.nextInt();\n \n // nが0のとき\n if(n == 0){\n answer = x;\n System.out.println(answer);\n return;\n }\n \n // 入力値の読み込み\n Set<Integer> pSet = new HashSet<Integer>();\n while(sc.hasNext()){\n pSet.add(sc.nextInt());\n }\n \n // 数字を検索する\n int a = 0;\n while(true){\n if(!pSet.contains(x - a)){\n answer = x - a;\n break;\n }\n if(!pSet.contains(x + a)){\n answer = x + a;\n break;\n }\n a++;\n }\n // 出力\n System.out.println(answer);\n }\n}",
"Main"
]
| import java.util.*;
import java.lang.Integer;
public class Main {
public static void main(String[] args){
int answer = 0; // 返却値
// 入力
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
if(!sc.hasNext()){
System.out.println(answer);
return;
}
int n = sc.nextInt();
// nが0のとき
if(n == 0){
answer = x;
System.out.println(answer);
return;
}
// 入力値の読み込み
Set<Integer> pSet = new HashSet<Integer>();
while(sc.hasNext()){
pSet.add(sc.nextInt());
}
// 数字を検索する
int a = 0;
while(true){
if(!pSet.contains(x - a)){
answer = x - a;
break;
}
if(!pSet.contains(x + a)){
answer = x + a;
break;
}
a++;
}
// 出力
System.out.println(answer);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
20,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
2,
13,
13,
41,
13,
20,
28,
13,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
2,
4,
18,
13,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
153,
11
],
[
153,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
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
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
14,
53
],
[
53,
54
],
[
53,
55
],
[
14,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
56,
62
],
[
62,
63
],
[
62,
64
],
[
56,
65
],
[
65,
66
],
[
66,
67
],
[
56,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
73,
75
],
[
14,
76
],
[
76,
77
],
[
76,
78
],
[
14,
79
],
[
79,
80
],
[
79,
81
],
[
79,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
14,
95
],
[
95,
96
],
[
95,
97
],
[
14,
98
],
[
98,
99
],
[
98,
100
],
[
14,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
104,
114
],
[
114,
115
],
[
115,
116
],
[
104,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
124,
129
],
[
118,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
14,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
12,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n//\t\tint[] nums = new int[N];\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tfor (int i=0; i<N; i++) {\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}\n\n//\t\tint[] num_range = new int[110];\n\t\tList<Integer> range = new ArrayList<Integer>();\n\t\tfor (int k=-50; k<51; k++) {\n\t\t\trange.add(X+k);\n\t\t}\n\n\t\tList<Integer> answer = new ArrayList<Integer>();\n\n\t\tfor (int a : range) {\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}\n\n\t\tint min_abs=0;\n\t\tint before_min_abs = 51;\n\t\tint ans_num=0;\n\t\tfor (int i=0; i<answer.size(); i++) {\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans_num);\n\n\n\t}\n\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n//\t\tint[] nums = new int[N];\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tfor (int i=0; i<N; i++) {\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}\n\n//\t\tint[] num_range = new int[110];\n\t\tList<Integer> range = new ArrayList<Integer>();\n\t\tfor (int k=-50; k<51; k++) {\n\t\t\trange.add(X+k);\n\t\t}\n\n\t\tList<Integer> answer = new ArrayList<Integer>();\n\n\t\tfor (int a : range) {\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}\n\n\t\tint min_abs=0;\n\t\tint before_min_abs = 51;\n\t\tint ans_num=0;\n\t\tfor (int i=0; i<answer.size(); i++) {\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans_num);\n\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n//\t\tint[] nums = new int[N];\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tfor (int i=0; i<N; i++) {\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}\n\n//\t\tint[] num_range = new int[110];\n\t\tList<Integer> range = new ArrayList<Integer>();\n\t\tfor (int k=-50; k<51; k++) {\n\t\t\trange.add(X+k);\n\t\t}\n\n\t\tList<Integer> answer = new ArrayList<Integer>();\n\n\t\tfor (int a : range) {\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}\n\n\t\tint min_abs=0;\n\t\tint before_min_abs = 51;\n\t\tint ans_num=0;\n\t\tfor (int i=0; i<answer.size(); i++) {\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans_num);\n\n\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n//\t\tint[] nums = new int[N];\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tfor (int i=0; i<N; i++) {\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}\n\n//\t\tint[] num_range = new int[110];\n\t\tList<Integer> range = new ArrayList<Integer>();\n\t\tfor (int k=-50; k<51; k++) {\n\t\t\trange.add(X+k);\n\t\t}\n\n\t\tList<Integer> answer = new ArrayList<Integer>();\n\n\t\tfor (int a : range) {\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}\n\n\t\tint min_abs=0;\n\t\tint before_min_abs = 51;\n\t\tint ans_num=0;\n\t\tfor (int i=0; i<answer.size(); i++) {\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans_num);\n\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer> nums = new ArrayList<Integer>();",
"nums",
"new ArrayList<Integer>()",
"for (int i=0; i<N; i++) {\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}",
"{\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}",
"int c = sc.nextInt();",
"c",
"sc.nextInt()",
"sc.nextInt",
"sc",
"nums.add(c)",
"nums.add",
"nums",
"c",
"List<Integer> range = new ArrayList<Integer>();",
"range",
"new ArrayList<Integer>()",
"for (int k=-50; k<51; k++) {\n\t\t\trange.add(X+k);\n\t\t}",
"int k=-50;",
"int k=-50;",
"k",
"-50",
"50",
"k<51",
"k",
"51",
"k++",
"k++",
"k",
"{\n\t\t\trange.add(X+k);\n\t\t}",
"{\n\t\t\trange.add(X+k);\n\t\t}",
"range.add(X+k)",
"range.add",
"range",
"X+k",
"X",
"k",
"List<Integer> answer = new ArrayList<Integer>();",
"answer",
"new ArrayList<Integer>()",
"for (int a : range) {\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}",
"int a",
"range",
"{\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}",
"if (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}",
"!(nums.contains(a))",
"(nums.contains(a))",
"nums.contains",
"nums",
"a",
"{\n\t\t\t\tanswer.add(a);\n\t\t\t}",
"answer.add(a)",
"answer.add",
"answer",
"a",
"int min_abs=0;",
"min_abs",
"0",
"int before_min_abs = 51;",
"before_min_abs",
"51",
"int ans_num=0;",
"ans_num",
"0",
"for (int i=0; i<answer.size(); i++) {\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<answer.size()",
"i",
"answer.size()",
"answer.size",
"answer",
"i++",
"i++",
"i",
"{\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}",
"{\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}",
"min_abs = Math.abs(answer.get(i) - X)",
"min_abs",
"Math.abs(answer.get(i) - X)",
"Math.abs",
"Math",
"answer.get(i) - X",
"answer.get(i)",
"answer.get",
"answer",
"i",
"X",
"if (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}",
"min_abs<before_min_abs",
"min_abs",
"before_min_abs",
"{\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}",
"before_min_abs = min_abs",
"before_min_abs",
"min_abs",
"ans_num=answer.get(i)",
"ans_num",
"answer.get(i)",
"answer.get",
"answer",
"i",
"System.out.println(ans_num)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans_num",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n//\t\tint[] nums = new int[N];\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tfor (int i=0; i<N; i++) {\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}\n\n//\t\tint[] num_range = new int[110];\n\t\tList<Integer> range = new ArrayList<Integer>();\n\t\tfor (int k=-50; k<51; k++) {\n\t\t\trange.add(X+k);\n\t\t}\n\n\t\tList<Integer> answer = new ArrayList<Integer>();\n\n\t\tfor (int a : range) {\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}\n\n\t\tint min_abs=0;\n\t\tint before_min_abs = 51;\n\t\tint ans_num=0;\n\t\tfor (int i=0; i<answer.size(); i++) {\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans_num);\n\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n//\t\tint[] nums = new int[N];\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tfor (int i=0; i<N; i++) {\n\t\t\tint c = sc.nextInt();\n\t\t\tnums.add(c);\n\t\t}\n\n//\t\tint[] num_range = new int[110];\n\t\tList<Integer> range = new ArrayList<Integer>();\n\t\tfor (int k=-50; k<51; k++) {\n\t\t\trange.add(X+k);\n\t\t}\n\n\t\tList<Integer> answer = new ArrayList<Integer>();\n\n\t\tfor (int a : range) {\n\t\t\tif (!(nums.contains(a))) {\n\t\t\t\tanswer.add(a);\n\t\t\t}\n\t\t}\n\n\t\tint min_abs=0;\n\t\tint before_min_abs = 51;\n\t\tint ans_num=0;\n\t\tfor (int i=0; i<answer.size(); i++) {\n\t\t\tmin_abs = Math.abs(answer.get(i) - X);\n\t\t\tif (min_abs<before_min_abs) {\n\t\t\t\tbefore_min_abs = min_abs;\n\t\t\t\tans_num=answer.get(i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans_num);\n\n\n\t}\n\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
// int[] nums = new int[N];
List<Integer> nums = new ArrayList<Integer>();
for (int i=0; i<N; i++) {
int c = sc.nextInt();
nums.add(c);
}
// int[] num_range = new int[110];
List<Integer> range = new ArrayList<Integer>();
for (int k=-50; k<51; k++) {
range.add(X+k);
}
List<Integer> answer = new ArrayList<Integer>();
for (int a : range) {
if (!(nums.contains(a))) {
answer.add(a);
}
}
int min_abs=0;
int before_min_abs = 51;
int ans_num=0;
for (int i=0; i<answer.size(); i++) {
min_abs = Math.abs(answer.get(i) - X);
if (min_abs<before_min_abs) {
before_min_abs = min_abs;
ans_num=answer.get(i);
}
}
System.out.println(ans_num);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
18,
13,
18,
13,
13,
40,
17,
41,
13,
17,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
40,
17,
30,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
13,
0,
13,
4,
18,
13,
2,
13,
13,
4,
18,
18,
13,
13,
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
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
30,
40
],
[
40,
41
],
[
41,
42
],
[
30,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
8,
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
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
72,
78
],
[
78,
79
],
[
8,
80
],
[
80,
81
],
[
80,
82
],
[
8,
83
],
[
83,
84
],
[
83,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
8,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
99,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
94,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
107,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
120,
121
],
[
120,
122
],
[
116,
123
],
[
115,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
133,
134
],
[
133,
135
],
[
8,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
6,
142
],
[
142,
143
],
[
0,
144
],
[
144,
145
],
[
144,
146
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint[] d = new int[102];\n\t\tfor(int i=0; i<d.length; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor(int i=0; i<array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}\n\n\t\tint min = 9999;\n\t\tint result = 0;\n\n\t\tif(n == 0) {\n\t\t\t result = x;\n\t\t}\n\t\tfor(int i=0; i<102; i++) {\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint[] d = new int[102];\n\t\tfor(int i=0; i<d.length; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor(int i=0; i<array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}\n\n\t\tint min = 9999;\n\t\tint result = 0;\n\n\t\tif(n == 0) {\n\t\t\t result = x;\n\t\t}\n\t\tfor(int i=0; i<102; i++) {\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint[] d = new int[102];\n\t\tfor(int i=0; i<d.length; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor(int i=0; i<array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}\n\n\t\tint min = 9999;\n\t\tint result = 0;\n\n\t\tif(n == 0) {\n\t\t\t result = x;\n\t\t}\n\t\tfor(int i=0; i<102; i++) {\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint[] d = new int[102];\n\t\tfor(int i=0; i<d.length; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor(int i=0; i<array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}\n\n\t\tint min = 9999;\n\t\tint result = 0;\n\n\t\tif(n == 0) {\n\t\t\t result = x;\n\t\t}\n\t\tfor(int i=0; i<102; i++) {\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"int[] d = new int[102];",
"d",
"new int[102]",
"102",
"for(int i=0; i<d.length; i++) {\n\t\t\td[i] = i;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<d.length",
"i",
"d.length",
"d",
"d.length",
"i++",
"i++",
"i",
"{\n\t\t\td[i] = i;\n\t\t}",
"{\n\t\t\td[i] = i;\n\t\t}",
"d[i] = i",
"d[i]",
"d",
"i",
"i",
"for(int i=0; i<array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\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\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}",
"{\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"d[array[i]] = -1",
"d[array[i]]",
"d",
"array[i]",
"array",
"i",
"-1",
"1",
"int min = 9999;",
"min",
"9999",
"int result = 0;",
"result",
"0",
"if(n == 0) {\n\t\t\t result = x;\n\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\t result = x;\n\t\t}",
"result = x",
"result",
"x",
"for(int i=0; i<102; i++) {\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<102",
"i",
"102",
"i++",
"i++",
"i",
"{\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"if(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}",
"d[i] != -1",
"d[i]",
"d",
"i",
"-1",
"1",
"{\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}",
"if(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}",
"Math.abs(x - i) < min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"min",
"{\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}",
"result = i",
"result",
"i",
"min = Math.abs(x - i)",
"min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"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) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint[] d = new int[102];\n\t\tfor(int i=0; i<d.length; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor(int i=0; i<array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}\n\n\t\tint min = 9999;\n\t\tint result = 0;\n\n\t\tif(n == 0) {\n\t\t\t result = x;\n\t\t}\n\t\tfor(int i=0; i<102; i++) {\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint[] d = new int[102];\n\t\tfor(int i=0; i<d.length; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor(int i=0; i<array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t\td[array[i]] = -1;\n\t\t}\n\n\t\tint min = 9999;\n\t\tint result = 0;\n\n\t\tif(n == 0) {\n\t\t\t result = x;\n\t\t}\n\t\tfor(int i=0; i<102; i++) {\n\t\t\tif(d[i] != -1) {\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tresult = i;\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int[] array = new int[n];
int[] d = new int[102];
for(int i=0; i<d.length; i++) {
d[i] = i;
}
for(int i=0; i<array.length; i++) {
array[i] = sc.nextInt();
d[array[i]] = -1;
}
int min = 9999;
int result = 0;
if(n == 0) {
result = x;
}
for(int i=0; i<102; i++) {
if(d[i] != -1) {
if(Math.abs(x - i) < min) {
result = i;
min = Math.abs(x - i);
}
}
}
System.out.println(result);
}
}
|
[
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,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
42,
17,
30,
14,
2,
4,
18,
13,
4,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
2,
4,
18,
13,
4,
18,
13,
2,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
40,
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
],
[
105,
11
],
[
105,
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
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
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
14,
50
],
[
50,
51
],
[
50,
52
],
[
14,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
56,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
68,
77
],
[
56,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
79,
89
],
[
78,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
90,
99
],
[
55,
100
],
[
100,
101
],
[
12,
102
],
[
102,
103
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
]
| [
"import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tint distance = 0;\n\t\twhile(true) {\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}\n\t}\n}",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tint distance = 0;\n\t\twhile(true) {\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tint distance = 0;\n\t\twhile(true) {\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tint distance = 0;\n\t\twhile(true) {\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Set<Integer> p = new HashSet<>();",
"p",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int distance = 0;",
"distance",
"0",
"while(true) {\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}",
"true",
"{\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}",
"if(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}",
"p.contains(Integer.valueOf(x - distance)) == false",
"p.contains(Integer.valueOf(x - distance))",
"p.contains",
"p",
"Integer.valueOf(x - distance)",
"Integer.valueOf",
"Integer",
"x - distance",
"x",
"distance",
"false",
"{\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x - distance)",
"System.out.println",
"System.out",
"System",
"System.out",
"x - distance",
"x",
"distance",
"break;",
"if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}",
"p.contains(Integer.valueOf(x + distance)) == false",
"p.contains(Integer.valueOf(x + distance))",
"p.contains",
"p",
"Integer.valueOf(x + distance)",
"Integer.valueOf",
"Integer",
"x + distance",
"x",
"distance",
"false",
"{\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x + distance)",
"System.out.println",
"System.out",
"System",
"System.out",
"x + distance",
"x",
"distance",
"break;",
"distance++",
"distance",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tint distance = 0;\n\t\twhile(true) {\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSet<Integer> p = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\t\t\n\t\tint distance = 0;\n\t\twhile(true) {\n\t\t\tif(p.contains(Integer.valueOf(x - distance)) == false) {\n\t\t\t\tSystem.out.println(x - distance);\n\t\t\t\tbreak;\n\t\t\t} else if(p.contains(Integer.valueOf(x + distance)) == false) {\n\t\t\t\tSystem.out.println(x + distance);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdistance++;\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
Set<Integer> p = new HashSet<>();
for (int i = 0; i < n; i++) {
p.add(sc.nextInt());
}
int distance = 0;
while(true) {
if(p.contains(Integer.valueOf(x - distance)) == false) {
System.out.println(x - distance);
break;
} else if(p.contains(Integer.valueOf(x + distance)) == false) {
System.out.println(x + distance);
break;
}
distance++;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
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,
0,
18,
13,
18,
13,
13,
17,
41,
13,
17,
41,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
13,
0,
13,
4,
18,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
113,
5
],
[
113,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
50,
56
],
[
8,
57
],
[
57,
58
],
[
57,
59
],
[
8,
60
],
[
60,
61
],
[
60,
62
],
[
8,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
63,
74
],
[
75,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
76,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
88,
89
],
[
88,
90
],
[
84,
91
],
[
83,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
6,
110
],
[
110,
111
],
[
0,
112
],
[
112,
113
],
[
112,
114
]
]
| [
"import java.util.Scanner;\n\n/**\n * Main\n */\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] q = new int[102];\n for(int i=0; i<N; i++){\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }\n int minDif = 1000;\n int ans = X;\n for(int i = 0; i<=101; i++){\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }\n System.out.println(ans);\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\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] q = new int[102];\n for(int i=0; i<N; i++){\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }\n int minDif = 1000;\n int ans = X;\n for(int i = 0; i<=101; i++){\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] q = new int[102];\n for(int i=0; i<N; i++){\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }\n int minDif = 1000;\n int ans = X;\n for(int i = 0; i<=101; i++){\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] q = new int[102];\n for(int i=0; i<N; i++){\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }\n int minDif = 1000;\n int ans = X;\n for(int i = 0; i<=101; i++){\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] p = new int[N];",
"p",
"new int[N]",
"N",
"int[] q = new int[102];",
"q",
"new int[102]",
"102",
"for(int i=0; i<N; i++){\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }",
"{\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q[p[i]] = 1",
"q[p[i]]",
"q",
"p[i]",
"p",
"i",
"1",
"int minDif = 1000;",
"minDif",
"1000",
"int ans = X;",
"ans",
"X",
"for(int i = 0; i<=101; i++){\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }",
"{\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }",
"if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }",
"q[i] == 0",
"q[i]",
"q",
"i",
"0",
"{\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }",
"if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }",
"Math.abs(X-i) < minDif",
"Math.abs(X-i)",
"Math.abs",
"Math",
"X-i",
"X",
"i",
"minDif",
"{\n ans = i;\n minDif = Math.abs(X-i);\n }",
"ans = i",
"ans",
"i",
"minDif = Math.abs(X-i)",
"minDif",
"Math.abs(X-i)",
"Math.abs",
"Math",
"X-i",
"X",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] q = new int[102];\n for(int i=0; i<N; i++){\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }\n int minDif = 1000;\n int ans = X;\n for(int i = 0; i<=101; i++){\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n int[] q = new int[102];\n for(int i=0; i<N; i++){\n p[i] = sc.nextInt();\n q[p[i]] = 1; \n }\n int minDif = 1000;\n int ans = X;\n for(int i = 0; i<=101; i++){\n if(q[i] == 0){\n if(Math.abs(X-i) < minDif){\n ans = i;\n minDif = Math.abs(X-i);\n }\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.Scanner;
/**
* Main
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
int[] p = new int[N];
int[] q = new int[102];
for(int i=0; i<N; i++){
p[i] = sc.nextInt();
q[p[i]] = 1;
}
int minDif = 1000;
int ans = X;
for(int i = 0; i<=101; i++){
if(q[i] == 0){
if(Math.abs(X-i) < minDif){
ans = i;
minDif = Math.abs(X-i);
}
}
}
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,
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,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
62,
5
],
[
62,
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
],
[
22,
25
],
[
25,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
6,
59
],
[
59,
60
],
[
0,
61
],
[
61,
62
],
[
61,
63
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args){\n\n Scanner scan = new Scanner( System.in );\n\n int x = Integer.parseInt( scan.next() );\n int n = Integer.parseInt( scan.next() );\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++){\n p[i] = Integer.parseInt( scan.next() );\n }\n\n Arrays.sort(p);\n\n Roop:\n for(int i=0; i<Integer.MAX_VALUE; i++){\n boolean flag = true;\n for(int j=0; j<n; j++){\n if(x-i == p[j]){\n flag = false;\n break;\n }\n }\n if(flag){\n System.out.println(x-i);\n break Roop;\n }\n for(int j=0; j<n; j++){\n if(x+i == p[j]){\n continue Roop;\n }\n }\n System.out.println(x+i);\n break Roop;\n }\n \n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args){\n\n Scanner scan = new Scanner( System.in );\n\n int x = Integer.parseInt( scan.next() );\n int n = Integer.parseInt( scan.next() );\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++){\n p[i] = Integer.parseInt( scan.next() );\n }\n\n Arrays.sort(p);\n\n Roop:\n for(int i=0; i<Integer.MAX_VALUE; i++){\n boolean flag = true;\n for(int j=0; j<n; j++){\n if(x-i == p[j]){\n flag = false;\n break;\n }\n }\n if(flag){\n System.out.println(x-i);\n break Roop;\n }\n for(int j=0; j<n; j++){\n if(x+i == p[j]){\n continue Roop;\n }\n }\n System.out.println(x+i);\n break Roop;\n }\n \n\n }\n}",
"Main",
"public static void main(String[] args){\n\n Scanner scan = new Scanner( System.in );\n\n int x = Integer.parseInt( scan.next() );\n int n = Integer.parseInt( scan.next() );\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++){\n p[i] = Integer.parseInt( scan.next() );\n }\n\n Arrays.sort(p);\n\n Roop:\n for(int i=0; i<Integer.MAX_VALUE; i++){\n boolean flag = true;\n for(int j=0; j<n; j++){\n if(x-i == p[j]){\n flag = false;\n break;\n }\n }\n if(flag){\n System.out.println(x-i);\n break Roop;\n }\n for(int j=0; j<n; j++){\n if(x+i == p[j]){\n continue Roop;\n }\n }\n System.out.println(x+i);\n break Roop;\n }\n \n\n }",
"main",
"{\n\n Scanner scan = new Scanner( System.in );\n\n int x = Integer.parseInt( scan.next() );\n int n = Integer.parseInt( scan.next() );\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++){\n p[i] = Integer.parseInt( scan.next() );\n }\n\n Arrays.sort(p);\n\n Roop:\n for(int i=0; i<Integer.MAX_VALUE; i++){\n boolean flag = true;\n for(int j=0; j<n; j++){\n if(x-i == p[j]){\n flag = false;\n break;\n }\n }\n if(flag){\n System.out.println(x-i);\n break Roop;\n }\n for(int j=0; j<n; j++){\n if(x+i == p[j]){\n continue Roop;\n }\n }\n System.out.println(x+i);\n break Roop;\n }\n \n\n }",
"Scanner scan = new Scanner( System.in );",
"scan",
"new Scanner( System.in )",
"int x = Integer.parseInt( scan.next() );",
"x",
"Integer.parseInt( scan.next() )",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int n = Integer.parseInt( scan.next() );",
"n",
"Integer.parseInt( scan.next() )",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"for(int i=0; i<n; i++){\n p[i] = Integer.parseInt( scan.next() );\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i] = Integer.parseInt( scan.next() );\n }",
"{\n p[i] = Integer.parseInt( scan.next() );\n }",
"p[i] = Integer.parseInt( scan.next() )",
"p[i]",
"p",
"i",
"Integer.parseInt( scan.next() )",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n\n Scanner scan = new Scanner( System.in );\n\n int x = Integer.parseInt( scan.next() );\n int n = Integer.parseInt( scan.next() );\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++){\n p[i] = Integer.parseInt( scan.next() );\n }\n\n Arrays.sort(p);\n\n Roop:\n for(int i=0; i<Integer.MAX_VALUE; i++){\n boolean flag = true;\n for(int j=0; j<n; j++){\n if(x-i == p[j]){\n flag = false;\n break;\n }\n }\n if(flag){\n System.out.println(x-i);\n break Roop;\n }\n for(int j=0; j<n; j++){\n if(x+i == p[j]){\n continue Roop;\n }\n }\n System.out.println(x+i);\n break Roop;\n }\n \n\n }\n}",
"public class Main {\n public static void main(String[] args){\n\n Scanner scan = new Scanner( System.in );\n\n int x = Integer.parseInt( scan.next() );\n int n = Integer.parseInt( scan.next() );\n\n int[] p = new int[n];\n\n for(int i=0; i<n; i++){\n p[i] = Integer.parseInt( scan.next() );\n }\n\n Arrays.sort(p);\n\n Roop:\n for(int i=0; i<Integer.MAX_VALUE; i++){\n boolean flag = true;\n for(int j=0; j<n; j++){\n if(x-i == p[j]){\n flag = false;\n break;\n }\n }\n if(flag){\n System.out.println(x-i);\n break Roop;\n }\n for(int j=0; j<n; j++){\n if(x+i == p[j]){\n continue Roop;\n }\n }\n System.out.println(x+i);\n break Roop;\n }\n \n\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
Scanner scan = new Scanner( System.in );
int x = Integer.parseInt( scan.next() );
int n = Integer.parseInt( scan.next() );
int[] p = new int[n];
for(int i=0; i<n; i++){
p[i] = Integer.parseInt( scan.next() );
}
Arrays.sort(p);
Roop:
for(int i=0; i<Integer.MAX_VALUE; i++){
boolean flag = true;
for(int j=0; j<n; j++){
if(x-i == p[j]){
flag = false;
break;
}
}
if(flag){
System.out.println(x-i);
break Roop;
}
for(int j=0; j<n; j++){
if(x+i == p[j]){
continue Roop;
}
}
System.out.println(x+i);
break Roop;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
4,
18,
13,
17,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
4,
18,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
136,
5
],
[
136,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
56,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
67,
77
],
[
77,
78
],
[
78,
79
],
[
67,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
90,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
82,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
108,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
111,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
8,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
8,
130
],
[
130,
131
],
[
131,
132
],
[
6,
133
],
[
133,
134
],
[
0,
135
],
[
135,
136
],
[
135,
137
]
]
| [
"import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x =sc.nextInt();\n\t\tint n =sc.nextInt();\n\t\tint min=0;\n\t\tint max=0;\n\t\tArrayList p = new ArrayList<>();\n\t\t\n\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\n\t\tif(!(p.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<p.size();i++) {\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(0);\n\t\tsc.close();\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 x =sc.nextInt();\n\t\tint n =sc.nextInt();\n\t\tint min=0;\n\t\tint max=0;\n\t\tArrayList p = new ArrayList<>();\n\t\t\n\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\n\t\tif(!(p.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<p.size();i++) {\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(0);\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x =sc.nextInt();\n\t\tint n =sc.nextInt();\n\t\tint min=0;\n\t\tint max=0;\n\t\tArrayList p = new ArrayList<>();\n\t\t\n\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\n\t\tif(!(p.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<p.size();i++) {\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(0);\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x =sc.nextInt();\n\t\tint n =sc.nextInt();\n\t\tint min=0;\n\t\tint max=0;\n\t\tArrayList p = new ArrayList<>();\n\t\t\n\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\n\t\tif(!(p.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<p.size();i++) {\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(0);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x =sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n =sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int min=0;",
"min",
"0",
"int max=0;",
"max",
"0",
"ArrayList p = new ArrayList<>();",
"p",
"new ArrayList<>()",
"for(int i=0;i<n;i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tp.add(sc.nextInt());\n\t\t}",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(!(p.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"!(p.contains(x))",
"(p.contains(x))",
"p.contains",
"p",
"x",
"{\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i=1;i<p.size();i++) {\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<p.size()",
"i",
"p.size()",
"p.size",
"p",
"i++",
"i++",
"i",
"{\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}",
"if(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}",
"!(p.contains(x-i))",
"(p.contains(x-i))",
"p.contains",
"p",
"x-i",
"x",
"i",
"{\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"System.exit(0)",
"System.exit",
"System",
"0",
"if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}",
"!(p.contains(x+i))",
"(p.contains(x+i))",
"p.contains",
"p",
"x+i",
"x",
"i",
"{\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}",
"System.out.println(x+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"System.exit(0)",
"System.exit",
"System",
"0",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x =sc.nextInt();\n\t\tint n =sc.nextInt();\n\t\tint min=0;\n\t\tint max=0;\n\t\tArrayList p = new ArrayList<>();\n\t\t\n\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\n\t\tif(!(p.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<p.size();i++) {\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(0);\n\t\tsc.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x =sc.nextInt();\n\t\tint n =sc.nextInt();\n\t\tint min=0;\n\t\tint max=0;\n\t\tArrayList p = new ArrayList<>();\n\t\t\n\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp.add(sc.nextInt());\n\t\t}\n\n\t\tif(!(p.contains(x))) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<p.size();i++) {\n\t\t\tif(!(p.contains(x-i))) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\telse if(!(p.contains(x+i))) {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t\tSystem.exit(0);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(0);\n\t\tsc.close();\n\t}\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x =sc.nextInt();
int n =sc.nextInt();
int min=0;
int max=0;
ArrayList p = new ArrayList<>();
for(int i=0;i<n;i++) {
p.add(sc.nextInt());
}
if(!(p.contains(x))) {
System.out.println(x);
System.exit(0);
}
for(int i=1;i<p.size();i++) {
if(!(p.contains(x-i))) {
System.out.println(x-i);
System.exit(0);
}
else if(!(p.contains(x+i))) {
System.out.println(x+i);
System.exit(0);
}
}
System.out.println(0);
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
30,
0,
18,
13,
4,
18,
13,
17,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
2,
13,
17,
41,
13,
2,
13,
17,
41,
13,
18,
13,
13,
42,
2,
2,
13,
17,
2,
13,
18,
13,
13,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
13,
3,
30,
40,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
13,
3,
30,
40,
13,
42,
2,
2,
13,
17,
2,
13,
18,
13,
13,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
13,
3,
30,
40,
13,
42,
2,
2,
13,
18,
13,
13,
2,
13,
17,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
13,
3,
30,
40,
13,
4,
18,
18,
13,
13,
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
],
[
12,
14
],
[
14,
15
],
[
15,
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
],
[
42,
43
],
[
43,
44
],
[
39,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
46,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
46,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
59,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
59,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
59,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
75,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
86,
97
],
[
97,
98
],
[
98,
99
],
[
85,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
100,
111
],
[
111,
112
],
[
112,
113
],
[
59,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
125,
136
],
[
136,
137
],
[
137,
138
],
[
59,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
140,
146
],
[
146,
147
],
[
146,
148
],
[
139,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
150,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
150,
161
],
[
161,
162
],
[
162,
163
],
[
59,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
6,
170
],
[
170,
171
],
[
0,
172
],
[
172,
173
],
[
172,
174
]
]
| [
"import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint x = scn.nextInt(), n = scn.nextInt();\n\t\tint[] arr = new int[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}\n\t\tif (arr[x] == 0) {\n\t\t\tSystem.out.println(x);\n\t\t} else {\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint x = scn.nextInt(), n = scn.nextInt();\n\t\tint[] arr = new int[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}\n\t\tif (arr[x] == 0) {\n\t\t\tSystem.out.println(x);\n\t\t} else {\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint x = scn.nextInt(), n = scn.nextInt();\n\t\tint[] arr = new int[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}\n\t\tif (arr[x] == 0) {\n\t\t\tSystem.out.println(x);\n\t\t} else {\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"main",
"{\n\t\tScanner scn = new Scanner(System.in);\n\t\tint x = scn.nextInt(), n = scn.nextInt();\n\t\tint[] arr = new int[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}\n\t\tif (arr[x] == 0) {\n\t\t\tSystem.out.println(x);\n\t\t} else {\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"Scanner scn = new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int x = scn.nextInt()",
"x",
"scn.nextInt()",
"scn.nextInt",
"scn",
"n = scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int[] arr = new int[102];",
"arr",
"new int[102]",
"102",
"for (int i = 0; i < n; i++) {\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}",
"{\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}",
"arr[scn.nextInt()] = 1",
"arr[scn.nextInt()]",
"arr",
"scn.nextInt()",
"scn.nextInt",
"scn",
"1",
"if (arr[x] == 0) {\n\t\t\tSystem.out.println(x);\n\t\t} else {\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"arr[x] == 0",
"arr[x]",
"arr",
"x",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"int left = x - 1",
"left",
"x - 1",
"x",
"1",
"right = x + 1;",
"right",
"x + 1",
"x",
"1",
"int ans = Integer.MAX_VALUE;",
"ans",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"while (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}",
"left >= 0 && right < arr.length",
"left >= 0",
"left",
"0",
"right < arr.length",
"right",
"arr.length",
"arr",
"arr.length",
"{\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}",
"if (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}",
"arr[left] == 0",
"arr[left]",
"arr",
"left",
"0",
"{\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = left",
"ans",
"left",
"break;",
"{\n\t\t\t\t\tleft--;\n\t\t\t\t}",
"left--",
"left",
"if (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}",
"arr[right] == 0",
"arr[right]",
"arr",
"right",
"0",
"{\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = right",
"ans",
"right",
"break;",
"{\n\t\t\t\t\tright++;\n\t\t\t\t}",
"right++",
"right",
"while (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}",
"left < 0 && right < arr.length",
"left < 0",
"left",
"0",
"right < arr.length",
"right",
"arr.length",
"arr",
"arr.length",
"{\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}",
"if (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}",
"arr[right] == 0",
"arr[right]",
"arr",
"right",
"0",
"{\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = right",
"ans",
"right",
"break;",
"{\n\t\t\t\t\tright++;\n\t\t\t\t}",
"right++",
"right",
"while (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}",
"right >= arr.length && left >= 0",
"right >= arr.length",
"right",
"arr.length",
"arr",
"arr.length",
"left >= 0",
"left",
"0",
"{\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}",
"if (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}",
"arr[left] == 0",
"arr[left]",
"arr",
"left",
"0",
"{\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = left",
"ans",
"left",
"break;",
"{\n\t\t\t\t\tleft--;\n\t\t\t\t}",
"left--",
"left",
"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 scn = new Scanner(System.in);\n\t\tint x = scn.nextInt(), n = scn.nextInt();\n\t\tint[] arr = new int[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}\n\t\tif (arr[x] == 0) {\n\t\t\tSystem.out.println(x);\n\t\t} else {\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint x = scn.nextInt(), n = scn.nextInt();\n\t\tint[] arr = new int[102];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[scn.nextInt()] = 1;\n\t\t}\n\t\tif (arr[x] == 0) {\n\t\t\tSystem.out.println(x);\n\t\t} else {\n\t\t\tint left = x - 1, right = x + 1;\n\t\t\tint ans = Integer.MAX_VALUE;\n\t\t\twhile (left >= 0 && right < arr.length) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (left < 0 && right < arr.length) {\n\t\t\t\tif (arr[right] == 0) {\n\t\t\t\t\tans = right;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tright++;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (right >= arr.length && left >= 0) {\n\t\t\t\tif (arr[left] == 0) {\n\t\t\t\t\tans = left;\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int x = scn.nextInt(), n = scn.nextInt();
int[] arr = new int[102];
for (int i = 0; i < n; i++) {
arr[scn.nextInt()] = 1;
}
if (arr[x] == 0) {
System.out.println(x);
} else {
int left = x - 1, right = x + 1;
int ans = Integer.MAX_VALUE;
while (left >= 0 && right < arr.length) {
if (arr[left] == 0) {
ans = left;
break;
} else {
left--;
}
if (arr[right] == 0) {
ans = right;
break;
} else {
right++;
}
}
while (left < 0 && right < arr.length) {
if (arr[right] == 0) {
ans = right;
break;
} else {
right++;
}
}
while (right >= arr.length && left >= 0) {
if (arr[left] == 0) {
ans = left;
break;
} else {
left--;
}
}
System.out.println(ans);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
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,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
13,
29,
14,
2,
2,
13,
17,
17,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
131,
5
],
[
131,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
26,
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
],
[
8,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
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
],
[
91,
95
],
[
90,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
73,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
102,
109
],
[
73,
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
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
6,
128
],
[
128,
129
],
[
0,
130
],
[
130,
131
],
[
130,
132
]
]
| [
"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\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\n\t\tint p [] = new int [n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\n\n\t\tint ans = x;\n\t\tfor(int i = 0; i < 101; i++) {\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\n\t\tint p [] = new int [n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\n\n\t\tint ans = x;\n\t\tfor(int i = 0; i < 101; i++) {\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\n\t\tint p [] = new int [n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\n\n\t\tint ans = x;\n\t\tfor(int i = 0; i < 101; i++) {\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\n\t\tint p [] = new int [n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\n\n\t\tint ans = x;\n\t\tfor(int i = 0; i < 101; i++) {\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int p [] = new int [n];",
"p",
"new int [n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tp[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tp[i] = sc.nextInt();\n\t\t}",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = x;",
"ans",
"x",
"for(int i = 0; i < 101; i++) {\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}",
"{\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}",
"boolean t = true;",
"t",
"true",
"for(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}",
"if(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}",
"p[j] == ans",
"p[j]",
"p",
"j",
"ans",
"{\n\t\t\t\t\tt = false;\n\t\t\t\t}",
"t = false",
"t",
"false",
"if(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}",
"t",
"{\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"return;",
"if(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}",
"i % 2 == 0",
"i % 2",
"i",
"2",
"0",
"{\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}",
"ans -= (i + 1)",
"ans",
"(i + 1)",
"i",
"1",
"{\n\t\t\t\tans += (i + 1);\n\t\t\t}",
"ans += (i + 1)",
"ans",
"(i + 1)",
"i",
"1",
"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 x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\n\t\tint p [] = new int [n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\n\n\t\tint ans = x;\n\t\tfor(int i = 0; i < 101; i++) {\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}\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 x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\treturn;\n\t\t}\n\n\t\tint p [] = new int [n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\n\n\t\tint ans = x;\n\t\tfor(int i = 0; i < 101; i++) {\n\t\t\tboolean t = true;\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(p[j] == ans) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tans -= (i + 1);\n\n\t\t\t}else {\n\t\t\t\tans += (i + 1);\n\t\t\t}\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
if(n == 0) {
System.out.println(x);
return;
}
int p [] = new int [n];
for(int i = 0; i < n; i++) {
p[i] = sc.nextInt();
}
int ans = x;
for(int i = 0; i < 101; i++) {
boolean t = true;
for(int j = 0; j < n; j++) {
if(p[j] == ans) {
t = false;
}
}
if(t) {
System.out.println(ans);
return;
}
if(i % 2 == 0) {
ans -= (i + 1);
}else {
ans += (i + 1);
}
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
14,
2,
4,
18,
13,
13,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
4,
18,
13,
13,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
0,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
8,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
8,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
68,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
82,
83
],
[
82,
84
],
[
66,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
85,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
101,
103
],
[
65,
104
],
[
104,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
6,
112
],
[
112,
113
]
]
| [
"import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Set<Integer> set = new HashSet<>();\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n for(int i = 0; i < n; i++)\n p[i] = sc.nextInt();\n \n Arrays.sort(p);\n int diff = 0, flag = 0, res = 0;\n while(flag == 0) {\n if(Arrays.binarySearch(p, x-diff) < 0) {\n res = x - diff;\n flag = 1;\n } else if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }\n diff++;\n }\n System.out.println(res);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String[] args) {\n Set<Integer> set = new HashSet<>();\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n for(int i = 0; i < n; i++)\n p[i] = sc.nextInt();\n \n Arrays.sort(p);\n int diff = 0, flag = 0, res = 0;\n while(flag == 0) {\n if(Arrays.binarySearch(p, x-diff) < 0) {\n res = x - diff;\n flag = 1;\n } else if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }\n diff++;\n }\n System.out.println(res);\n }\n}",
"Main",
"public static void main(String[] args) {\n Set<Integer> set = new HashSet<>();\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n for(int i = 0; i < n; i++)\n p[i] = sc.nextInt();\n \n Arrays.sort(p);\n int diff = 0, flag = 0, res = 0;\n while(flag == 0) {\n if(Arrays.binarySearch(p, x-diff) < 0) {\n res = x - diff;\n flag = 1;\n } else if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }\n diff++;\n }\n System.out.println(res);\n }",
"main",
"{\n Set<Integer> set = new HashSet<>();\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n for(int i = 0; i < n; i++)\n p[i] = sc.nextInt();\n \n Arrays.sort(p);\n int diff = 0, flag = 0, res = 0;\n while(flag == 0) {\n if(Arrays.binarySearch(p, x-diff) < 0) {\n res = x - diff;\n flag = 1;\n } else if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }\n diff++;\n }\n System.out.println(res);\n }",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"for(int i = 0; i < n; i++)\n p[i] = sc.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"p[i] = sc.nextInt();",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"int diff = 0",
"diff",
"0",
"flag = 0",
"flag",
"0",
"res = 0;",
"res",
"0",
"while(flag == 0) {\n if(Arrays.binarySearch(p, x-diff) < 0) {\n res = x - diff;\n flag = 1;\n } else if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }\n diff++;\n }",
"flag == 0",
"flag",
"0",
"{\n if(Arrays.binarySearch(p, x-diff) < 0) {\n res = x - diff;\n flag = 1;\n } else if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }\n diff++;\n }",
"if(Arrays.binarySearch(p, x-diff) < 0) {\n res = x - diff;\n flag = 1;\n } else if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }",
"Arrays.binarySearch(p, x-diff) < 0",
"Arrays.binarySearch(p, x-diff)",
"Arrays.binarySearch",
"Arrays",
"p",
"x-diff",
"x",
"diff",
"0",
"{\n res = x - diff;\n flag = 1;\n }",
"res = x - diff",
"res",
"x - diff",
"x",
"diff",
"flag = 1",
"flag",
"1",
"if(Arrays.binarySearch(p, x+diff) < 0) {\n res = x + diff;\n flag = 1;\n }",
"Arrays.binarySearch(p, x+diff) < 0",
"Arrays.binarySearch(p, x+diff)",
"Arrays.binarySearch",
"Arrays",
"p",
"x+diff",
"x",
"diff",
"0",
"{\n res = x + diff;\n flag = 1;\n }",
"res = x + diff",
"res",
"x + diff",
"x",
"diff",
"flag = 1",
"flag",
"1",
"diff++",
"diff",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args"
]
| import java.util.*;
class Main {
public static void main(String[] args) {
Set<Integer> set = new HashSet<>();
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int[] p = new int[n];
for(int i = 0; i < n; i++)
p[i] = sc.nextInt();
Arrays.sort(p);
int diff = 0, flag = 0, res = 0;
while(flag == 0) {
if(Arrays.binarySearch(p, x-diff) < 0) {
res = x - diff;
flag = 1;
} else if(Arrays.binarySearch(p, x+diff) < 0) {
res = x + diff;
flag = 1;
}
diff++;
}
System.out.println(res);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
13,
41,
13,
13,
41,
13,
13,
42,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
17,
3,
0,
13,
13,
14,
2,
13,
13,
3,
0,
13,
17,
0,
13,
13,
42,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
17,
3,
0,
13,
13,
14,
2,
13,
13,
3,
0,
13,
17,
14,
2,
2,
13,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
157,
5
],
[
157,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
57,
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
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
71,
82
],
[
82,
83
],
[
82,
84
],
[
57,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
57,
90
],
[
90,
91
],
[
90,
92
],
[
8,
93
],
[
93,
94
],
[
93,
95
],
[
8,
96
],
[
96,
97
],
[
96,
98
],
[
98,
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
],
[
115,
116
],
[
115,
117
],
[
112,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
112,
123
],
[
123,
124
],
[
123,
125
],
[
98,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
98,
131
],
[
131,
132
],
[
131,
133
],
[
8,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
139,
141
],
[
134,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
134,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
6,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
]
| [
"import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n int X = scan.nextInt();\n int N = scan.nextInt();\n int pn[] = new int[N];\n for(int i=0; i<N; i++){\n pn[i] = scan.nextInt();\n }\n int ans1 = X;\n int ans2 = X;\n int x = X;\n \n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }\n x = X;\n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }\n \n if(X-ans1 > ans2-X)\n System.out.println(ans2);\n else\n System.out.println(ans1);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n int X = scan.nextInt();\n int N = scan.nextInt();\n int pn[] = new int[N];\n for(int i=0; i<N; i++){\n pn[i] = scan.nextInt();\n }\n int ans1 = X;\n int ans2 = X;\n int x = X;\n \n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }\n x = X;\n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }\n \n if(X-ans1 > ans2-X)\n System.out.println(ans2);\n else\n System.out.println(ans1);\n }\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n int X = scan.nextInt();\n int N = scan.nextInt();\n int pn[] = new int[N];\n for(int i=0; i<N; i++){\n pn[i] = scan.nextInt();\n }\n int ans1 = X;\n int ans2 = X;\n int x = X;\n \n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }\n x = X;\n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }\n \n if(X-ans1 > ans2-X)\n System.out.println(ans2);\n else\n System.out.println(ans1);\n }",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n int X = scan.nextInt();\n int N = scan.nextInt();\n int pn[] = new int[N];\n for(int i=0; i<N; i++){\n pn[i] = scan.nextInt();\n }\n int ans1 = X;\n int ans2 = X;\n int x = X;\n \n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }\n x = X;\n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }\n \n if(X-ans1 > ans2-X)\n System.out.println(ans2);\n else\n System.out.println(ans1);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int X = scan.nextInt();",
"X",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int pn[] = new int[N];",
"pn",
"new int[N]",
"N",
"for(int i=0; i<N; i++){\n pn[i] = scan.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n pn[i] = scan.nextInt();\n }",
"{\n pn[i] = scan.nextInt();\n }",
"pn[i] = scan.nextInt()",
"pn[i]",
"pn",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int ans1 = X;",
"ans1",
"X",
"int ans2 = X;",
"ans2",
"X",
"int x = X;",
"x",
"X",
"while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }",
"true",
"{\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }",
"for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }",
"{\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }",
"if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;",
"x == pn[i]",
"x",
"pn[i]",
"pn",
"i",
"{\n ans1 = 200;\n break;\n }",
"ans1 = 200",
"ans1",
"200",
"break;",
"ans1 = x",
"ans1",
"x",
"if(ans1 == x)\n break;",
"ans1 == x",
"ans1",
"x",
"break;",
"x -= 1",
"x",
"1",
"x = X",
"x",
"X",
"while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }",
"true",
"{\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }",
"for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }",
"{\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }",
"if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;",
"x == pn[i]",
"x",
"pn[i]",
"pn",
"i",
"{\n ans2 = 200;\n break;\n }",
"ans2 = 200",
"ans2",
"200",
"break;",
"ans2 = x",
"ans2",
"x",
"if(ans2 == x)\n break;",
"ans2 == x",
"ans2",
"x",
"break;",
"x += 1",
"x",
"1",
"if(X-ans1 > ans2-X)\n System.out.println(ans2);\n else\n System.out.println(ans1);",
"X-ans1 > ans2-X",
"X-ans1",
"X",
"ans1",
"ans2-X",
"ans2",
"X",
"System.out.println(ans2)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans2",
"System.out.println(ans1)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans1",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n int X = scan.nextInt();\n int N = scan.nextInt();\n int pn[] = new int[N];\n for(int i=0; i<N; i++){\n pn[i] = scan.nextInt();\n }\n int ans1 = X;\n int ans2 = X;\n int x = X;\n \n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }\n x = X;\n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }\n \n if(X-ans1 > ans2-X)\n System.out.println(ans2);\n else\n System.out.println(ans1);\n }\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n int X = scan.nextInt();\n int N = scan.nextInt();\n int pn[] = new int[N];\n for(int i=0; i<N; i++){\n pn[i] = scan.nextInt();\n }\n int ans1 = X;\n int ans2 = X;\n int x = X;\n \n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans1 = 200;\n break;\n }else\n ans1 = x;\n }\n if(ans1 == x)\n break;\n x -= 1;\n }\n x = X;\n while(true){\n for(int i=0; i<N; i++){\n if(x == pn[i]){\n ans2 = 200;\n break;\n }else\n ans2 = x;\n }\n if(ans2 == x)\n break;\n x += 1;\n }\n \n if(X-ans1 > ans2-X)\n System.out.println(ans2);\n else\n System.out.println(ans1);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int X = scan.nextInt();
int N = scan.nextInt();
int pn[] = new int[N];
for(int i=0; i<N; i++){
pn[i] = scan.nextInt();
}
int ans1 = X;
int ans2 = X;
int x = X;
while(true){
for(int i=0; i<N; i++){
if(x == pn[i]){
ans1 = 200;
break;
}else
ans1 = x;
}
if(ans1 == x)
break;
x -= 1;
}
x = X;
while(true){
for(int i=0; i<N; i++){
if(x == pn[i]){
ans2 = 200;
break;
}else
ans2 = x;
}
if(ans2 == x)
break;
x += 1;
}
if(X-ans1 > ans2-X)
System.out.println(ans2);
else
System.out.println(ans1);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
4,
18,
13,
13,
14,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
41,
13,
2,
13,
17,
41,
13,
2,
13,
17,
41,
13,
17,
42,
2,
2,
13,
18,
13,
13,
2,
13,
40,
17,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
14,
2,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
40,
13,
40,
13,
40,
13,
14,
2,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
14,
2,
13,
40,
17,
30,
14,
2,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
4,
18,
18,
13,
13,
2,
13,
13,
29,
4,
18,
18,
13,
13,
2,
18,
13,
17,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
246,
5
],
[
246,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
8,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
63,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
69,
76
],
[
8,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
81,
88
],
[
8,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
92,
102
],
[
102,
103
],
[
103,
104
],
[
92,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
107,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
8,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
8,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
8,
127
],
[
127,
128
],
[
127,
129
],
[
8,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
130,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
147,
149
],
[
142,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
150,
159
],
[
141,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
165,
167
],
[
160,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
169,
174
],
[
174,
175
],
[
174,
176
],
[
168,
177
],
[
141,
178
],
[
178,
179
],
[
141,
180
],
[
180,
181
],
[
141,
182
],
[
182,
183
],
[
8,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
187,
189
],
[
184,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
191,
196
],
[
196,
197
],
[
196,
198
],
[
190,
199
],
[
8,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
200,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
207,
211
],
[
211,
212
],
[
211,
213
],
[
206,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
215,
220
],
[
220,
221
],
[
220,
222
],
[
214,
223
],
[
205,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
224,
229
],
[
229,
230
],
[
229,
231
],
[
205,
232
],
[
8,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
233,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
238,
242
],
[
6,
243
],
[
243,
244
],
[
0,
245
],
[
245,
246
],
[
245,
247
]
]
| [
"import java.util.*;\n\npublic class Main{\n\npublic static void main(String[] args) {\nScanner scn=new Scanner (System.in);\nint x=scn.nextInt();\nint n=scn.nextInt();\nint []arr=new int[n];\nboolean team=false;\nfor(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}\nArrays.sort(arr);\nif(arr.length==0){\n System.out.println(x);\n return;\n}\nif( team==false){\n System.out.println(x);\n return;\n}\nint idx=0;\nfor(int i=0;i<arr.length;i++){\n if(arr[i]==x){\n idx=i;\n }\n \n}\n\nint p1=idx+1;\nint p2=idx-1;\nint val=1;\nwhile(p1!=arr.length && p2!=-1){\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}\nif(p1!=arr.length){\n\n System.out.println(x-val);\n return;\n}\nif(p2!=-1){\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}\nSystem.out.println(arr[0]-1);\n\n\n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\npublic static void main(String[] args) {\nScanner scn=new Scanner (System.in);\nint x=scn.nextInt();\nint n=scn.nextInt();\nint []arr=new int[n];\nboolean team=false;\nfor(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}\nArrays.sort(arr);\nif(arr.length==0){\n System.out.println(x);\n return;\n}\nif( team==false){\n System.out.println(x);\n return;\n}\nint idx=0;\nfor(int i=0;i<arr.length;i++){\n if(arr[i]==x){\n idx=i;\n }\n \n}\n\nint p1=idx+1;\nint p2=idx-1;\nint val=1;\nwhile(p1!=arr.length && p2!=-1){\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}\nif(p1!=arr.length){\n\n System.out.println(x-val);\n return;\n}\nif(p2!=-1){\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}\nSystem.out.println(arr[0]-1);\n\n\n\n }\n}",
"Main",
"public static void main(String[] args) {\nScanner scn=new Scanner (System.in);\nint x=scn.nextInt();\nint n=scn.nextInt();\nint []arr=new int[n];\nboolean team=false;\nfor(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}\nArrays.sort(arr);\nif(arr.length==0){\n System.out.println(x);\n return;\n}\nif( team==false){\n System.out.println(x);\n return;\n}\nint idx=0;\nfor(int i=0;i<arr.length;i++){\n if(arr[i]==x){\n idx=i;\n }\n \n}\n\nint p1=idx+1;\nint p2=idx-1;\nint val=1;\nwhile(p1!=arr.length && p2!=-1){\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}\nif(p1!=arr.length){\n\n System.out.println(x-val);\n return;\n}\nif(p2!=-1){\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}\nSystem.out.println(arr[0]-1);\n\n\n\n }",
"main",
"{\nScanner scn=new Scanner (System.in);\nint x=scn.nextInt();\nint n=scn.nextInt();\nint []arr=new int[n];\nboolean team=false;\nfor(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}\nArrays.sort(arr);\nif(arr.length==0){\n System.out.println(x);\n return;\n}\nif( team==false){\n System.out.println(x);\n return;\n}\nint idx=0;\nfor(int i=0;i<arr.length;i++){\n if(arr[i]==x){\n idx=i;\n }\n \n}\n\nint p1=idx+1;\nint p2=idx-1;\nint val=1;\nwhile(p1!=arr.length && p2!=-1){\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}\nif(p1!=arr.length){\n\n System.out.println(x-val);\n return;\n}\nif(p2!=-1){\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}\nSystem.out.println(arr[0]-1);\n\n\n\n }",
"Scanner scn=new Scanner (System.in);",
"scn",
"new Scanner (System.in)",
"int x=scn.nextInt();",
"x",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int n=scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int []arr=new int[n];",
"arr",
"new int[n]",
"n",
"boolean team=false;",
"team",
"false",
"for(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}",
"{\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}",
"arr[i]=scn.nextInt()",
"arr[i]",
"arr",
"i",
"scn.nextInt()",
"scn.nextInt",
"scn",
"if(arr[i]==x){\n team=true;\n }",
"arr[i]==x",
"arr[i]",
"arr",
"i",
"x",
"{\n team=true;\n }",
"team=true",
"team",
"true",
"Arrays.sort(arr)",
"Arrays.sort",
"Arrays",
"arr",
"if(arr.length==0){\n System.out.println(x);\n return;\n}",
"arr.length==0",
"arr.length",
"arr",
"arr.length",
"0",
"{\n System.out.println(x);\n return;\n}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"if( team==false){\n System.out.println(x);\n return;\n}",
"team==false",
"team",
"false",
"{\n System.out.println(x);\n return;\n}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int idx=0;",
"idx",
"0",
"for(int i=0;i<arr.length;i++){\n if(arr[i]==x){\n idx=i;\n }\n \n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n if(arr[i]==x){\n idx=i;\n }\n \n}",
"{\n if(arr[i]==x){\n idx=i;\n }\n \n}",
"if(arr[i]==x){\n idx=i;\n }",
"arr[i]==x",
"arr[i]",
"arr",
"i",
"x",
"{\n idx=i;\n }",
"idx=i",
"idx",
"i",
"int p1=idx+1;",
"p1",
"idx+1",
"idx",
"1",
"int p2=idx-1;",
"p2",
"idx-1",
"idx",
"1",
"int val=1;",
"val",
"1",
"while(p1!=arr.length && p2!=-1){\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}",
"p1!=arr.length && p2!=-1",
"p1!=arr.length",
"p1",
"arr.length",
"arr",
"arr.length",
"p2!=-1",
"p2",
"-1",
"1",
"{\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}",
"if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }",
"arr[p2]!=x-val",
"arr[p2]",
"arr",
"p2",
"x-val",
"x",
"val",
"{\n \n System.out.println(x-val);\n return;\n }",
"System.out.println(x-val)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-val",
"x",
"val",
"return;",
"if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }",
"arr[p1]!=x+val",
"arr[p1]",
"arr",
"p1",
"x+val",
"x",
"val",
"{\n \n System.out.println(x+val);\n return;\n }",
"System.out.println(x+val)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+val",
"x",
"val",
"return;",
"val++",
"val",
"p2--",
"p2",
"p1++",
"p1",
"if(p1!=arr.length){\n\n System.out.println(x-val);\n return;\n}",
"p1!=arr.length",
"p1",
"arr.length",
"arr",
"arr.length",
"{\n\n System.out.println(x-val);\n return;\n}",
"System.out.println(x-val)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-val",
"x",
"val",
"return;",
"if(p2!=-1){\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}",
"p2!=-1",
"p2",
"-1",
"1",
"{\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}",
"if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }",
"arr[p2]==x-val",
"arr[p2]",
"arr",
"p2",
"x-val",
"x",
"val",
"{\n \n System.out.println(x+val);\n return;\n }",
"System.out.println(x+val)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+val",
"x",
"val",
"return;",
"System.out.println(x-val)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-val",
"x",
"val",
"return;",
"System.out.println(arr[0]-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"arr[0]-1",
"arr[0]",
"arr",
"0",
"1",
"String[] args",
"args",
"public class Main{\n\npublic static void main(String[] args) {\nScanner scn=new Scanner (System.in);\nint x=scn.nextInt();\nint n=scn.nextInt();\nint []arr=new int[n];\nboolean team=false;\nfor(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}\nArrays.sort(arr);\nif(arr.length==0){\n System.out.println(x);\n return;\n}\nif( team==false){\n System.out.println(x);\n return;\n}\nint idx=0;\nfor(int i=0;i<arr.length;i++){\n if(arr[i]==x){\n idx=i;\n }\n \n}\n\nint p1=idx+1;\nint p2=idx-1;\nint val=1;\nwhile(p1!=arr.length && p2!=-1){\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}\nif(p1!=arr.length){\n\n System.out.println(x-val);\n return;\n}\nif(p2!=-1){\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}\nSystem.out.println(arr[0]-1);\n\n\n\n }\n}",
"public class Main{\n\npublic static void main(String[] args) {\nScanner scn=new Scanner (System.in);\nint x=scn.nextInt();\nint n=scn.nextInt();\nint []arr=new int[n];\nboolean team=false;\nfor(int i=0;i<n;i++){\n arr[i]=scn.nextInt();\n if(arr[i]==x){\n team=true;\n }\n}\nArrays.sort(arr);\nif(arr.length==0){\n System.out.println(x);\n return;\n}\nif( team==false){\n System.out.println(x);\n return;\n}\nint idx=0;\nfor(int i=0;i<arr.length;i++){\n if(arr[i]==x){\n idx=i;\n }\n \n}\n\nint p1=idx+1;\nint p2=idx-1;\nint val=1;\nwhile(p1!=arr.length && p2!=-1){\n if(arr[p2]!=x-val){\n \n System.out.println(x-val);\n return;\n }\n if(arr[p1]!=x+val){\n \n System.out.println(x+val);\n return;\n }\n val++;\n p2--;\n p1++;\n}\nif(p1!=arr.length){\n\n System.out.println(x-val);\n return;\n}\nif(p2!=-1){\n \n if(arr[p2]==x-val){\n \n System.out.println(x+val);\n return;\n }\n \n System.out.println(x-val);\n return;\n}\nSystem.out.println(arr[0]-1);\n\n\n\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scn=new Scanner (System.in);
int x=scn.nextInt();
int n=scn.nextInt();
int []arr=new int[n];
boolean team=false;
for(int i=0;i<n;i++){
arr[i]=scn.nextInt();
if(arr[i]==x){
team=true;
}
}
Arrays.sort(arr);
if(arr.length==0){
System.out.println(x);
return;
}
if( team==false){
System.out.println(x);
return;
}
int idx=0;
for(int i=0;i<arr.length;i++){
if(arr[i]==x){
idx=i;
}
}
int p1=idx+1;
int p2=idx-1;
int val=1;
while(p1!=arr.length && p2!=-1){
if(arr[p2]!=x-val){
System.out.println(x-val);
return;
}
if(arr[p1]!=x+val){
System.out.println(x+val);
return;
}
val++;
p2--;
p1++;
}
if(p1!=arr.length){
System.out.println(x-val);
return;
}
if(p2!=-1){
if(arr[p2]==x-val){
System.out.println(x+val);
return;
}
System.out.println(x-val);
return;
}
System.out.println(arr[0]-1);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
4,
13,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
13,
4,
13,
13,
17,
2,
13,
17,
41,
13,
2,
13,
17,
41,
13,
13,
41,
13,
17,
42,
17,
30,
0,
13,
2,
13,
17,
41,
13,
4,
13,
13,
17,
2,
13,
17,
13,
14,
2,
13,
40,
17,
30,
29,
13,
14,
13,
30,
0,
13,
2,
13,
17,
41,
13,
4,
13,
13,
17,
2,
13,
17,
13,
14,
2,
13,
40,
17,
30,
29,
13,
0,
13,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
41,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
13,
14,
2,
18,
13,
13,
13,
29,
4,
13,
13,
13,
2,
13,
17,
13,
29,
4,
13,
13,
2,
13,
17,
13,
13,
29,
40,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
29,
41,
13,
2,
2,
13,
13,
17,
41,
13,
18,
13,
13,
41,
13,
13,
41,
13,
13,
42,
2,
13,
13,
30,
42,
2,
18,
13,
13,
13,
30,
40,
13,
42,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
40,
13,
4,
13,
13,
13,
13,
4,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
303,
5
],
[
303,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
48,
51
],
[
48,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
6,
59
],
[
59,
60
],
[
303,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
63,
71
],
[
71,
72
],
[
71,
73
],
[
71,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
63,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
63,
83
],
[
83,
84
],
[
83,
85
],
[
63,
86
],
[
86,
87
],
[
86,
88
],
[
63,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
99,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
99,
106
],
[
91,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
107,
112
],
[
112,
113
],
[
113,
114
],
[
91,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
125,
128
],
[
125,
129
],
[
129,
130
],
[
129,
131
],
[
125,
132
],
[
117,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
133,
138
],
[
138,
139
],
[
139,
140
],
[
91,
141
],
[
141,
142
],
[
141,
143
],
[
61,
144
],
[
144,
145
],
[
61,
146
],
[
146,
147
],
[
61,
148
],
[
148,
149
],
[
303,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
157,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
167,
173
],
[
173,
174
],
[
157,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
175,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
182,
185
],
[
182,
186
],
[
186,
187
],
[
186,
188
],
[
182,
189
],
[
157,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
191,
194
],
[
194,
195
],
[
194,
196
],
[
191,
197
],
[
191,
198
],
[
152,
199
],
[
199,
200
],
[
200,
201
],
[
150,
202
],
[
202,
203
],
[
150,
204
],
[
204,
205
],
[
150,
206
],
[
206,
207
],
[
150,
208
],
[
208,
209
],
[
303,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
213,
217
],
[
217,
218
],
[
212,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
221,
225
],
[
212,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
228,
230
],
[
212,
231
],
[
231,
232
],
[
231,
233
],
[
212,
234
],
[
234,
235
],
[
234,
236
],
[
212,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
237,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
244,
245
],
[
244,
246
],
[
243,
247
],
[
242,
248
],
[
248,
249
],
[
249,
250
],
[
241,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
256
],
[
251,
257
],
[
257,
258
],
[
258,
259
],
[
241,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
260,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
267,
269
],
[
264,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
270,
274
],
[
274,
275
],
[
274,
276
],
[
264,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
277,
281
],
[
264,
282
],
[
282,
283
],
[
264,
284
],
[
284,
285
],
[
212,
286
],
[
286,
287
],
[
286,
288
],
[
286,
289
],
[
286,
290
],
[
212,
291
],
[
291,
292
],
[
291,
293
],
[
291,
294
],
[
291,
295
],
[
210,
296
],
[
296,
297
],
[
210,
298
],
[
298,
299
],
[
210,
300
],
[
300,
301
],
[
0,
302
],
[
302,
303
],
[
302,
304
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint X = scn.nextInt();\n\t\tint N = scn.nextInt();\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = scn.nextInt();\n\t\t}\n\t\tint ans = Val(N, X, arr);\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int Val(int N, int X, int[] arr) {\n\t\tif (N == 0) {\n\t\t\treturn X;\n\t\t}\n\t\tquickSort(arr, 0, N - 1);\n\t\tint val = X + 1;\n\t\tint val1 = X;\n\t\tboolean start = false;\n\t\twhile (true) {\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}\n\t}\n\n\tpublic static int binarySearch(int arr[], int l, int r, int x) {\n\t\tif (r >= l) {\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}\n\t\treturn -1;\n\t}\n\n\tpublic static void quickSort(int[] arr, int lo, int hi) {\n\t\tif (lo >= hi) {\n\t\t\treturn;\n\t\t}\n\t\tint mid = (lo + hi) / 2;\n\t\tint pivot = arr[mid];\n\t\tint left = lo;\n\t\tint right = hi;\n\t\twhile (left <= right) {\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}\n\t\tquickSort(arr, lo, right);\n\t\tquickSort(arr, left, hi);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint X = scn.nextInt();\n\t\tint N = scn.nextInt();\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = scn.nextInt();\n\t\t}\n\t\tint ans = Val(N, X, arr);\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int Val(int N, int X, int[] arr) {\n\t\tif (N == 0) {\n\t\t\treturn X;\n\t\t}\n\t\tquickSort(arr, 0, N - 1);\n\t\tint val = X + 1;\n\t\tint val1 = X;\n\t\tboolean start = false;\n\t\twhile (true) {\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}\n\t}\n\n\tpublic static int binarySearch(int arr[], int l, int r, int x) {\n\t\tif (r >= l) {\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}\n\t\treturn -1;\n\t}\n\n\tpublic static void quickSort(int[] arr, int lo, int hi) {\n\t\tif (lo >= hi) {\n\t\t\treturn;\n\t\t}\n\t\tint mid = (lo + hi) / 2;\n\t\tint pivot = arr[mid];\n\t\tint left = lo;\n\t\tint right = hi;\n\t\twhile (left <= right) {\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}\n\t\tquickSort(arr, lo, right);\n\t\tquickSort(arr, left, hi);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint X = scn.nextInt();\n\t\tint N = scn.nextInt();\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = scn.nextInt();\n\t\t}\n\t\tint ans = Val(N, X, arr);\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner scn = new Scanner(System.in);\n\t\tint X = scn.nextInt();\n\t\tint N = scn.nextInt();\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = scn.nextInt();\n\t\t}\n\t\tint ans = Val(N, X, arr);\n\t\tSystem.out.println(ans);\n\t}",
"Scanner scn = new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int X = scn.nextInt();",
"X",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int N = scn.nextInt();",
"N",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int[] arr = new int[N];",
"arr",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tarr[i] = scn.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tarr[i] = scn.nextInt();\n\t\t}",
"{\n\t\t\tarr[i] = scn.nextInt();\n\t\t}",
"arr[i] = scn.nextInt()",
"arr[i]",
"arr",
"i",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int ans = Val(N, X, arr);",
"ans",
"Val(N, X, arr)",
"Val",
"N",
"X",
"arr",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public static int Val(int N, int X, int[] arr) {\n\t\tif (N == 0) {\n\t\t\treturn X;\n\t\t}\n\t\tquickSort(arr, 0, N - 1);\n\t\tint val = X + 1;\n\t\tint val1 = X;\n\t\tboolean start = false;\n\t\twhile (true) {\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}\n\t}",
"Val",
"{\n\t\tif (N == 0) {\n\t\t\treturn X;\n\t\t}\n\t\tquickSort(arr, 0, N - 1);\n\t\tint val = X + 1;\n\t\tint val1 = X;\n\t\tboolean start = false;\n\t\twhile (true) {\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}\n\t}",
"if (N == 0) {\n\t\t\treturn X;\n\t\t}",
"N == 0",
"N",
"0",
"{\n\t\t\treturn X;\n\t\t}",
"return X;",
"X",
"quickSort(arr, 0, N - 1)",
"quickSort",
"arr",
"0",
"N - 1",
"N",
"1",
"int val = X + 1;",
"val",
"X + 1",
"X",
"1",
"int val1 = X;",
"val1",
"X",
"boolean start = false;",
"start",
"false",
"while (true) {\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}",
"true",
"{\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}",
"val = val - 1",
"val",
"val - 1",
"val",
"1",
"int bs = binarySearch(arr, 0, N - 1, val);",
"bs",
"binarySearch(arr, 0, N - 1, val)",
"binarySearch",
"arr",
"0",
"N - 1",
"N",
"1",
"val",
"if (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}",
"bs == -1",
"bs",
"-1",
"1",
"{\n\t\t\t\treturn val;\n\t\t\t}",
"return val;",
"val",
"if (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}",
"start",
"{\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}",
"val1 = val1 + 1",
"val1",
"val1 + 1",
"val1",
"1",
"int bs1 = binarySearch(arr, 0, N - 1, val1);",
"bs1",
"binarySearch(arr, 0, N - 1, val1)",
"binarySearch",
"arr",
"0",
"N - 1",
"N",
"1",
"val1",
"if (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}",
"bs1 == -1",
"bs1",
"-1",
"1",
"{\n\t\t\t\t\treturn val1;\n\t\t\t\t}",
"return val1;",
"val1",
"start = true",
"start",
"true",
"int N",
"N",
"int X",
"X",
"int[] arr",
"arr",
"public static int binarySearch(int arr[], int l, int r, int x) {\n\t\tif (r >= l) {\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}\n\t\treturn -1;\n\t}",
"binarySearch",
"{\n\t\tif (r >= l) {\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}\n\t\treturn -1;\n\t}",
"if (r >= l) {\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}",
"r >= l",
"r",
"l",
"{\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}",
"int mid = l + (r - l) / 2;",
"mid",
"l + (r - l) / 2",
"l",
"(r - l) / 2",
"(r - l)",
"r",
"l",
"2",
"if (arr[mid] == x)\n\t\t\t\treturn mid;",
"arr[mid] == x",
"arr[mid]",
"arr",
"mid",
"x",
"return mid;",
"mid",
"if (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);",
"arr[mid] > x",
"arr[mid]",
"arr",
"mid",
"x",
"return binarySearch(arr, l, mid - 1, x);",
"binarySearch(arr, l, mid - 1, x)",
"binarySearch",
"arr",
"l",
"mid - 1",
"mid",
"1",
"x",
"return binarySearch(arr, mid + 1, r, x);",
"binarySearch(arr, mid + 1, r, x)",
"binarySearch",
"arr",
"mid + 1",
"mid",
"1",
"r",
"x",
"return -1;",
"-1",
"1",
"int arr[]",
"arr",
"int l",
"l",
"int r",
"r",
"int x",
"x",
"public static void quickSort(int[] arr, int lo, int hi) {\n\t\tif (lo >= hi) {\n\t\t\treturn;\n\t\t}\n\t\tint mid = (lo + hi) / 2;\n\t\tint pivot = arr[mid];\n\t\tint left = lo;\n\t\tint right = hi;\n\t\twhile (left <= right) {\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}\n\t\tquickSort(arr, lo, right);\n\t\tquickSort(arr, left, hi);\n\t}",
"quickSort",
"{\n\t\tif (lo >= hi) {\n\t\t\treturn;\n\t\t}\n\t\tint mid = (lo + hi) / 2;\n\t\tint pivot = arr[mid];\n\t\tint left = lo;\n\t\tint right = hi;\n\t\twhile (left <= right) {\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}\n\t\tquickSort(arr, lo, right);\n\t\tquickSort(arr, left, hi);\n\t}",
"if (lo >= hi) {\n\t\t\treturn;\n\t\t}",
"lo >= hi",
"lo",
"hi",
"{\n\t\t\treturn;\n\t\t}",
"return;",
"int mid = (lo + hi) / 2;",
"mid",
"(lo + hi) / 2",
"(lo + hi)",
"lo",
"hi",
"2",
"int pivot = arr[mid];",
"pivot",
"arr[mid]",
"arr",
"mid",
"int left = lo;",
"left",
"lo",
"int right = hi;",
"right",
"hi",
"while (left <= right) {\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}",
"while (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}",
"arr[left] < pivot",
"arr[left]",
"arr",
"left",
"pivot",
"{\n\t\t\t\tleft++;\n\t\t\t}",
"left++",
"left",
"while (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}",
"arr[right] > pivot",
"arr[right]",
"arr",
"right",
"pivot",
"{\n\t\t\t\tright--;\n\t\t\t}",
"right--",
"right",
"if (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}",
"int temp = arr[left];",
"temp",
"arr[left]",
"arr",
"left",
"arr[left] = arr[right]",
"arr[left]",
"arr",
"left",
"arr[right]",
"arr",
"right",
"arr[right] = temp",
"arr[right]",
"arr",
"right",
"temp",
"left++",
"left",
"right--",
"right",
"quickSort(arr, lo, right)",
"quickSort",
"arr",
"lo",
"right",
"quickSort(arr, left, hi)",
"quickSort",
"arr",
"left",
"hi",
"int[] arr",
"arr",
"int lo",
"lo",
"int hi",
"hi",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint X = scn.nextInt();\n\t\tint N = scn.nextInt();\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = scn.nextInt();\n\t\t}\n\t\tint ans = Val(N, X, arr);\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int Val(int N, int X, int[] arr) {\n\t\tif (N == 0) {\n\t\t\treturn X;\n\t\t}\n\t\tquickSort(arr, 0, N - 1);\n\t\tint val = X + 1;\n\t\tint val1 = X;\n\t\tboolean start = false;\n\t\twhile (true) {\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}\n\t}\n\n\tpublic static int binarySearch(int arr[], int l, int r, int x) {\n\t\tif (r >= l) {\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}\n\t\treturn -1;\n\t}\n\n\tpublic static void quickSort(int[] arr, int lo, int hi) {\n\t\tif (lo >= hi) {\n\t\t\treturn;\n\t\t}\n\t\tint mid = (lo + hi) / 2;\n\t\tint pivot = arr[mid];\n\t\tint left = lo;\n\t\tint right = hi;\n\t\twhile (left <= right) {\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}\n\t\tquickSort(arr, lo, right);\n\t\tquickSort(arr, left, hi);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint X = scn.nextInt();\n\t\tint N = scn.nextInt();\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = scn.nextInt();\n\t\t}\n\t\tint ans = Val(N, X, arr);\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static int Val(int N, int X, int[] arr) {\n\t\tif (N == 0) {\n\t\t\treturn X;\n\t\t}\n\t\tquickSort(arr, 0, N - 1);\n\t\tint val = X + 1;\n\t\tint val1 = X;\n\t\tboolean start = false;\n\t\twhile (true) {\n\t\t\tval = val - 1;\n\t\t\tint bs = binarySearch(arr, 0, N - 1, val);\n\t\t\tif (bs == -1) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\tif (start) {\n\t\t\t\tval1 = val1 + 1;\n\t\t\t\tint bs1 = binarySearch(arr, 0, N - 1, val1);\n\t\t\t\tif (bs1 == -1) {\n\t\t\t\t\treturn val1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstart = true;\n\t\t}\n\t}\n\n\tpublic static int binarySearch(int arr[], int l, int r, int x) {\n\t\tif (r >= l) {\n\t\t\tint mid = l + (r - l) / 2;\n\t\t\tif (arr[mid] == x)\n\t\t\t\treturn mid;\n\t\t\tif (arr[mid] > x)\n\t\t\t\treturn binarySearch(arr, l, mid - 1, x);\n\t\t\treturn binarySearch(arr, mid + 1, r, x);\n\t\t}\n\t\treturn -1;\n\t}\n\n\tpublic static void quickSort(int[] arr, int lo, int hi) {\n\t\tif (lo >= hi) {\n\t\t\treturn;\n\t\t}\n\t\tint mid = (lo + hi) / 2;\n\t\tint pivot = arr[mid];\n\t\tint left = lo;\n\t\tint right = hi;\n\t\twhile (left <= right) {\n\t\t\twhile (arr[left] < pivot) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (arr[right] > pivot) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left <= right) {\n\t\t\t\tint temp = arr[left];\n\t\t\t\tarr[left] = arr[right];\n\t\t\t\tarr[right] = temp;\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}\n\t\tquickSort(arr, lo, right);\n\t\tquickSort(arr, left, hi);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int X = scn.nextInt();
int N = scn.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = scn.nextInt();
}
int ans = Val(N, X, arr);
System.out.println(ans);
}
public static int Val(int N, int X, int[] arr) {
if (N == 0) {
return X;
}
quickSort(arr, 0, N - 1);
int val = X + 1;
int val1 = X;
boolean start = false;
while (true) {
val = val - 1;
int bs = binarySearch(arr, 0, N - 1, val);
if (bs == -1) {
return val;
}
if (start) {
val1 = val1 + 1;
int bs1 = binarySearch(arr, 0, N - 1, val1);
if (bs1 == -1) {
return val1;
}
}
start = true;
}
}
public static int binarySearch(int arr[], int l, int r, int x) {
if (r >= l) {
int mid = l + (r - l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, mid - 1, x);
return binarySearch(arr, mid + 1, r, x);
}
return -1;
}
public static void quickSort(int[] arr, int lo, int hi) {
if (lo >= hi) {
return;
}
int mid = (lo + hi) / 2;
int pivot = arr[mid];
int left = lo;
int right = hi;
while (left <= right) {
while (arr[left] < pivot) {
left++;
}
while (arr[right] > pivot) {
right--;
}
if (left <= right) {
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
left++;
right--;
}
}
quickSort(arr, lo, right);
quickSort(arr, left, hi);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
17,
17,
41,
13,
41,
13,
12,
13,
30,
41,
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,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
40,
18,
13,
13,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
13,
0,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
0,
13,
20,
13,
0,
13,
20,
13,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
2,
2,
18,
13,
2,
13,
17,
13,
13,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
13,
2,
13,
17,
0,
18,
13,
13,
2,
2,
18,
13,
2,
13,
17,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
17,
30,
14,
2,
2,
13,
17,
17,
0,
13,
2,
2,
13,
13,
13,
0,
13,
2,
2,
13,
13,
13,
0,
13,
17,
0,
13,
2,
2,
13,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
20,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
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,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
12,
13,
30,
29,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
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,
20,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
484,
8
],
[
484,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
11,
13
],
[
484,
14
],
[
14,
15
],
[
484,
16
],
[
16,
17
],
[
484,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
20,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
31,
32
],
[
31,
33
],
[
20,
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
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
20,
58
],
[
58,
59
],
[
58,
60
],
[
20,
61
],
[
61,
62
],
[
61,
63
],
[
20,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
83,
90
],
[
77,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
20,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
18,
107
],
[
107,
108
],
[
18,
109
],
[
109,
110
],
[
18,
111
],
[
111,
112
],
[
484,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
115,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
115,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
129,
137
],
[
137,
138
],
[
138,
139
],
[
129,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
146,
152
],
[
145,
153
],
[
115,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
115,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
164,
165
],
[
164,
166
],
[
159,
167
],
[
167,
168
],
[
168,
169
],
[
159,
170
],
[
171,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
174,
177
],
[
177,
178
],
[
177,
179
],
[
171,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
188,
190
],
[
185,
191
],
[
184,
192
],
[
113,
193
],
[
193,
194
],
[
484,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
201,
202
],
[
201,
203
],
[
197,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
204,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
209,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
217,
221
],
[
208,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
225,
226
],
[
225,
227
],
[
224,
228
],
[
208,
229
],
[
229,
230
],
[
229,
231
],
[
197,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
234,
238
],
[
197,
239
],
[
239,
240
],
[
195,
241
],
[
241,
242
],
[
195,
243
],
[
243,
244
],
[
484,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
248,
250
],
[
247,
251
],
[
251,
252
],
[
251,
253
],
[
247,
254
],
[
254,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
254,
259
],
[
259,
260
],
[
259,
261
],
[
254,
262
],
[
262,
263
],
[
263,
264
],
[
254,
265
],
[
266,
266
],
[
266,
267
],
[
267,
268
],
[
267,
269
],
[
247,
270
],
[
270,
271
],
[
271,
272
],
[
245,
273
],
[
273,
274
],
[
0,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
275,
279
],
[
279,
280
],
[
279,
281
],
[
275,
283
],
[
283,
284
],
[
275,
285
],
[
285,
286
],
[
275,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
291,
293
],
[
290,
294
],
[
287,
295
],
[
295,
296
],
[
275,
297
],
[
297,
298
],
[
297,
299
],
[
299,
300
],
[
300,
301
],
[
301,
302
],
[
301,
303
],
[
303,
304
],
[
300,
305
],
[
305,
306
],
[
299,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
307,
311
],
[
311,
312
],
[
312,
313
],
[
312,
314
],
[
311,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
319,
320
],
[
315,
321
],
[
321,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
325,
326
],
[
324,
327
],
[
311,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
328,
332
],
[
332,
333
],
[
333,
334
],
[
299,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
338,
339
],
[
275,
340
],
[
340,
341
],
[
340,
342
],
[
342,
343
],
[
343,
344
],
[
347,
345
],
[
357,
346
],
[
354,
347
],
[
347,
348
],
[
348,
349
],
[
348,
350
],
[
347,
351
],
[
351,
352
],
[
351,
353
],
[
354,
354
],
[
354,
355
],
[
354,
356
],
[
357,
357
],
[
357,
358
],
[
357,
359
],
[
347,
360
],
[
360,
361
],
[
360,
362
],
[
362,
363
],
[
340,
364
],
[
364,
365
],
[
275,
366
],
[
366,
367
],
[
366,
368
],
[
368,
369
],
[
369,
370
],
[
371,
371
],
[
371,
372
],
[
372,
373
],
[
372,
374
],
[
371,
375
],
[
375,
376
],
[
375,
377
],
[
371,
378
],
[
378,
379
],
[
378,
380
],
[
380,
381
],
[
366,
382
],
[
382,
383
],
[
275,
384
],
[
384,
385
],
[
384,
386
],
[
386,
387
],
[
387,
388
],
[
388,
389
],
[
389,
390
],
[
388,
391
],
[
391,
392
],
[
275,
393
],
[
393,
394
],
[
393,
395
],
[
395,
396
],
[
396,
397
],
[
397,
398
],
[
398,
399
],
[
397,
400
],
[
400,
401
],
[
275,
402
],
[
402,
403
],
[
402,
404
],
[
404,
405
],
[
405,
406
],
[
406,
407
],
[
407,
408
],
[
406,
409
],
[
409,
410
],
[
275,
411
],
[
411,
412
],
[
411,
413
],
[
413,
414
],
[
414,
415
],
[
414,
416
],
[
416,
417
],
[
413,
418
],
[
418,
419
],
[
419,
420
],
[
419,
421
],
[
418,
422
],
[
422,
423
],
[
422,
424
],
[
424,
425
],
[
413,
426
],
[
426,
427
],
[
426,
428
],
[
413,
429
],
[
429,
430
],
[
430,
431
],
[
431,
432
],
[
431,
433
],
[
429,
434
],
[
434,
435
],
[
435,
436
],
[
436,
437
],
[
435,
438
],
[
434,
439
],
[
439,
440
],
[
439,
441
],
[
441,
442
],
[
413,
443
],
[
443,
444
],
[
444,
445
],
[
445,
446
],
[
275,
447
],
[
447,
448
],
[
447,
449
],
[
449,
450
],
[
450,
451
],
[
450,
452
],
[
452,
453
],
[
449,
454
],
[
454,
455
],
[
455,
456
],
[
455,
457
],
[
454,
458
],
[
458,
459
],
[
458,
460
],
[
460,
461
],
[
449,
462
],
[
462,
463
],
[
462,
464
],
[
449,
465
],
[
465,
466
],
[
466,
467
],
[
467,
468
],
[
467,
469
],
[
465,
470
],
[
470,
471
],
[
471,
472
],
[
472,
473
],
[
471,
474
],
[
470,
475
],
[
475,
476
],
[
475,
477
],
[
477,
478
],
[
449,
479
],
[
479,
480
],
[
480,
481
],
[
481,
482
],
[
0,
483
],
[
483,
484
],
[
483,
485
]
]
| [
"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n private static final int M = (int)1e9 + 7;\n private long[] fact, invfact;\n\n public Main(FastScanner in, PrintWriter out, int test) {\n int X = in.nextInt();\n int N = in.nextInt();\n boolean[] A = new boolean[201];\n for (int i = 0; i < N; i++) {\n int a = in.nextInt();\n A[a] = true;\n }\n int diff = 200, res = 0;\n for (int i = 0; i <= 200; i++) {\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }\n out.println(res);\n }\n\n private void calcFact(int N) {\n fact = new long[N];\n invfact = new long[N];\n\n fact[0] = 1;\n for (int i = 1; i < N; i++)\n fact[i] = fact[i - 1] * i % M;\n\n invfact[0] = 1;\n for (int i = 1; i < N; i++) {\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }\n }\n\n private long pow(int x, int p) {\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}\n\n\nclass FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream)\n {\n this.stream = stream;\n }\n\n int read()\n {\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 boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n\n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n\n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\n private static final int M = (int)1e9 + 7;\n private long[] fact, invfact;\n\n public Main(FastScanner in, PrintWriter out, int test) {\n int X = in.nextInt();\n int N = in.nextInt();\n boolean[] A = new boolean[201];\n for (int i = 0; i < N; i++) {\n int a = in.nextInt();\n A[a] = true;\n }\n int diff = 200, res = 0;\n for (int i = 0; i <= 200; i++) {\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }\n out.println(res);\n }\n\n private void calcFact(int N) {\n fact = new long[N];\n invfact = new long[N];\n\n fact[0] = 1;\n for (int i = 1; i < N; i++)\n fact[i] = fact[i - 1] * i % M;\n\n invfact[0] = 1;\n for (int i = 1; i < N; i++) {\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }\n }\n\n private long pow(int x, int p) {\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}",
"Main",
"private static final int M = (int)1e9 + 7;",
"M",
"(int)1e9 + 7",
"(int)1e9",
"7",
"private long[] fact",
"fact",
"invfact;",
"invfact",
"public Main(FastScanner in, PrintWriter out, int test) {\n int X = in.nextInt();\n int N = in.nextInt();\n boolean[] A = new boolean[201];\n for (int i = 0; i < N; i++) {\n int a = in.nextInt();\n A[a] = true;\n }\n int diff = 200, res = 0;\n for (int i = 0; i <= 200; i++) {\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }\n out.println(res);\n }",
"Main",
"{\n int X = in.nextInt();\n int N = in.nextInt();\n boolean[] A = new boolean[201];\n for (int i = 0; i < N; i++) {\n int a = in.nextInt();\n A[a] = true;\n }\n int diff = 200, res = 0;\n for (int i = 0; i <= 200; i++) {\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }\n out.println(res);\n }",
"int X = in.nextInt();",
"X",
"in.nextInt()",
"in.nextInt",
"in",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"boolean[] A = new boolean[201];",
"A",
"new boolean[201]",
"201",
"for (int i = 0; i < N; i++) {\n int a = in.nextInt();\n A[a] = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int a = in.nextInt();\n A[a] = true;\n }",
"{\n int a = in.nextInt();\n A[a] = true;\n }",
"int a = in.nextInt();",
"a",
"in.nextInt()",
"in.nextInt",
"in",
"A[a] = true",
"A[a]",
"A",
"a",
"true",
"int diff = 200",
"diff",
"200",
"res = 0;",
"res",
"0",
"for (int i = 0; i <= 200; i++) {\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }",
"{\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }",
"if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }",
"!A[i] && Math.abs(i - X) < diff",
"!A[i]",
"A[i]",
"A",
"i",
"Math.abs(i - X) < diff",
"Math.abs(i - X)",
"Math.abs",
"Math",
"i - X",
"i",
"X",
"diff",
"{\n res = i;\n diff = Math.abs(i - X);\n }",
"res = i",
"res",
"i",
"diff = Math.abs(i - X)",
"diff",
"Math.abs(i - X)",
"Math.abs",
"Math",
"i - X",
"i",
"X",
"out.println(res)",
"out.println",
"out",
"res",
"FastScanner in",
"in",
"PrintWriter out",
"out",
"int test",
"test",
"private void calcFact(int N) {\n fact = new long[N];\n invfact = new long[N];\n\n fact[0] = 1;\n for (int i = 1; i < N; i++)\n fact[i] = fact[i - 1] * i % M;\n\n invfact[0] = 1;\n for (int i = 1; i < N; i++) {\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }\n }",
"calcFact",
"{\n fact = new long[N];\n invfact = new long[N];\n\n fact[0] = 1;\n for (int i = 1; i < N; i++)\n fact[i] = fact[i - 1] * i % M;\n\n invfact[0] = 1;\n for (int i = 1; i < N; i++) {\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }\n }",
"fact = new long[N]",
"fact",
"new long[N]",
"N",
"invfact = new long[N]",
"invfact",
"new long[N]",
"N",
"fact[0] = 1",
"fact[0]",
"fact",
"0",
"1",
"for (int i = 1; i < N; i++)\n fact[i] = fact[i - 1] * i % M;",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"fact[i] = fact[i - 1] * i % M;",
"fact[i] = fact[i - 1] * i % M",
"fact[i]",
"fact",
"i",
"fact[i - 1] * i % M",
"fact[i - 1] * i",
"fact[i - 1]",
"fact",
"i - 1",
"i",
"1",
"i",
"M",
"invfact[0] = 1",
"invfact[0]",
"invfact",
"0",
"1",
"for (int i = 1; i < N; i++) {\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }",
"{\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }",
"long p = pow(i, M - 2);",
"p",
"pow(i, M - 2)",
"pow",
"i",
"M - 2",
"M",
"2",
"invfact[i] = invfact[i - 1] * p % M",
"invfact[i]",
"invfact",
"i",
"invfact[i - 1] * p % M",
"invfact[i - 1] * p",
"invfact[i - 1]",
"invfact",
"i - 1",
"i",
"1",
"p",
"M",
"int N",
"N",
"private long pow(int x, int p) {\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }",
"pow",
"{\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }",
"long res = 1",
"res",
"1",
"a = x;",
"a",
"x",
"while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }",
"p > 1",
"p",
"1",
"{\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }",
"if (p % 2 == 1)\n res = res * a % M;",
"p % 2 == 1",
"p % 2",
"p",
"2",
"1",
"res = res * a % M",
"res",
"res * a % M",
"res * a",
"res",
"a",
"M",
"a = a * a % M",
"a",
"a * a % M",
"a * a",
"a",
"a",
"M",
"p /= 2",
"p",
"2",
"res = res * a % M",
"res",
"res * a % M",
"res * a",
"res",
"a",
"M",
"return res;",
"res",
"int x",
"x",
"int p",
"p",
"public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }",
"main",
"{\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"FastScanner in = new FastScanner(System.in);",
"in",
"new FastScanner(System.in)",
"for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }",
"int t = 1;",
"int t = 1;",
"t",
"1",
"t <= 1",
"t",
"1",
"t++",
"t++",
"t",
"{\n Main sol = new Main(in, out, t);\n }",
"{\n Main sol = new Main(in, out, t);\n }",
"Main sol = new Main(in, out, t);",
"sol",
"new Main(in, out, t)",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"class FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream)\n {\n this.stream = stream;\n }\n\n int read()\n {\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 boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n\n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n\n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n}",
"FastScanner",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"public FastScanner(InputStream stream)\n {\n this.stream = stream;\n }",
"FastScanner",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"int read()\n {\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 }",
"read",
"{\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",
"boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }",
"isSpaceChar",
"{\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",
"boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }",
"isEndline",
"{\n return c=='\\n'||c=='\\r'||c==-1;\n }",
"return c=='\\n'||c=='\\r'||c==-1;",
"c=='\\n'||c=='\\r'||c==-1",
"c=='\\n'||c=='\\r'||c==-1",
"c=='\\n'",
"c",
"'\\n'",
"c=='\\r'",
"c",
"'\\r'",
"c==-1",
"c",
"-1",
"1",
"int c",
"c",
"int nextInt()\n {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong()\n {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nextDouble()\n {\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",
"String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }",
"next",
"{\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c))\n c = read();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = read()",
"c",
"read()",
"read",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n res.appendCodePoint(c);\n c = read();\n }",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = read()",
"c",
"read()",
"read",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }",
"nextLine",
"{\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isEndline(c))\n c = read();",
"isEndline(c)",
"isEndline",
"c",
"c = read()",
"c",
"read()",
"read",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));",
"!isEndline(c)",
"isEndline(c)",
"isEndline",
"c",
"{\n res.appendCodePoint(c);\n c = read();\n }",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = read()",
"c",
"read()",
"read",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"public class Main {\n\n private static final int M = (int)1e9 + 7;\n private long[] fact, invfact;\n\n public Main(FastScanner in, PrintWriter out, int test) {\n int X = in.nextInt();\n int N = in.nextInt();\n boolean[] A = new boolean[201];\n for (int i = 0; i < N; i++) {\n int a = in.nextInt();\n A[a] = true;\n }\n int diff = 200, res = 0;\n for (int i = 0; i <= 200; i++) {\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }\n out.println(res);\n }\n\n private void calcFact(int N) {\n fact = new long[N];\n invfact = new long[N];\n\n fact[0] = 1;\n for (int i = 1; i < N; i++)\n fact[i] = fact[i - 1] * i % M;\n\n invfact[0] = 1;\n for (int i = 1; i < N; i++) {\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }\n }\n\n private long pow(int x, int p) {\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}",
"public class Main {\n\n private static final int M = (int)1e9 + 7;\n private long[] fact, invfact;\n\n public Main(FastScanner in, PrintWriter out, int test) {\n int X = in.nextInt();\n int N = in.nextInt();\n boolean[] A = new boolean[201];\n for (int i = 0; i < N; i++) {\n int a = in.nextInt();\n A[a] = true;\n }\n int diff = 200, res = 0;\n for (int i = 0; i <= 200; i++) {\n if (!A[i] && Math.abs(i - X) < diff) {\n res = i;\n diff = Math.abs(i - X);\n }\n }\n out.println(res);\n }\n\n private void calcFact(int N) {\n fact = new long[N];\n invfact = new long[N];\n\n fact[0] = 1;\n for (int i = 1; i < N; i++)\n fact[i] = fact[i - 1] * i % M;\n\n invfact[0] = 1;\n for (int i = 1; i < N; i++) {\n long p = pow(i, M - 2);\n invfact[i] = invfact[i - 1] * p % M;\n }\n }\n\n private long pow(int x, int p) {\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main {
private static final int M = (int)1e9 + 7;
private long[] fact, invfact;
public Main(FastScanner in, PrintWriter out, int test) {
int X = in.nextInt();
int N = in.nextInt();
boolean[] A = new boolean[201];
for (int i = 0; i < N; i++) {
int a = in.nextInt();
A[a] = true;
}
int diff = 200, res = 0;
for (int i = 0; i <= 200; i++) {
if (!A[i] && Math.abs(i - X) < diff) {
res = i;
diff = Math.abs(i - X);
}
}
out.println(res);
}
private void calcFact(int N) {
fact = new long[N];
invfact = new long[N];
fact[0] = 1;
for (int i = 1; i < N; i++)
fact[i] = fact[i - 1] * i % M;
invfact[0] = 1;
for (int i = 1; i < N; i++) {
long p = pow(i, M - 2);
invfact[i] = invfact[i - 1] * p % M;
}
}
private long pow(int x, int p) {
long res = 1, a = x;
while (p > 1) {
if (p % 2 == 1)
res = res * a % M;
a = a * a % M;
p /= 2;
}
res = res * a % M;
return res;
}
public static void main(String[] args) {
PrintWriter out = new PrintWriter(System.out);
// Scanner in = new Scanner(
// new BufferedReader(new InputStreamReader(System.in)));
FastScanner in = new FastScanner(System.in);
// int T = in.nextInt();
for (int t = 1; t <= 1; t++) {
Main sol = new Main(in, out, t);
}
out.close();
}
}
class FastScanner{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public FastScanner(InputStream stream)
{
this.stream = stream;
}
int read()
{
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars){
curChar = 0;
try{
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
boolean isSpaceChar(int c)
{
return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
}
boolean isEndline(int c)
{
return c=='\n'||c=='\r'||c==-1;
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String next(){
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do{
res.appendCodePoint(c);
c = read();
}while(!isSpaceChar(c));
return res.toString();
}
String nextLine(){
int c = read();
while (isEndline(c))
c = read();
StringBuilder res = new StringBuilder();
do{
res.appendCodePoint(c);
c = read();
}while(!isEndline(c));
return res.toString();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
41,
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,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
18,
13,
13,
30,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
14,
2,
13,
13,
30,
0,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
12,
13,
30,
4,
18,
13,
4,
18,
13,
12,
13,
30,
38,
30,
41,
13,
20,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
222,
23
],
[
222,
24
],
[
24,
25
],
[
24,
26
],
[
222,
27
],
[
27,
28
],
[
27,
29
],
[
222,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
32,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
43,
44
],
[
43,
45
],
[
32,
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
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
59,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
32,
70
],
[
70,
71
],
[
70,
72
],
[
32,
73
],
[
73,
74
],
[
73,
75
],
[
32,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
103,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
121,
125
],
[
32,
126
],
[
126,
127
],
[
127,
128
],
[
126,
129
],
[
222,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
132,
136
],
[
136,
137
],
[
137,
138
],
[
222,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
139,
150
],
[
150,
151
],
[
222,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
152,
156
],
[
156,
157
],
[
152,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
164,
165
],
[
164,
166
],
[
158,
167
],
[
167,
168
],
[
152,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
172,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
186,
187
],
[
182,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
171,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
152,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
200,
203
],
[
203,
204
],
[
152,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
209,
212
],
[
212,
213
],
[
152,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
222,
220
],
[
0,
221
],
[
221,
222
],
[
221,
223
]
]
| [
"\nimport java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main implements Closeable {\n\n private InputReader in = new InputReader(System.in);\n private PrintWriter out = new PrintWriter(System.out);\n\n public void solve() {\n int x = in.ni(), n = in.ni();\n boolean[] forbidden = new boolean[201];\n for (int i = 0; i < n; i++) {\n int next = in.ni();\n forbidden[next] = true;\n }\n int result = 500, diff = 500;\n for (int i = 0; i <= 200; i++) {\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }\n out.println(result);\n }\n\n @Override\n public void close() throws IOException {\n in.close();\n out.close();\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(next());\n }\n\n public long nl() {\n return Long.parseLong(next());\n }\n\n public void close() throws IOException {\n reader.close();\n }\n }\n\n public static void main(String[] args) throws IOException {\n try (Main instance = new Main()) {\n instance.solve();\n }\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.Closeable;",
"Closeable",
"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",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main implements Closeable {\n\n private InputReader in = new InputReader(System.in);\n private PrintWriter out = new PrintWriter(System.out);\n\n public void solve() {\n int x = in.ni(), n = in.ni();\n boolean[] forbidden = new boolean[201];\n for (int i = 0; i < n; i++) {\n int next = in.ni();\n forbidden[next] = true;\n }\n int result = 500, diff = 500;\n for (int i = 0; i <= 200; i++) {\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }\n out.println(result);\n }\n\n @Override\n public void close() throws IOException {\n in.close();\n out.close();\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(next());\n }\n\n public long nl() {\n return Long.parseLong(next());\n }\n\n public void close() throws IOException {\n reader.close();\n }\n }\n\n public static void main(String[] args) throws IOException {\n try (Main instance = new Main()) {\n instance.solve();\n }\n }\n}",
"Main",
"private InputReader in = new InputReader(System.in);",
"in",
"new InputReader(System.in)",
"private PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"public void solve() {\n int x = in.ni(), n = in.ni();\n boolean[] forbidden = new boolean[201];\n for (int i = 0; i < n; i++) {\n int next = in.ni();\n forbidden[next] = true;\n }\n int result = 500, diff = 500;\n for (int i = 0; i <= 200; i++) {\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }\n out.println(result);\n }",
"solve",
"{\n int x = in.ni(), n = in.ni();\n boolean[] forbidden = new boolean[201];\n for (int i = 0; i < n; i++) {\n int next = in.ni();\n forbidden[next] = true;\n }\n int result = 500, diff = 500;\n for (int i = 0; i <= 200; i++) {\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }\n out.println(result);\n }",
"int x = in.ni()",
"x",
"in.ni()",
"in.ni",
"in",
"n = in.ni();",
"n",
"in.ni()",
"in.ni",
"in",
"boolean[] forbidden = new boolean[201];",
"forbidden",
"new boolean[201]",
"201",
"for (int i = 0; i < n; i++) {\n int next = in.ni();\n forbidden[next] = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int next = in.ni();\n forbidden[next] = true;\n }",
"{\n int next = in.ni();\n forbidden[next] = true;\n }",
"int next = in.ni();",
"next",
"in.ni()",
"in.ni",
"in",
"forbidden[next] = true",
"forbidden[next]",
"forbidden",
"next",
"true",
"int result = 500",
"result",
"500",
"diff = 500;",
"diff",
"500",
"for (int i = 0; i <= 200; i++) {\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }",
"{\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }",
"if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }",
"!forbidden[i]",
"forbidden[i]",
"forbidden",
"i",
"{\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }",
"int abs = Math.abs(x - i);",
"abs",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }",
"abs < diff",
"abs",
"diff",
"{\n result = i;\n diff = abs;\n }",
"result = i",
"result",
"i",
"diff = abs",
"diff",
"abs",
"if (abs == diff) {\n result = Math.min(result, i);\n }",
"abs == diff",
"abs",
"diff",
"{\n result = Math.min(result, i);\n }",
"result = Math.min(result, i)",
"result",
"Math.min(result, i)",
"Math.min",
"Math",
"result",
"i",
"out.println(result)",
"out.println",
"out",
"result",
"@Override\n public void close() throws IOException {\n in.close();\n out.close();\n }",
"close",
"{\n in.close();\n out.close();\n }",
"in.close()",
"in.close",
"in",
"out.close()",
"out.close",
"out",
"public static void main(String[] args) throws IOException {\n try (Main instance = new Main()) {\n instance.solve();\n }\n }",
"main",
"{\n try (Main instance = new Main()) {\n instance.solve();\n }\n }",
"try (Main instance = new Main()) {\n instance.solve();\n }",
"{\n instance.solve();\n }",
"Main instance = new Main()",
"Main instance = new Main()",
"new Main()",
"instance.solve()",
"instance.solve",
"instance",
"String[] args",
"args",
"static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(next());\n }\n\n public long nl() {\n return Long.parseLong(next());\n }\n\n public void close() throws IOException {\n reader.close();\n }\n }",
"InputReader",
"public BufferedReader reader;",
"reader",
"public StringTokenizer tokenizer;",
"tokenizer",
"public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"InputReader",
"{\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"reader = new BufferedReader(new InputStreamReader(stream), 32768)",
"reader",
"new BufferedReader(new InputStreamReader(stream), 32768)",
"tokenizer = null",
"tokenizer",
"null",
"InputStream stream",
"stream",
"public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"next",
"{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public int ni() {\n return Integer.parseInt(next());\n }",
"ni",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nl() {\n return Long.parseLong(next());\n }",
"nl",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public void close() throws IOException {\n reader.close();\n }",
"close",
"{\n reader.close();\n }",
"reader.close()",
"reader.close",
"reader",
"Closeable",
"public class Main implements Closeable {\n\n private InputReader in = new InputReader(System.in);\n private PrintWriter out = new PrintWriter(System.out);\n\n public void solve() {\n int x = in.ni(), n = in.ni();\n boolean[] forbidden = new boolean[201];\n for (int i = 0; i < n; i++) {\n int next = in.ni();\n forbidden[next] = true;\n }\n int result = 500, diff = 500;\n for (int i = 0; i <= 200; i++) {\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }\n out.println(result);\n }\n\n @Override\n public void close() throws IOException {\n in.close();\n out.close();\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(next());\n }\n\n public long nl() {\n return Long.parseLong(next());\n }\n\n public void close() throws IOException {\n reader.close();\n }\n }\n\n public static void main(String[] args) throws IOException {\n try (Main instance = new Main()) {\n instance.solve();\n }\n }\n}",
"public class Main implements Closeable {\n\n private InputReader in = new InputReader(System.in);\n private PrintWriter out = new PrintWriter(System.out);\n\n public void solve() {\n int x = in.ni(), n = in.ni();\n boolean[] forbidden = new boolean[201];\n for (int i = 0; i < n; i++) {\n int next = in.ni();\n forbidden[next] = true;\n }\n int result = 500, diff = 500;\n for (int i = 0; i <= 200; i++) {\n if (!forbidden[i]) {\n int abs = Math.abs(x - i);\n if (abs < diff) {\n result = i;\n diff = abs;\n } else if (abs == diff) {\n result = Math.min(result, i);\n }\n }\n }\n out.println(result);\n }\n\n @Override\n public void close() throws IOException {\n in.close();\n out.close();\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(next());\n }\n\n public long nl() {\n return Long.parseLong(next());\n }\n\n public void close() throws IOException {\n reader.close();\n }\n }\n\n public static void main(String[] args) throws IOException {\n try (Main instance = new Main()) {\n instance.solve();\n }\n }\n}",
"Main"
]
|
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main implements Closeable {
private InputReader in = new InputReader(System.in);
private PrintWriter out = new PrintWriter(System.out);
public void solve() {
int x = in.ni(), n = in.ni();
boolean[] forbidden = new boolean[201];
for (int i = 0; i < n; i++) {
int next = in.ni();
forbidden[next] = true;
}
int result = 500, diff = 500;
for (int i = 0; i <= 200; i++) {
if (!forbidden[i]) {
int abs = Math.abs(x - i);
if (abs < diff) {
result = i;
diff = abs;
} else if (abs == diff) {
result = Math.min(result, i);
}
}
}
out.println(result);
}
@Override
public void close() throws IOException {
in.close();
out.close();
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int ni() {
return Integer.parseInt(next());
}
public long nl() {
return Long.parseLong(next());
}
public void close() throws IOException {
reader.close();
}
}
public static void main(String[] args) throws IOException {
try (Main instance = new Main()) {
instance.solve();
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.