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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
3,
14,
2,
18,
13,
2,
13,
13,
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
],
[
101,
5
],
[
101,
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
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
63,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
61,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
6,
98
],
[
98,
99
],
[
0,
100
],
[
100,
101
],
[
100,
102
]
]
| [
"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 int[] Pz = new int[1000];\n for (int i = 0; i < N; i++){\n Pz[sc.nextInt()] = 1;\n }\n// Pz.sort();\n int ans = 0;\n for (int i = 0; i < 101; i++){\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\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 int X = sc.nextInt();\n int N = sc.nextInt();\n int[] Pz = new int[1000];\n for (int i = 0; i < N; i++){\n Pz[sc.nextInt()] = 1;\n }\n// Pz.sort();\n int ans = 0;\n for (int i = 0; i < 101; i++){\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\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 int[] Pz = new int[1000];\n for (int i = 0; i < N; i++){\n Pz[sc.nextInt()] = 1;\n }\n// Pz.sort();\n int ans = 0;\n for (int i = 0; i < 101; i++){\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\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 int[] Pz = new int[1000];\n for (int i = 0; i < N; i++){\n Pz[sc.nextInt()] = 1;\n }\n// Pz.sort();\n int ans = 0;\n for (int i = 0; i < 101; i++){\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\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[] Pz = new int[1000];",
"Pz",
"new int[1000]",
"1000",
"for (int i = 0; i < N; i++){\n Pz[sc.nextInt()] = 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n Pz[sc.nextInt()] = 1;\n }",
"{\n Pz[sc.nextInt()] = 1;\n }",
"Pz[sc.nextInt()] = 1",
"Pz[sc.nextInt()]",
"Pz",
"sc.nextInt()",
"sc.nextInt",
"sc",
"1",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < 101; i++){\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\n }\n }",
"{\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\n }\n }",
"if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }",
"Pz[X - i] != 1",
"Pz[X - i]",
"Pz",
"X - i",
"X",
"i",
"1",
"{\n ans = X - i;\n break;\n }",
"ans = X - i",
"ans",
"X - i",
"X",
"i",
"break;",
"if (Pz[X + i] != 1){\n ans = X + i;\n break;\n }",
"Pz[X + i] != 1",
"Pz[X + i]",
"Pz",
"X + i",
"X",
"i",
"1",
"{\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",
"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[] Pz = new int[1000];\n for (int i = 0; i < N; i++){\n Pz[sc.nextInt()] = 1;\n }\n// Pz.sort();\n int ans = 0;\n for (int i = 0; i < 101; i++){\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\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 int[] Pz = new int[1000];\n for (int i = 0; i < N; i++){\n Pz[sc.nextInt()] = 1;\n }\n// Pz.sort();\n int ans = 0;\n for (int i = 0; i < 101; i++){\n\n if (Pz[X - i] != 1){\n ans = X - i;\n break;\n }\n// if (X + i > 100){\n// continue;\n// }\n if (Pz[X + i] != 1){\n ans = X + i;\n break;\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();
int[] Pz = new int[1000];
for (int i = 0; i < N; i++){
Pz[sc.nextInt()] = 1;
}
// Pz.sort();
int ans = 0;
for (int i = 0; i < 101; i++){
if (Pz[X - i] != 1){
ans = X - i;
break;
}
// if (X + i > 100){
// continue;
// }
if (Pz[X + i] != 1){
ans = X + i;
break;
}
}
System.out.println(ans);
}
} |
[
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,
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,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
94,
5
],
[
94,
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
],
[
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
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
44,
53
],
[
54,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
63,
72
],
[
55,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
87,
89
],
[
81,
90
],
[
6,
91
],
[
91,
92
],
[
0,
93
],
[
93,
94
],
[
93,
95
]
]
| [
"import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n \tScanner sc=new Scanner(System.in);\n \tLinkedList<Integer> l=new LinkedList<>();\n \tint x=sc.nextInt();\n \tint n=sc.nextInt();\n \tfor(int i=0;i<n;i++) {\n \t\tl.add(sc.nextInt());\n \t}\n \tfor(int i=0;true;i++) {\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String[] args){\n \tScanner sc=new Scanner(System.in);\n \tLinkedList<Integer> l=new LinkedList<>();\n \tint x=sc.nextInt();\n \tint n=sc.nextInt();\n \tfor(int i=0;i<n;i++) {\n \t\tl.add(sc.nextInt());\n \t}\n \tfor(int i=0;true;i++) {\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}\n }\n}",
"Main",
"public static void main(String[] args){\n \tScanner sc=new Scanner(System.in);\n \tLinkedList<Integer> l=new LinkedList<>();\n \tint x=sc.nextInt();\n \tint n=sc.nextInt();\n \tfor(int i=0;i<n;i++) {\n \t\tl.add(sc.nextInt());\n \t}\n \tfor(int i=0;true;i++) {\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}\n }",
"main",
"{\n \tScanner sc=new Scanner(System.in);\n \tLinkedList<Integer> l=new LinkedList<>();\n \tint x=sc.nextInt();\n \tint n=sc.nextInt();\n \tfor(int i=0;i<n;i++) {\n \t\tl.add(sc.nextInt());\n \t}\n \tfor(int i=0;true;i++) {\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"LinkedList<Integer> l=new LinkedList<>();",
"l",
"new LinkedList<>()",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<n;i++) {\n \t\tl.add(sc.nextInt());\n \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \t\tl.add(sc.nextInt());\n \t}",
"{\n \t\tl.add(sc.nextInt());\n \t}",
"l.add(sc.nextInt())",
"l.add",
"l",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;true;i++) {\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"true",
"i++",
"i++",
"i",
"{\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}",
"{\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}",
"if(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}",
"!l.contains(x-i)",
"l.contains(x-i)",
"l.contains",
"l",
"x-i",
"x",
"i",
"{\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"break;",
"if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}",
"!l.contains(x+i)",
"l.contains(x+i)",
"l.contains",
"l",
"x+i",
"x",
"i",
"{\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \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 \tScanner sc=new Scanner(System.in);\n \tLinkedList<Integer> l=new LinkedList<>();\n \tint x=sc.nextInt();\n \tint n=sc.nextInt();\n \tfor(int i=0;i<n;i++) {\n \t\tl.add(sc.nextInt());\n \t}\n \tfor(int i=0;true;i++) {\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\n \t\t}\n \t}\n }\n}",
"public class Main{\n\tpublic static void main(String[] args){\n \tScanner sc=new Scanner(System.in);\n \tLinkedList<Integer> l=new LinkedList<>();\n \tint x=sc.nextInt();\n \tint n=sc.nextInt();\n \tfor(int i=0;i<n;i++) {\n \t\tl.add(sc.nextInt());\n \t}\n \tfor(int i=0;true;i++) {\n \t\tif(!l.contains(x-i)) {\n \t\t\tSystem.out.println(x-i);\n \t\t\tbreak;\n \t\t}\n \t\telse if(!l.contains(x+i)) {\n \t\t\tSystem.out.println(x+i);\n \t\t\tbreak;\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);
LinkedList<Integer> l=new LinkedList<>();
int x=sc.nextInt();
int n=sc.nextInt();
for(int i=0;i<n;i++) {
l.add(sc.nextInt());
}
for(int i=0;true;i++) {
if(!l.contains(x-i)) {
System.out.println(x-i);
break;
}
else if(!l.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,
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,
29,
41,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
40,
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,
41,
13,
17,
0,
13,
18,
13,
13,
11,
1,
41,
13,
17,
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,
4,
18,
18,
13,
13,
4,
18,
13,
13,
13,
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
],
[
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
],
[
51,
58
],
[
11,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
11,
64
],
[
64,
65
],
[
64,
66
],
[
11,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
67,
73
],
[
73,
74
],
[
73,
75
],
[
67,
76
],
[
76,
77
],
[
77,
78
],
[
67,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
81,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
94,
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
],
[
11,
109
],
[
109,
110
],
[
109,
111
],
[
11,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
11,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
117,
126
],
[
126,
127
],
[
127,
128
],
[
117,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
144,
145
],
[
144,
146
],
[
138,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
153,
154
],
[
153,
155
],
[
147,
156
],
[
156,
157
],
[
156,
158
],
[
11,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
164,
168
],
[
9,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
]
| [
"import java.util.ArrayList;\nimport java.util.Scanner;\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<>();\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if(x == 0) {\n System.out.println(x);\n return;\n }\n int min = Integer.MAX_VALUE;\n int ans1 = 0;\n for (int i = -101; i <= 101; i++) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }\n int ans2 = 0;\n min = Integer.MAX_VALUE;\n for (int i = 101; i >= -101; i--) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }\n System.out.println(Math.min(ans1, ans2));\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 Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if(x == 0) {\n System.out.println(x);\n return;\n }\n int min = Integer.MAX_VALUE;\n int ans1 = 0;\n for (int i = -101; i <= 101; i++) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }\n int ans2 = 0;\n min = Integer.MAX_VALUE;\n for (int i = 101; i >= -101; i--) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }\n System.out.println(Math.min(ans1, ans2));\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<>();\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if(x == 0) {\n System.out.println(x);\n return;\n }\n int min = Integer.MAX_VALUE;\n int ans1 = 0;\n for (int i = -101; i <= 101; i++) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }\n int ans2 = 0;\n min = Integer.MAX_VALUE;\n for (int i = 101; i >= -101; i--) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }\n System.out.println(Math.min(ans1, ans2));\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<>();\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if(x == 0) {\n System.out.println(x);\n return;\n }\n int min = Integer.MAX_VALUE;\n int ans1 = 0;\n for (int i = -101; i <= 101; i++) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }\n int ans2 = 0;\n min = Integer.MAX_VALUE;\n for (int i = 101; i >= -101; i--) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }\n System.out.println(Math.min(ans1, ans2));\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<>();",
"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",
"if(x == 0) {\n System.out.println(x);\n return;\n }",
"x == 0",
"x",
"0",
"{\n System.out.println(x);\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"return;",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int ans1 = 0;",
"ans1",
"0",
"for (int i = -101; i <= 101; i++) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }",
"int i = -101;",
"int i = -101;",
"i",
"-101",
"101",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }",
"{\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }",
"if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }",
"!list.contains(i)",
"list.contains(i)",
"list.contains",
"list",
"i",
"{\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }",
"if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }",
"min > Math.abs(i - x)",
"min",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"{\n min = Math.abs(i - x);\n ans1 = i;\n }",
"min = Math.abs(i - x)",
"min",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"ans1 = i",
"ans1",
"i",
"int ans2 = 0;",
"ans2",
"0",
"min = Integer.MAX_VALUE",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for (int i = 101; i >= -101; i--) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }",
"int i = 101;",
"int i = 101;",
"i",
"101",
"i >= -101",
"i",
"-101",
"101",
"i--",
"i--",
"i",
"{\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }",
"{\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }",
"if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }",
"!list.contains(i)",
"list.contains(i)",
"list.contains",
"list",
"i",
"{\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }",
"if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }",
"min > Math.abs(i - x)",
"min",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"{\n min = Math.abs(i - x);\n ans2 = i;\n }",
"min = Math.abs(i - x)",
"min",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"ans2 = i",
"ans2",
"i",
"System.out.println(Math.min(ans1, ans2))",
"System.out.println",
"System.out",
"System",
"System.out",
"Math.min(ans1, ans2)",
"Math.min",
"Math",
"ans1",
"ans2",
"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<>();\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if(x == 0) {\n System.out.println(x);\n return;\n }\n int min = Integer.MAX_VALUE;\n int ans1 = 0;\n for (int i = -101; i <= 101; i++) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }\n int ans2 = 0;\n min = Integer.MAX_VALUE;\n for (int i = 101; i >= -101; i--) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }\n System.out.println(Math.min(ans1, ans2));\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<>();\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if(x == 0) {\n System.out.println(x);\n return;\n }\n int min = Integer.MAX_VALUE;\n int ans1 = 0;\n for (int i = -101; i <= 101; i++) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans1 = i;\n }\n }\n }\n int ans2 = 0;\n min = Integer.MAX_VALUE;\n for (int i = 101; i >= -101; i--) {\n if(!list.contains(i)) {\n if(min > Math.abs(i - x)) {\n min = Math.abs(i - x);\n ans2 = i;\n }\n }\n }\n System.out.println(Math.min(ans1, ans2));\n }\n}",
"Main"
]
| import java.util.ArrayList;
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();
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
if(x == 0) {
System.out.println(x);
return;
}
int min = Integer.MAX_VALUE;
int ans1 = 0;
for (int i = -101; i <= 101; i++) {
if(!list.contains(i)) {
if(min > Math.abs(i - x)) {
min = Math.abs(i - x);
ans1 = i;
}
}
}
int ans2 = 0;
min = Integer.MAX_VALUE;
for (int i = 101; i >= -101; i--) {
if(!list.contains(i)) {
if(min > Math.abs(i - x)) {
min = Math.abs(i - x);
ans2 = i;
}
}
}
System.out.println(Math.min(ans1, ans2));
}
} |
[
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,
13,
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,
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,
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
],
[
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
],
[
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
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
74,
80
],
[
65,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
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\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\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\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n\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\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\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\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\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> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"int ans = x;",
"ans",
"x",
"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",
"for (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}",
"int dif = 0;",
"int dif = 0;",
"dif",
"0",
"dif <= n",
"dif",
"n",
"dif++",
"dif++",
"dif",
"{\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}",
"{\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}",
"if (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x - dif)",
"list.contains(x - dif)",
"list.contains",
"list",
"x - dif",
"x",
"dif",
"{\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;",
"if (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x + dif)",
"list.contains(x + dif)",
"list.contains",
"list",
"x + dif",
"x",
"dif",
"{\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;",
"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\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n\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\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(ans);\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) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
List<Integer> list = new ArrayList<>();
int ans = x;
for (int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
for (int dif = 0; dif <= n; dif++) {
//x-difがリストに無いとき
if (!list.contains(x - dif)) {
ans = x - dif;
break;
}
//x+difがリストに無いとき
if (!list.contains(x + dif)) {
ans = x + dif;
break;
}
}
System.out.println(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,
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,
20,
41,
13,
20,
41,
13,
20,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
14,
2,
13,
17,
30,
4,
18,
13,
13,
29,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
4,
18,
13,
13,
9,
14,
2,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
12,
13,
30,
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,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
18,
13,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
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,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
18,
13,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
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,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
18,
13,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
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
],
[
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
],
[
46,
47
],
[
46,
48
],
[
0,
49
],
[
49,
50
],
[
49,
51
],
[
0,
52
],
[
52,
53
],
[
52,
54
],
[
0,
55
],
[
55,
56
],
[
55,
57
],
[
0,
58
],
[
58,
59
],
[
58,
60
],
[
0,
61
],
[
61,
62
],
[
61,
63
],
[
0,
64
],
[
64,
65
],
[
64,
66
],
[
0,
67
],
[
689,
68
],
[
689,
69
],
[
69,
70
],
[
69,
71
],
[
689,
72
],
[
72,
73
],
[
72,
74
],
[
689,
75
],
[
75,
76
],
[
75,
77
],
[
689,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
80,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
78,
92
],
[
92,
93
],
[
689,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
96,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
109,
114
],
[
96,
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
],
[
128,
131
],
[
131,
132
],
[
96,
133
],
[
133,
134
],
[
133,
135
],
[
96,
136
],
[
136,
137
],
[
136,
138
],
[
96,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
144,
146
],
[
139,
147
],
[
147,
148
],
[
148,
149
],
[
139,
150
],
[
151,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
152,
157
],
[
151,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
164,
165
],
[
164,
166
],
[
158,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
170,
173
],
[
173,
174
],
[
173,
175
],
[
167,
176
],
[
176,
177
],
[
176,
178
],
[
96,
179
],
[
179,
180
],
[
180,
181
],
[
179,
182
],
[
689,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
689,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
192,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
197,
202
],
[
202,
203
],
[
202,
204
],
[
197,
205
],
[
205,
206
],
[
206,
207
],
[
197,
208
],
[
209,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
214,
215
],
[
192,
216
],
[
216,
217
],
[
190,
218
],
[
218,
219
],
[
689,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
228,
233
],
[
233,
234
],
[
233,
235
],
[
228,
236
],
[
236,
237
],
[
237,
238
],
[
228,
239
],
[
240,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
241,
246
],
[
246,
247
],
[
246,
248
],
[
241,
249
],
[
249,
250
],
[
250,
251
],
[
241,
252
],
[
253,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
255,
259
],
[
254,
260
],
[
260,
261
],
[
222,
262
],
[
262,
263
],
[
220,
264
],
[
264,
265
],
[
220,
266
],
[
266,
267
],
[
689,
268
],
[
268,
269
],
[
268,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
689,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
277,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
282,
287
],
[
287,
288
],
[
287,
289
],
[
282,
290
],
[
290,
291
],
[
291,
292
],
[
282,
293
],
[
294,
294
],
[
294,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
295,
299
],
[
299,
300
],
[
277,
301
],
[
301,
302
],
[
275,
303
],
[
303,
304
],
[
689,
305
],
[
305,
306
],
[
305,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
307,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
313,
318
],
[
318,
319
],
[
318,
320
],
[
313,
321
],
[
321,
322
],
[
322,
323
],
[
313,
324
],
[
325,
325
],
[
325,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
326,
331
],
[
331,
332
],
[
331,
333
],
[
326,
334
],
[
334,
335
],
[
335,
336
],
[
326,
337
],
[
338,
338
],
[
338,
339
],
[
339,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
340,
344
],
[
339,
345
],
[
345,
346
],
[
307,
347
],
[
347,
348
],
[
305,
349
],
[
349,
350
],
[
305,
351
],
[
351,
352
],
[
689,
353
],
[
353,
354
],
[
353,
355
],
[
355,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
689,
360
],
[
360,
361
],
[
360,
362
],
[
362,
363
],
[
363,
364
],
[
363,
365
],
[
362,
367
],
[
367,
368
],
[
368,
369
],
[
369,
370
],
[
369,
371
],
[
367,
372
],
[
372,
373
],
[
372,
374
],
[
367,
375
],
[
375,
376
],
[
376,
377
],
[
367,
378
],
[
379,
379
],
[
379,
380
],
[
380,
381
],
[
381,
382
],
[
381,
383
],
[
380,
384
],
[
384,
385
],
[
362,
386
],
[
386,
387
],
[
360,
388
],
[
388,
389
],
[
689,
390
],
[
390,
391
],
[
390,
392
],
[
392,
393
],
[
393,
394
],
[
393,
395
],
[
392,
398
],
[
398,
399
],
[
399,
400
],
[
400,
401
],
[
400,
402
],
[
398,
403
],
[
403,
404
],
[
403,
405
],
[
398,
406
],
[
406,
407
],
[
407,
408
],
[
398,
409
],
[
410,
410
],
[
410,
411
],
[
411,
412
],
[
412,
413
],
[
413,
414
],
[
413,
415
],
[
411,
416
],
[
416,
417
],
[
416,
418
],
[
411,
419
],
[
419,
420
],
[
420,
421
],
[
411,
422
],
[
423,
423
],
[
423,
424
],
[
424,
425
],
[
425,
426
],
[
426,
427
],
[
426,
428
],
[
425,
429
],
[
424,
430
],
[
430,
431
],
[
392,
432
],
[
432,
433
],
[
390,
434
],
[
434,
435
],
[
390,
436
],
[
436,
437
],
[
0,
438
],
[
438,
439
],
[
438,
440
],
[
440,
441
],
[
440,
442
],
[
442,
443
],
[
442,
444
],
[
438,
445
],
[
445,
446
],
[
445,
447
],
[
438,
449
],
[
449,
450
],
[
449,
451
],
[
438,
452
],
[
452,
453
],
[
452,
454
],
[
438,
455
],
[
455,
456
],
[
455,
457
],
[
457,
458
],
[
458,
459
],
[
459,
460
],
[
459,
461
],
[
458,
462
],
[
462,
463
],
[
463,
464
],
[
458,
465
],
[
465,
466
],
[
466,
467
],
[
466,
468
],
[
465,
469
],
[
469,
470
],
[
470,
471
],
[
470,
472
],
[
472,
473
],
[
473,
474
],
[
474,
475
],
[
469,
476
],
[
476,
477
],
[
477,
478
],
[
477,
479
],
[
479,
480
],
[
480,
481
],
[
479,
482
],
[
465,
483
],
[
483,
484
],
[
484,
485
],
[
484,
486
],
[
483,
487
],
[
487,
488
],
[
488,
489
],
[
457,
490
],
[
490,
491
],
[
438,
492
],
[
492,
493
],
[
492,
494
],
[
494,
495
],
[
495,
496
],
[
496,
497
],
[
495,
498
],
[
498,
499
],
[
499,
500
],
[
499,
501
],
[
501,
502
],
[
495,
503
],
[
503,
504
],
[
504,
505
],
[
438,
506
],
[
506,
507
],
[
506,
508
],
[
508,
509
],
[
509,
510
],
[
510,
511
],
[
511,
512
],
[
511,
513
],
[
510,
514
],
[
514,
515
],
[
514,
516
],
[
506,
517
],
[
517,
518
],
[
438,
519
],
[
519,
520
],
[
519,
521
],
[
521,
522
],
[
522,
523
],
[
523,
524
],
[
524,
525
],
[
523,
526
],
[
526,
527
],
[
527,
528
],
[
527,
529
],
[
529,
530
],
[
529,
531
],
[
522,
532
],
[
532,
533
],
[
521,
534
],
[
534,
535
],
[
535,
536
],
[
438,
537
],
[
537,
538
],
[
537,
539
],
[
539,
540
],
[
540,
541
],
[
541,
542
],
[
542,
543
],
[
540,
544
],
[
544,
545
],
[
539,
546
],
[
546,
547
],
[
546,
548
],
[
539,
549
],
[
549,
550
],
[
549,
551
],
[
551,
552
],
[
539,
553
],
[
553,
554
],
[
554,
555
],
[
554,
556
],
[
553,
557
],
[
557,
558
],
[
558,
559
],
[
559,
560
],
[
558,
561
],
[
557,
562
],
[
562,
563
],
[
562,
564
],
[
564,
565
],
[
539,
566
],
[
566,
567
],
[
567,
568
],
[
568,
569
],
[
438,
570
],
[
570,
571
],
[
570,
572
],
[
572,
573
],
[
573,
574
],
[
574,
575
],
[
575,
576
],
[
573,
577
],
[
577,
578
],
[
572,
579
],
[
579,
580
],
[
579,
581
],
[
572,
582
],
[
582,
583
],
[
582,
584
],
[
572,
585
],
[
585,
586
],
[
585,
587
],
[
587,
588
],
[
572,
589
],
[
589,
590
],
[
590,
591
],
[
590,
592
],
[
589,
593
],
[
593,
594
],
[
594,
595
],
[
594,
596
],
[
593,
597
],
[
597,
598
],
[
597,
599
],
[
599,
600
],
[
572,
601
],
[
601,
602
],
[
602,
603
],
[
603,
604
],
[
603,
605
],
[
602,
606
],
[
606,
607
],
[
606,
608
],
[
601,
609
],
[
609,
610
],
[
610,
611
],
[
572,
612
],
[
612,
613
],
[
612,
614
],
[
614,
615
],
[
615,
616
],
[
616,
617
],
[
617,
618
],
[
617,
619
],
[
616,
620
],
[
620,
621
],
[
620,
622
],
[
615,
623
],
[
623,
624
],
[
624,
625
],
[
624,
626
],
[
623,
627
],
[
627,
628
],
[
627,
629
],
[
629,
630
],
[
629,
631
],
[
615,
632
],
[
632,
633
],
[
633,
634
],
[
634,
635
],
[
634,
636
],
[
636,
637
],
[
633,
638
],
[
638,
639
],
[
639,
640
],
[
639,
641
],
[
632,
642
],
[
642,
643
],
[
643,
644
],
[
644,
645
],
[
644,
646
],
[
646,
647
],
[
644,
648
],
[
632,
649
],
[
649,
650
],
[
650,
651
],
[
614,
652
],
[
652,
653
],
[
652,
654
],
[
654,
655
],
[
438,
656
],
[
656,
657
],
[
656,
658
],
[
658,
659
],
[
659,
660
],
[
659,
661
],
[
661,
662
],
[
658,
663
],
[
663,
664
],
[
664,
665
],
[
665,
666
],
[
665,
667
],
[
667,
668
],
[
667,
669
],
[
664,
670
],
[
670,
671
],
[
670,
672
],
[
672,
673
],
[
672,
674
],
[
663,
675
],
[
675,
676
],
[
658,
677
],
[
677,
678
],
[
438,
679
],
[
679,
680
],
[
679,
681
],
[
681,
682
],
[
682,
683
],
[
683,
684
],
[
684,
685
],
[
683,
686
],
[
686,
687
],
[
0,
688
],
[
688,
689
],
[
688,
690
]
]
| [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.net.ConnectException;\nimport java.rmi.dgc.Lease;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Deque;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\nimport java.util.PriorityQueue;\nimport java.util.Set;\nimport java.util.Stack;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\nimport static java.util.Comparator.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.solve();\n\t\tmain.out.close();\n\t}\n\n\t// ======================================================================\n\tSet<Integer> set = new HashSet<>();\n\tpublic void solve() {\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tif(N == 0) {\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < N; i++)\t{\t\n\t\t\tset.add(ni());\n\t\t}\n\t\tint ans = 0, sv = 200;\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t// ------------------------------------------\n\t// ライブラリ\n\t// ------------------------------------------\n\t// Print\n\tprivate PrintWriter out = new PrintWriter(System.out);\n\n\t// Scanner\n\tprivate FastScanner scan = new FastScanner();\n\n\tint ni() {\n\t\treturn scan.nextInt();\n\t}\n\n\tint[] ni(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\t}\n\t\treturn a;\n\t}\n\n\tint[][] ni(int y, int x) {\n\t\tint[][] a = new int[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tlong nl() {\n\t\treturn scan.nextLong();\n\t}\n\n\tlong[] nl(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\t}\n\t\treturn a;\n\t}\n\n\tlong[][] nl(int y, int x) {\n\t\tlong[][] a = new long[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tString ns() {\n\t\treturn scan.next();\n\t}\n\n\tString[] ns(int n) {\n\t\tString[] a = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = ns();\n\t\t}\n\t\treturn a;\n\t}\n\n\tString[][] ns(int y, int x) {\n\t\tString[][] a = new String[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n}\n\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.net.ConnectException;",
"ConnectException",
"java.net",
"import java.rmi.dgc.Lease;",
"Lease",
"java.rmi.dgc",
"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.Deque;",
"Deque",
"java.util",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"import java.util.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"import java.util.Objects;",
"Objects",
"java.util",
"import java.util.PriorityQueue;",
"PriorityQueue",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"import java.util.Stack;",
"Stack",
"java.util",
"import java.util.TreeMap;",
"TreeMap",
"java.util",
"import java.util.TreeSet;",
"TreeSet",
"java.util",
"import static java.util.Comparator.*;",
"import static java.util.Comparator.*;",
"import static java.util.Comparator.*;",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.solve();\n\t\tmain.out.close();\n\t}\n\n\t// ======================================================================\n\tSet<Integer> set = new HashSet<>();\n\tpublic void solve() {\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tif(N == 0) {\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < N; i++)\t{\t\n\t\t\tset.add(ni());\n\t\t}\n\t\tint ans = 0, sv = 200;\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t// ------------------------------------------\n\t// ライブラリ\n\t// ------------------------------------------\n\t// Print\n\tprivate PrintWriter out = new PrintWriter(System.out);\n\n\t// Scanner\n\tprivate FastScanner scan = new FastScanner();\n\n\tint ni() {\n\t\treturn scan.nextInt();\n\t}\n\n\tint[] ni(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\t}\n\t\treturn a;\n\t}\n\n\tint[][] ni(int y, int x) {\n\t\tint[][] a = new int[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tlong nl() {\n\t\treturn scan.nextLong();\n\t}\n\n\tlong[] nl(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\t}\n\t\treturn a;\n\t}\n\n\tlong[][] nl(int y, int x) {\n\t\tlong[][] a = new long[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tString ns() {\n\t\treturn scan.next();\n\t}\n\n\tString[] ns(int n) {\n\t\tString[] a = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = ns();\n\t\t}\n\t\treturn a;\n\t}\n\n\tString[][] ns(int y, int x) {\n\t\tString[][] a = new String[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n}",
"Main",
"// ======================================================================\n\tSet<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"// ------------------------------------------\n\t// ライブラリ\n\t// ------------------------------------------\n\t// Print\n\tprivate PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"// Scanner\n\tprivate FastScanner scan = new FastScanner();",
"scan",
"new FastScanner()",
"public static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.solve();\n\t\tmain.out.close();\n\t}",
"main",
"{\n\t\tMain main = new Main();\n\t\tmain.solve();\n\t\tmain.out.close();\n\t}",
"Main main = new Main();",
"main",
"new Main()",
"main.solve()",
"main.solve",
"main",
"main.out.close()",
"main.out.close",
"main.out",
"main",
"main.out",
"String[] args",
"args",
"public void solve() {\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tif(N == 0) {\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < N; i++)\t{\t\n\t\t\tset.add(ni());\n\t\t}\n\t\tint ans = 0, sv = 200;\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}",
"solve",
"{\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tif(N == 0) {\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < N; i++)\t{\t\n\t\t\tset.add(ni());\n\t\t}\n\t\tint ans = 0, sv = 200;\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}",
"int X = ni();",
"X",
"ni()",
"ni",
"int N = ni();",
"N",
"ni()",
"ni",
"if(N == 0) {\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}",
"N == 0",
"N",
"0",
"{\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}",
"out.println(X)",
"out.println",
"out",
"X",
"return;",
"for (int i = 0; i < N; i++)\t{\t\n\t\t\tset.add(ni());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\t\n\t\t\tset.add(ni());\n\t\t}",
"{\t\n\t\t\tset.add(ni());\n\t\t}",
"set.add(ni())",
"set.add",
"set",
"ni()",
"ni",
"int ans = 0",
"ans",
"0",
"sv = 200;",
"sv",
"200",
"for (int i = 0; i <= 101; i++) {\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\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(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}",
"if(set.contains(i))\t\tcontinue;",
"set.contains(i)",
"set.contains",
"set",
"i",
"continue;",
"if(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}",
"sv > Math.abs(i - X)",
"sv",
"Math.abs(i - X)",
"Math.abs",
"Math",
"i - X",
"i",
"X",
"{\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}",
"sv = Math.abs(i - X)",
"sv",
"Math.abs(i - X)",
"Math.abs",
"Math",
"i - X",
"i",
"X",
"ans = i",
"ans",
"i",
"out.println(ans)",
"out.println",
"out",
"ans",
"int ni() {\n\t\treturn scan.nextInt();\n\t}",
"ni",
"{\n\t\treturn scan.nextInt();\n\t}",
"return scan.nextInt();",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] ni(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\t}\n\t\treturn a;\n\t}",
"ni",
"{\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = ni();\n\t\t}\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();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = ni();\n\t\t}",
"{\n\t\t\ta[i] = ni();\n\t\t}",
"a[i] = ni()",
"a[i]",
"a",
"i",
"ni()",
"ni",
"return a;",
"a",
"int n",
"n",
"int[][] ni(int y, int x) {\n\t\tint[][] a = new int[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}",
"ni",
"{\n\t\tint[][] a = new int[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}",
"int[][] a = new int[y][x];",
"a",
"new int[y][x]",
"y",
"x",
"for (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < y",
"i",
"y",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}",
"for (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < x",
"j",
"x",
"j++",
"j++",
"j",
"{\n\t\t\t\ta[i][j] = ni();\n\t\t\t}",
"{\n\t\t\t\ta[i][j] = ni();\n\t\t\t}",
"a[i][j] = ni()",
"a[i][j]",
"a[i]",
"a",
"i",
"j",
"ni()",
"ni",
"return a;",
"a",
"int y",
"y",
"int x",
"x",
"long nl() {\n\t\treturn scan.nextLong();\n\t}",
"nl",
"{\n\t\treturn scan.nextLong();\n\t}",
"return scan.nextLong();",
"scan.nextLong()",
"scan.nextLong",
"scan",
"long[] nl(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\t}\n\t\treturn a;\n\t}",
"nl",
"{\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = nl();\n\t\t}\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();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = nl();\n\t\t}",
"{\n\t\t\ta[i] = nl();\n\t\t}",
"a[i] = nl()",
"a[i]",
"a",
"i",
"nl()",
"nl",
"return a;",
"a",
"int n",
"n",
"long[][] nl(int y, int x) {\n\t\tlong[][] a = new long[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}",
"nl",
"{\n\t\tlong[][] a = new long[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}",
"long[][] a = new long[y][x];",
"a",
"new long[y][x]",
"y",
"x",
"for (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < y",
"i",
"y",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}",
"for (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < x",
"j",
"x",
"j++",
"j++",
"j",
"{\n\t\t\t\ta[i][j] = nl();\n\t\t\t}",
"{\n\t\t\t\ta[i][j] = nl();\n\t\t\t}",
"a[i][j] = nl()",
"a[i][j]",
"a[i]",
"a",
"i",
"j",
"nl()",
"nl",
"return a;",
"a",
"int y",
"y",
"int x",
"x",
"String ns() {\n\t\treturn scan.next();\n\t}",
"ns",
"{\n\t\treturn scan.next();\n\t}",
"return scan.next();",
"scan.next()",
"scan.next",
"scan",
"String[] ns(int n) {\n\t\tString[] a = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = ns();\n\t\t}\n\t\treturn a;\n\t}",
"ns",
"{\n\t\tString[] a = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = ns();\n\t\t}\n\t\treturn a;\n\t}",
"String[] a = new String[n];",
"a",
"new String[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = ns();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = ns();\n\t\t}",
"{\n\t\t\ta[i] = ns();\n\t\t}",
"a[i] = ns()",
"a[i]",
"a",
"i",
"ns()",
"ns",
"return a;",
"a",
"int n",
"n",
"String[][] ns(int y, int x) {\n\t\tString[][] a = new String[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}",
"ns",
"{\n\t\tString[][] a = new String[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}",
"String[][] a = new String[y][x];",
"a",
"new String[y][x]",
"y",
"x",
"for (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < y",
"i",
"y",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}",
"for (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < x",
"j",
"x",
"j++",
"j++",
"j",
"{\n\t\t\t\ta[i][j] = ns();\n\t\t\t}",
"{\n\t\t\t\ta[i][j] = ns();\n\t\t\t}",
"a[i][j] = ns()",
"a[i][j]",
"a[i]",
"a",
"i",
"j",
"ns()",
"ns",
"return a;",
"a",
"int y",
"y",
"int x",
"x",
"class FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\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\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"hasNextByte",
"{\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"if (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr < buflen",
"ptr",
"buflen",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"{\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr = 0",
"ptr",
"0",
"try {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"IOException e",
"{\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t}",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}",
"buflen <= 0",
"buflen",
"0",
"{\n\t\t\t\treturn false;\n\t\t\t}",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}",
"readByte",
"{\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}",
"if (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}",
"isPrintableChar",
"{\n\t\treturn 33 <= c && c <= 126;\n\t}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}",
"hasNext",
"{\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}",
"while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"next",
"{\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"if (!hasNext())\n\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"nextLong",
"{\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"if (!hasNext())\n\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"b == '-'",
"b",
"'-'",
"{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"true",
"{\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"if ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\t\treturn minus ? -n : n;\n\t\t\t}",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"nextInt",
"{\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow 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() {\n\t\treturn Double.parseDouble(next());\n\t}",
"nextDouble",
"{\n\t\treturn Double.parseDouble(next());\n\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.solve();\n\t\tmain.out.close();\n\t}\n\n\t// ======================================================================\n\tSet<Integer> set = new HashSet<>();\n\tpublic void solve() {\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tif(N == 0) {\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < N; i++)\t{\t\n\t\t\tset.add(ni());\n\t\t}\n\t\tint ans = 0, sv = 200;\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t// ------------------------------------------\n\t// ライブラリ\n\t// ------------------------------------------\n\t// Print\n\tprivate PrintWriter out = new PrintWriter(System.out);\n\n\t// Scanner\n\tprivate FastScanner scan = new FastScanner();\n\n\tint ni() {\n\t\treturn scan.nextInt();\n\t}\n\n\tint[] ni(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\t}\n\t\treturn a;\n\t}\n\n\tint[][] ni(int y, int x) {\n\t\tint[][] a = new int[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tlong nl() {\n\t\treturn scan.nextLong();\n\t}\n\n\tlong[] nl(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\t}\n\t\treturn a;\n\t}\n\n\tlong[][] nl(int y, int x) {\n\t\tlong[][] a = new long[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tString ns() {\n\t\treturn scan.next();\n\t}\n\n\tString[] ns(int n) {\n\t\tString[] a = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = ns();\n\t\t}\n\t\treturn a;\n\t}\n\n\tString[][] ns(int y, int x) {\n\t\tString[][] a = new String[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.solve();\n\t\tmain.out.close();\n\t}\n\n\t// ======================================================================\n\tSet<Integer> set = new HashSet<>();\n\tpublic void solve() {\n\t\tint X = ni();\n\t\tint N = ni();\n\t\tif(N == 0) {\t\n\t\t\tout.println(X);\t\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = 0; i < N; i++)\t{\t\n\t\t\tset.add(ni());\n\t\t}\n\t\tint ans = 0, sv = 200;\n\t\tfor (int i = 0; i <= 101; i++) {\n\t\t\tif(set.contains(i))\t\tcontinue;\n\t\t\tif(sv > Math.abs(i - X)) {\n\t\t\t\tsv = Math.abs(i - X);\n\t\t\t\tans = i;\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t// ------------------------------------------\n\t// ライブラリ\n\t// ------------------------------------------\n\t// Print\n\tprivate PrintWriter out = new PrintWriter(System.out);\n\n\t// Scanner\n\tprivate FastScanner scan = new FastScanner();\n\n\tint ni() {\n\t\treturn scan.nextInt();\n\t}\n\n\tint[] ni(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\t}\n\t\treturn a;\n\t}\n\n\tint[][] ni(int y, int x) {\n\t\tint[][] a = new int[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ni();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tlong nl() {\n\t\treturn scan.nextLong();\n\t}\n\n\tlong[] nl(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\t}\n\t\treturn a;\n\t}\n\n\tlong[][] nl(int y, int x) {\n\t\tlong[][] a = new long[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = nl();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n\n\tString ns() {\n\t\treturn scan.next();\n\t}\n\n\tString[] ns(int n) {\n\t\tString[] a = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = ns();\n\t\t}\n\t\treturn a;\n\t}\n\n\tString[][] ns(int y, int x) {\n\t\tString[][] a = new String[y][x];\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tfor (int j = 0; j < x; j++) {\n\t\t\t\ta[i][j] = ns();\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t}\n}",
"Main"
]
| import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.ConnectException;
import java.rmi.dgc.Lease;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;
import static java.util.Comparator.*;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.solve();
main.out.close();
}
// ======================================================================
Set<Integer> set = new HashSet<>();
public void solve() {
int X = ni();
int N = ni();
if(N == 0) {
out.println(X);
return;
}
for (int i = 0; i < N; i++) {
set.add(ni());
}
int ans = 0, sv = 200;
for (int i = 0; i <= 101; i++) {
if(set.contains(i)) continue;
if(sv > Math.abs(i - X)) {
sv = Math.abs(i - X);
ans = i;
}
}
out.println(ans);
}
// ------------------------------------------
// ライブラリ
// ------------------------------------------
// Print
private PrintWriter out = new PrintWriter(System.out);
// Scanner
private FastScanner scan = new FastScanner();
int ni() {
return scan.nextInt();
}
int[] ni(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = ni();
}
return a;
}
int[][] ni(int y, int x) {
int[][] a = new int[y][x];
for (int i = 0; i < y; i++) {
for (int j = 0; j < x; j++) {
a[i][j] = ni();
}
}
return a;
}
long nl() {
return scan.nextLong();
}
long[] nl(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = nl();
}
return a;
}
long[][] nl(int y, int x) {
long[][] a = new long[y][x];
for (int i = 0; i < y; i++) {
for (int j = 0; j < x; j++) {
a[i][j] = nl();
}
}
return a;
}
String ns() {
return scan.next();
}
String[] ns(int n) {
String[] a = new String[n];
for (int i = 0; i < n; i++) {
a[i] = ns();
}
return a;
}
String[][] ns(int y, int x) {
String[][] a = new String[y][x];
for (int i = 0; i < y; i++) {
for (int j = 0; j < x; j++) {
a[i][j] = ns();
}
}
return a;
}
}
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++;
return hasNextByte();
}
public String next() {
if (!hasNext())
throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext())
throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int) nl;
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
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,
30,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
0,
13,
17,
2,
18,
13,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
18,
13,
4,
18,
13,
17,
2,
13,
13,
30,
3,
14,
2,
2,
13,
13,
18,
13,
4,
18,
13,
2,
13,
17,
2,
13,
13,
30,
0,
13,
17,
3,
30,
40,
13,
14,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
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
],
[
176,
8
],
[
176,
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
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
49,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
68,
70
],
[
60,
71
],
[
71,
72
],
[
71,
73
],
[
60,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
74,
84
],
[
84,
85
],
[
85,
86
],
[
74,
87
],
[
88,
88
],
[
60,
89
],
[
89,
90
],
[
89,
91
],
[
60,
92
],
[
92,
93
],
[
92,
94
],
[
60,
95
],
[
95,
96
],
[
95,
97
],
[
60,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
98,
108
],
[
108,
109
],
[
109,
110
],
[
98,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
113,
127
],
[
127,
128
],
[
113,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
142,
144
],
[
129,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
129,
150
],
[
150,
151
],
[
151,
152
],
[
60,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
161,
162
],
[
161,
163
],
[
153,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
170,
171
],
[
170,
172
],
[
9,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
]
| [
" import java.util.Arrays;\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 x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tif(n==0) {\n\t\t\tSystem.out.println(x);\n\n\t\t}else {\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}\n\n\n\n\n\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tif(n==0) {\n\t\t\tSystem.out.println(x);\n\n\t\t}else {\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}\n\n\n\n\n\n\t}\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 a[]=new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tif(n==0) {\n\t\t\tSystem.out.println(x);\n\n\t\t}else {\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}\n\n\n\n\n\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 a[]=new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tif(n==0) {\n\t\t\tSystem.out.println(x);\n\n\t\t}else {\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}\n\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",
"int a[]=new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\ta[i]=sc.nextInt();\n\t\t}",
"a[i]=sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n==0) {\n\t\t\tSystem.out.println(x);\n\n\t\t}else {\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}",
"n==0",
"n",
"0",
"{\n\t\t\tSystem.out.println(x);\n\n\t\t}",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"int j=0;",
"j",
"0",
"int p=100;",
"p",
"100",
"int q=100;",
"q",
"100",
"for(j=0;a[j]<x;j++) {\n\n\t\t\t}",
"j=0;",
"j=0",
"j",
"0",
"a[j]<x",
"a[j]",
"a",
"j",
"x",
"j++",
"j++",
"j",
"{\n\n\t\t\t}",
"{\n\n\t\t\t}",
"int c=0;",
"c",
"0",
"int i=0;",
"i",
"0",
"boolean f=true;",
"f",
"true",
"for(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<=x+100",
"i",
"x+100",
"x",
"100",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}",
"if(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}",
"x-i!=a[Math.max(0, j-c)]",
"x-i",
"x",
"i",
"a[Math.max(0, j-c)]",
"a",
"Math.max(0, j-c)",
"Math.max",
"Math",
"0",
"j-c",
"j",
"c",
"{\n\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"break;",
"if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}",
"x+i!=a[Math.min(n-1, j+c)]",
"x+i",
"x",
"i",
"a[Math.min(n-1, j+c)]",
"a",
"Math.min(n-1, j+c)",
"Math.min",
"Math",
"n-1",
"n",
"1",
"j+c",
"j",
"c",
"{\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}",
"f=false",
"f",
"false",
"break;",
"{\n\n\t\t\t\t\t c++;\n\t\t\t\t}",
"c++",
"c",
"if(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}",
"f",
"{\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}",
"System.out.println(x-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"{\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}",
"System.out.println(x+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"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 a[]=new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tif(n==0) {\n\t\t\tSystem.out.println(x);\n\n\t\t}else {\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}\n\n\n\n\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 x=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tif(n==0) {\n\t\t\tSystem.out.println(x);\n\n\t\t}else {\n\t\t\tArrays.sort(a);\n\n\t\t\tint j=0;\n\t\t\tint p=100;\n\t\t\tint q=100;\n\t\t\tfor(j=0;a[j]<x;j++) {\n\n\t\t\t}\n\t\t\tint c=0;\n\t\t\tint i=0;\n\t\t\tboolean f=true;\n\t\t\tfor(i=0;i<=x+100;i++) {\n\t\t\t\tif(x-i!=a[Math.max(0, j-c)]) {\n\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(x+i!=a[Math.min(n-1, j+c)]) {\n\t\t\t\t\tf=false;\n\t\t\t\t break;\n\t\t\t\t}else {\n\n\t\t\t\t\t c++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(f) {\n\t\t\t\tSystem.out.println(x-i);\n\t\t\t}else {\n\t\t\t\tSystem.out.println(x+i);\n\t\t\t}\n\t\t}\n\n\n\n\n\n\t}\n\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) {
a[i]=sc.nextInt();
}
if(n==0) {
System.out.println(x);
}else {
Arrays.sort(a);
int j=0;
int p=100;
int q=100;
for(j=0;a[j]<x;j++) {
}
int c=0;
int i=0;
boolean f=true;
for(i=0;i<=x+100;i++) {
if(x-i!=a[Math.max(0, j-c)]) {
break;
}else if(x+i!=a[Math.min(n-1, j+c)]) {
f=false;
break;
}else {
c++;
}
}
if(f) {
System.out.println(x-i);
}else {
System.out.println(x+i);
}
}
}
}
|
[
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,
41,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
40,
13,
41,
13,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
40,
13,
14,
2,
2,
13,
17,
2,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
14,
2,
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
],
[
197,
8
],
[
197,
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
],
[
53,
55
],
[
11,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
69,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
68,
80
],
[
80,
81
],
[
11,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
11,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
99,
111
],
[
111,
112
],
[
11,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
118,
122
],
[
113,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
113,
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
],
[
153,
156
],
[
156,
157
],
[
156,
158
],
[
152,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
162,
163
],
[
162,
164
],
[
151,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
151,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
177,
182
],
[
172,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
183,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
188,
193
],
[
9,
194
],
[
194,
195
],
[
0,
196
],
[
196,
197
],
[
196,
198
]
]
| [
"import java.util.*;\nimport java.lang.Math;\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();;\n int N = sc.nextInt();\n List<Integer> list = new ArrayList<>();\n int notcon = 101;\n int notcon2 = 101;\n for(int i = 0;i < N;i++){\n list.add(sc.nextInt());\n }\n int Forbidden = X;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }\n int Forbidden2 = X - 1;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }\n if(list == null || list.size() == 0){\n System.out.println(X);\n }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.Math;",
"Math",
"java.lang",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();;\n int N = sc.nextInt();\n List<Integer> list = new ArrayList<>();\n int notcon = 101;\n int notcon2 = 101;\n for(int i = 0;i < N;i++){\n list.add(sc.nextInt());\n }\n int Forbidden = X;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }\n int Forbidden2 = X - 1;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }\n if(list == null || list.size() == 0){\n System.out.println(X);\n }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();;\n int N = sc.nextInt();\n List<Integer> list = new ArrayList<>();\n int notcon = 101;\n int notcon2 = 101;\n for(int i = 0;i < N;i++){\n list.add(sc.nextInt());\n }\n int Forbidden = X;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }\n int Forbidden2 = X - 1;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }\n if(list == null || list.size() == 0){\n System.out.println(X);\n }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }\n }",
"main",
"{\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();;\n int N = sc.nextInt();\n List<Integer> list = new ArrayList<>();\n int notcon = 101;\n int notcon2 = 101;\n for(int i = 0;i < N;i++){\n list.add(sc.nextInt());\n }\n int Forbidden = X;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }\n int Forbidden2 = X - 1;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }\n if(list == null || list.size() == 0){\n System.out.println(X);\n }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\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",
"List<Integer> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"int notcon = 101;",
"notcon",
"101",
"int notcon2 = 101;",
"notcon2",
"101",
"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 Forbidden = X;",
"Forbidden",
"X",
"for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }",
"{\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }",
"if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }",
"!list.contains(Forbidden)",
"list.contains(Forbidden)",
"list.contains",
"list",
"Forbidden",
"{\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }",
"notcon = Forbidden",
"notcon",
"Forbidden",
"break;",
"Forbidden++",
"Forbidden",
"int Forbidden2 = X - 1;",
"Forbidden2",
"X - 1",
"X",
"1",
"for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }",
"{\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }",
"if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }",
"!list.contains(Forbidden2)",
"list.contains(Forbidden2)",
"list.contains",
"list",
"Forbidden2",
"{\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }",
"notcon2 = Forbidden2",
"notcon2",
"Forbidden2",
"break;",
"Forbidden2--",
"Forbidden2",
"if(list == null || list.size() == 0){\n System.out.println(X);\n }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }",
"list == null || list.size() == 0",
"list == null",
"list",
"null",
"list.size() == 0",
"list.size()",
"list.size",
"list",
"0",
"{\n System.out.println(X);\n }",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }",
"Math.abs(notcon - X) < Math.abs(notcon2 - X)",
"Math.abs(notcon - X)",
"Math.abs",
"Math",
"notcon - X",
"notcon",
"X",
"Math.abs(notcon2 - X)",
"Math.abs",
"Math",
"notcon2 - X",
"notcon2",
"X",
"{\n System.out.println(notcon);\n }",
"System.out.println(notcon)",
"System.out.println",
"System.out",
"System",
"System.out",
"notcon",
"if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }",
"Math.abs(notcon - X) > Math.abs(notcon2 - X)",
"Math.abs(notcon - X)",
"Math.abs",
"Math",
"notcon - X",
"notcon",
"X",
"Math.abs(notcon2 - X)",
"Math.abs",
"Math",
"notcon2 - X",
"notcon2",
"X",
"{\n System.out.println(notcon2);\n }",
"System.out.println(notcon2)",
"System.out.println",
"System.out",
"System",
"System.out",
"notcon2",
"if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }",
"notcon < notcon2",
"notcon",
"notcon2",
"{\n System.out.println(notcon);\n }",
"System.out.println(notcon)",
"System.out.println",
"System.out",
"System",
"System.out",
"notcon",
"if(notcon2 < notcon){\n System.out.println(notcon2);\n }",
"notcon2 < notcon",
"notcon2",
"notcon",
"{\n System.out.println(notcon2);\n }",
"System.out.println(notcon2)",
"System.out.println",
"System.out",
"System",
"System.out",
"notcon2",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();;\n int N = sc.nextInt();\n List<Integer> list = new ArrayList<>();\n int notcon = 101;\n int notcon2 = 101;\n for(int i = 0;i < N;i++){\n list.add(sc.nextInt());\n }\n int Forbidden = X;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }\n int Forbidden2 = X - 1;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }\n if(list == null || list.size() == 0){\n System.out.println(X);\n }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();;\n int N = sc.nextInt();\n List<Integer> list = new ArrayList<>();\n int notcon = 101;\n int notcon2 = 101;\n for(int i = 0;i < N;i++){\n list.add(sc.nextInt());\n }\n int Forbidden = X;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden)){\n //int notcon = X;\n notcon = Forbidden;\n //System.out.println(notcon + \"j\");\n //System.out.println(notcon);\n break;\n }\n Forbidden++;\n }\n int Forbidden2 = X - 1;\n for(int i = 0;i < 100;i++){\n if(!list.contains(Forbidden2)){\n notcon2 = Forbidden2;\n //System.out.println(notcon2 + \"g\");\n break;\n }\n Forbidden2--;\n }\n if(list == null || list.size() == 0){\n System.out.println(X);\n }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){\n System.out.println(notcon);\n }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){\n System.out.println(notcon2);\n }else if(notcon < notcon2){\n System.out.println(notcon);\n }else if(notcon2 < notcon){\n System.out.println(notcon2);\n }\n }\n}",
"Main"
]
| import java.util.*;
import java.lang.Math;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();;
int N = sc.nextInt();
List<Integer> list = new ArrayList<>();
int notcon = 101;
int notcon2 = 101;
for(int i = 0;i < N;i++){
list.add(sc.nextInt());
}
int Forbidden = X;
for(int i = 0;i < 100;i++){
if(!list.contains(Forbidden)){
//int notcon = X;
notcon = Forbidden;
//System.out.println(notcon + "j");
//System.out.println(notcon);
break;
}
Forbidden++;
}
int Forbidden2 = X - 1;
for(int i = 0;i < 100;i++){
if(!list.contains(Forbidden2)){
notcon2 = Forbidden2;
//System.out.println(notcon2 + "g");
break;
}
Forbidden2--;
}
if(list == null || list.size() == 0){
System.out.println(X);
}else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
System.out.println(notcon);
}else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
System.out.println(notcon2);
}else if(notcon < notcon2){
System.out.println(notcon);
}else if(notcon2 < notcon){
System.out.println(notcon2);
}
}
}
|
[
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,
13,
41,
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,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
17,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
159,
14
],
[
159,
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
],
[
61,
64
],
[
17,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
77,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
17,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
17,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
100,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
112,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
17,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
133,
134
],
[
133,
135
],
[
129,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
139,
141
],
[
128,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
128,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
15,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
]
| [
"import java.util.*;\nimport java.lang.Math.*;\nimport java.util.Arrays;\nimport java.util.Collections;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// スペース区切りの整数の入力\n int x=sc.nextInt();\n int n=sc.nextInt();\n int bigans=x;\n int smlans=x;\n Integer ns[]=new Integer[n];\n for(int i=0;i<n;i++){\n ns[i]=sc.nextInt();\n }\n Arrays.sort(ns);\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }\n Arrays.sort(ns, Collections.reverseOrder());\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }\n if(Math.abs(bigans-x)<Math.abs(smlans-x)){\n System.out.println(bigans);\n }else{\n System.out.println(smlans);\n }\n}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.Math.*;",
"Math.*",
"java.lang",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// スペース区切りの整数の入力\n int x=sc.nextInt();\n int n=sc.nextInt();\n int bigans=x;\n int smlans=x;\n Integer ns[]=new Integer[n];\n for(int i=0;i<n;i++){\n ns[i]=sc.nextInt();\n }\n Arrays.sort(ns);\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }\n Arrays.sort(ns, Collections.reverseOrder());\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }\n if(Math.abs(bigans-x)<Math.abs(smlans-x)){\n System.out.println(bigans);\n }else{\n System.out.println(smlans);\n }\n}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// スペース区切りの整数の入力\n int x=sc.nextInt();\n int n=sc.nextInt();\n int bigans=x;\n int smlans=x;\n Integer ns[]=new Integer[n];\n for(int i=0;i<n;i++){\n ns[i]=sc.nextInt();\n }\n Arrays.sort(ns);\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }\n Arrays.sort(ns, Collections.reverseOrder());\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }\n if(Math.abs(bigans-x)<Math.abs(smlans-x)){\n System.out.println(bigans);\n }else{\n System.out.println(smlans);\n }\n}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t// スペース区切りの整数の入力\n int x=sc.nextInt();\n int n=sc.nextInt();\n int bigans=x;\n int smlans=x;\n Integer ns[]=new Integer[n];\n for(int i=0;i<n;i++){\n ns[i]=sc.nextInt();\n }\n Arrays.sort(ns);\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }\n Arrays.sort(ns, Collections.reverseOrder());\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }\n if(Math.abs(bigans-x)<Math.abs(smlans-x)){\n System.out.println(bigans);\n }else{\n System.out.println(smlans);\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 bigans=x;",
"bigans",
"x",
"int smlans=x;",
"smlans",
"x",
"Integer ns[]=new Integer[n];",
"ns",
"new Integer[n]",
"n",
"for(int i=0;i<n;i++){\n ns[i]=sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ns[i]=sc.nextInt();\n }",
"{\n ns[i]=sc.nextInt();\n }",
"ns[i]=sc.nextInt()",
"ns[i]",
"ns",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(ns)",
"Arrays.sort",
"Arrays",
"ns",
"for(int i=0;i<n;i++){\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }",
"{\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }",
"int nx=ns[i];",
"nx",
"ns[i]",
"ns",
"i",
"if(bigans==nx){\n bigans=nx+1;\n }",
"bigans==nx",
"bigans",
"nx",
"{\n bigans=nx+1;\n }",
"bigans=nx+1",
"bigans",
"nx+1",
"nx",
"1",
"Arrays.sort(ns, Collections.reverseOrder())",
"Arrays.sort",
"Arrays",
"ns",
"Collections.reverseOrder()",
"Collections.reverseOrder",
"Collections",
"for(int i=0;i<n;i++){\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }",
"{\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }",
"int nx=ns[i];",
"nx",
"ns[i]",
"ns",
"i",
"if(smlans==nx){\n smlans=nx-1;\n }",
"smlans==nx",
"smlans",
"nx",
"{\n smlans=nx-1;\n }",
"smlans=nx-1",
"smlans",
"nx-1",
"nx",
"1",
"if(Math.abs(bigans-x)<Math.abs(smlans-x)){\n System.out.println(bigans);\n }else{\n System.out.println(smlans);\n }",
"Math.abs(bigans-x)<Math.abs(smlans-x)",
"Math.abs(bigans-x)",
"Math.abs",
"Math",
"bigans-x",
"bigans",
"x",
"Math.abs(smlans-x)",
"Math.abs",
"Math",
"smlans-x",
"smlans",
"x",
"{\n System.out.println(bigans);\n }",
"System.out.println(bigans)",
"System.out.println",
"System.out",
"System",
"System.out",
"bigans",
"{\n System.out.println(smlans);\n }",
"System.out.println(smlans)",
"System.out.println",
"System.out",
"System",
"System.out",
"smlans",
"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 int x=sc.nextInt();\n int n=sc.nextInt();\n int bigans=x;\n int smlans=x;\n Integer ns[]=new Integer[n];\n for(int i=0;i<n;i++){\n ns[i]=sc.nextInt();\n }\n Arrays.sort(ns);\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }\n Arrays.sort(ns, Collections.reverseOrder());\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }\n if(Math.abs(bigans-x)<Math.abs(smlans-x)){\n System.out.println(bigans);\n }else{\n System.out.println(smlans);\n }\n}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// スペース区切りの整数の入力\n int x=sc.nextInt();\n int n=sc.nextInt();\n int bigans=x;\n int smlans=x;\n Integer ns[]=new Integer[n];\n for(int i=0;i<n;i++){\n ns[i]=sc.nextInt();\n }\n Arrays.sort(ns);\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(bigans==nx){\n bigans=nx+1;\n }\n }\n Arrays.sort(ns, Collections.reverseOrder());\n for(int i=0;i<n;i++){\n int nx=ns[i];\n if(smlans==nx){\n smlans=nx-1;\n }\n }\n if(Math.abs(bigans-x)<Math.abs(smlans-x)){\n System.out.println(bigans);\n }else{\n System.out.println(smlans);\n }\n}\n}",
"Main"
]
| import java.util.*;
import java.lang.Math.*;
import java.util.Arrays;
import java.util.Collections;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// スペース区切りの整数の入力
int x=sc.nextInt();
int n=sc.nextInt();
int bigans=x;
int smlans=x;
Integer ns[]=new Integer[n];
for(int i=0;i<n;i++){
ns[i]=sc.nextInt();
}
Arrays.sort(ns);
for(int i=0;i<n;i++){
int nx=ns[i];
if(bigans==nx){
bigans=nx+1;
}
}
Arrays.sort(ns, Collections.reverseOrder());
for(int i=0;i<n;i++){
int nx=ns[i];
if(smlans==nx){
smlans=nx-1;
}
}
if(Math.abs(bigans-x)<Math.abs(smlans-x)){
System.out.println(bigans);
}else{
System.out.println(smlans);
}
}
} |
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
18,
13,
13,
30,
40,
13,
14,
2,
2,
13,
13,
18,
13,
13,
30,
40,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
4,
18,
18,
13,
13,
2,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
151,
5
],
[
151,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
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
],
[
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
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
70,
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
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
89,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
70,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
116,
125
],
[
112,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
130,
139
],
[
8,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
145,
147
],
[
6,
148
],
[
148,
149
],
[
0,
150
],
[
150,
151
],
[
150,
152
]
]
| [
"import java.util.*;\n \npublic class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n int p[] = new int[n];\n for(int i = 0; i < n; i++){\n \tp[i] = sc.nextInt();\n }\n if(n == 0){\n \tSystem.out.println(x);\n return;\n }\n for(int i = 0; i < n; i++){\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }\n System.out.println(x - 1);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n int p[] = new int[n];\n for(int i = 0; i < n; i++){\n \tp[i] = sc.nextInt();\n }\n if(n == 0){\n \tSystem.out.println(x);\n return;\n }\n for(int i = 0; i < n; i++){\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }\n System.out.println(x - 1);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n int p[] = new int[n];\n for(int i = 0; i < n; i++){\n \tp[i] = sc.nextInt();\n }\n if(n == 0){\n \tSystem.out.println(x);\n return;\n }\n for(int i = 0; i < n; i++){\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }\n System.out.println(x - 1);\n }",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n int p[] = new int[n];\n for(int i = 0; i < n; i++){\n \tp[i] = sc.nextInt();\n }\n if(n == 0){\n \tSystem.out.println(x);\n return;\n }\n for(int i = 0; i < n; i++){\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }\n System.out.println(x - 1);\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",
"for(int i = 0; i < n; i++){\n \tp[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \tp[i] = sc.nextInt();\n }",
"{\n \tp[i] = sc.nextInt();\n }",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n == 0){\n \tSystem.out.println(x);\n return;\n }",
"n == 0",
"n",
"0",
"{\n \tSystem.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 \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }",
"{\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }",
"int countm = 0;",
"countm",
"0",
"int countp = 0;",
"countp",
"0",
"for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }",
"{\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }",
"if(x - i != p[j]){\n \tcountm++;\n }",
"x - i != p[j]",
"x - i",
"x",
"i",
"p[j]",
"p",
"j",
"{\n \tcountm++;\n }",
"countm++",
"countm",
"if(x + i != p[j]){\n \tcountp++;\n }",
"x + i != p[j]",
"x + i",
"x",
"i",
"p[j]",
"p",
"j",
"{\n \tcountp++;\n }",
"countp++",
"countp",
"if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }",
"countm == n",
"countm",
"n",
"{\n \tSystem.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(countp == n){\n \tSystem.out.println(x + i);\n return;\n }",
"countp == n",
"countp",
"n",
"{\n \tSystem.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;",
"System.out.println(x - 1)",
"System.out.println",
"System.out",
"System",
"System.out",
"x - 1",
"x",
"1",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n int p[] = new int[n];\n for(int i = 0; i < n; i++){\n \tp[i] = sc.nextInt();\n }\n if(n == 0){\n \tSystem.out.println(x);\n return;\n }\n for(int i = 0; i < n; i++){\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }\n System.out.println(x - 1);\n }\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n int p[] = new int[n];\n for(int i = 0; i < n; i++){\n \tp[i] = sc.nextInt();\n }\n if(n == 0){\n \tSystem.out.println(x);\n return;\n }\n for(int i = 0; i < n; i++){\n \tint countm = 0;\n int countp = 0;\n for(int j = 0; j < n; j++){\n \tif(x - i != p[j]){\n \tcountm++;\n }\n if(x + i != p[j]){\n \tcountp++;\n }\n }\n if(countm == n){\n \tSystem.out.println(x - i);\n return;\n }else if(countp == n){\n \tSystem.out.println(x + i);\n return;\n }\n }\n System.out.println(x - 1);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int p[] = new int[n];
for(int i = 0; i < n; i++){
p[i] = sc.nextInt();
}
if(n == 0){
System.out.println(x);
return;
}
for(int i = 0; i < n; i++){
int countm = 0;
int countp = 0;
for(int j = 0; j < n; j++){
if(x - i != p[j]){
countm++;
}
if(x + i != p[j]){
countp++;
}
}
if(countm == n){
System.out.println(x - i);
return;
}else if(countp == n){
System.out.println(x + i);
return;
}
}
System.out.println(x - 1);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
41,
13,
17,
42,
2,
40,
13,
17,
30,
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,
41,
13,
13,
42,
17,
30,
14,
4,
18,
13,
13,
40,
13,
30,
4,
18,
13,
13,
3,
14,
4,
18,
13,
13,
40,
13,
30,
4,
18,
13,
13,
3,
4,
18,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
14,
2,
13,
17,
29,
13,
29,
8,
2,
13,
13,
4,
13,
2,
13,
13,
13,
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,
14,
2,
13,
13,
29,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
29,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
2,
13,
40,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
2,
13,
17,
4,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
14,
18,
13,
13,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
0,
13,
13,
30,
30,
0,
18,
13,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
18,
13,
13,
30,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
29,
17,
14,
2,
13,
17,
30,
29,
17,
11,
1,
41,
13,
17,
2,
13,
2,
4,
18,
13,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
30,
29,
17,
29,
17,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
30,
4,
18,
13,
13,
14,
2,
2,
13,
13,
13,
4,
18,
13,
2,
13,
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,
18,
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,
18,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
18,
13,
13,
13,
4,
18,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
18,
13,
13,
13,
4,
18,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
28,
13,
13,
30,
4,
18,
13,
2,
13,
17,
4,
18,
13,
23,
13,
12,
13,
30,
28,
13,
13,
30,
4,
18,
13,
2,
13,
17,
4,
18,
13,
23,
13,
12,
13,
30,
28,
13,
13,
30,
30,
28,
13,
13,
30,
4,
18,
13,
2,
13,
17,
4,
18,
13,
23,
13,
12,
13,
30,
28,
13,
13,
30,
30,
28,
13,
13,
30,
4,
18,
13,
2,
13,
17,
4,
18,
13,
23,
13,
12,
13,
30,
4,
18,
13,
2,
2,
2,
17,
2,
13,
17,
17,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
13,
2,
2,
2,
17,
2,
13,
17,
17,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
13,
2,
2,
17,
2,
13,
17,
17,
28,
13,
13,
30,
4,
18,
13,
2,
13,
17,
4,
18,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
18,
36,
13,
18,
13,
13,
29,
17,
14,
2,
18,
36,
13,
18,
13,
13,
29,
17,
29,
40,
17,
23,
13,
12,
13,
30,
29,
2,
18,
36,
13,
18,
13,
13,
23,
13,
13,
6,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
18,
36,
13,
18,
13,
13,
29,
17,
14,
2,
18,
36,
13,
18,
13,
13,
29,
17,
29,
40,
17,
23,
13,
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
],
[
906,
11
],
[
906,
12
],
[
12,
13
],
[
906,
14
],
[
14,
15
],
[
906,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
22,
24
],
[
18,
25
],
[
25,
26
],
[
25,
27
],
[
18,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
28,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
33,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
44,
45
],
[
44,
46
],
[
33,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
63,
64
],
[
33,
65
],
[
65,
66
],
[
65,
67
],
[
33,
68
],
[
68,
69
],
[
68,
70
],
[
33,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
74,
79
],
[
79,
80
],
[
74,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
81,
86
],
[
73,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
87,
92
],
[
92,
93
],
[
87,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
94,
99
],
[
18,
100
],
[
100,
101
],
[
101,
102
],
[
16,
103
],
[
103,
104
],
[
906,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
107,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
107,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
121,
131
],
[
131,
132
],
[
131,
133
],
[
131,
134
],
[
134,
135
],
[
134,
136
],
[
105,
137
],
[
137,
138
],
[
105,
139
],
[
139,
140
],
[
906,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
149,
151
],
[
149,
152
],
[
141,
153
],
[
153,
154
],
[
141,
155
],
[
155,
156
],
[
906,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
164,
165
],
[
160,
166
],
[
166,
167
],
[
157,
168
],
[
168,
169
],
[
157,
170
],
[
170,
171
],
[
906,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
179,
180
],
[
175,
181
],
[
181,
182
],
[
172,
183
],
[
183,
184
],
[
172,
185
],
[
185,
186
],
[
906,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
190,
199
],
[
199,
200
],
[
187,
201
],
[
201,
202
],
[
906,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
209,
210
],
[
209,
211
],
[
205,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
212,
216
],
[
205,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
219,
221
],
[
217,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
217,
227
],
[
227,
228
],
[
228,
229
],
[
217,
230
],
[
231,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
241,
243
],
[
237,
244
],
[
244,
245
],
[
244,
246
],
[
237,
247
],
[
247,
248
],
[
248,
249
],
[
248,
250
],
[
237,
251
],
[
252,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
253,
257
],
[
205,
258
],
[
258,
259
],
[
258,
260
],
[
205,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
261,
266
],
[
266,
267
],
[
266,
268
],
[
261,
269
],
[
269,
270
],
[
270,
271
],
[
261,
272
],
[
273,
273
],
[
273,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
274,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
279,
282
],
[
205,
283
],
[
283,
284
],
[
203,
285
],
[
285,
286
],
[
906,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
291,
295
],
[
295,
296
],
[
295,
297
],
[
290,
298
],
[
298,
299
],
[
299,
300
],
[
289,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
301,
305
],
[
305,
306
],
[
306,
307
],
[
289,
308
],
[
308,
309
],
[
309,
310
],
[
310,
311
],
[
310,
312
],
[
308,
313
],
[
313,
314
],
[
313,
315
],
[
315,
316
],
[
316,
317
],
[
317,
318
],
[
316,
319
],
[
315,
320
],
[
308,
321
],
[
321,
322
],
[
322,
323
],
[
308,
324
],
[
325,
325
],
[
325,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
327,
331
],
[
326,
332
],
[
332,
333
],
[
333,
334
],
[
289,
335
],
[
335,
336
],
[
287,
337
],
[
337,
338
],
[
906,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
341,
345
],
[
345,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
345,
350
],
[
350,
351
],
[
351,
352
],
[
351,
353
],
[
350,
354
],
[
345,
355
],
[
355,
356
],
[
356,
357
],
[
345,
358
],
[
359,
359
],
[
359,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
362,
364
],
[
361,
365
],
[
360,
366
],
[
366,
367
],
[
367,
368
],
[
368,
369
],
[
367,
370
],
[
366,
371
],
[
371,
372
],
[
372,
373
],
[
373,
374
],
[
373,
375
],
[
372,
376
],
[
371,
377
],
[
377,
378
],
[
378,
379
],
[
377,
380
],
[
380,
381
],
[
380,
382
],
[
341,
383
],
[
383,
384
],
[
339,
385
],
[
385,
386
],
[
906,
387
],
[
387,
388
],
[
387,
389
],
[
389,
390
],
[
390,
391
],
[
390,
392
],
[
389,
394
],
[
394,
395
],
[
395,
396
],
[
396,
397
],
[
396,
398
],
[
394,
399
],
[
399,
400
],
[
399,
401
],
[
394,
402
],
[
402,
403
],
[
403,
404
],
[
394,
405
],
[
405,
406
],
[
406,
407
],
[
407,
408
],
[
407,
409
],
[
406,
410
],
[
410,
411
],
[
411,
412
],
[
389,
413
],
[
413,
414
],
[
387,
415
],
[
415,
416
],
[
906,
417
],
[
417,
418
],
[
417,
419
],
[
419,
420
],
[
420,
421
],
[
420,
422
],
[
419,
424
],
[
424,
425
],
[
425,
426
],
[
426,
427
],
[
426,
428
],
[
424,
429
],
[
429,
430
],
[
429,
431
],
[
424,
432
],
[
432,
433
],
[
433,
434
],
[
424,
435
],
[
435,
436
],
[
436,
437
],
[
437,
438
],
[
437,
439
],
[
436,
440
],
[
440,
441
],
[
441,
442
],
[
419,
443
],
[
443,
444
],
[
417,
445
],
[
445,
446
],
[
906,
447
],
[
447,
448
],
[
447,
449
],
[
449,
450
],
[
450,
451
],
[
450,
452
],
[
449,
455
],
[
455,
456
],
[
456,
457
],
[
457,
458
],
[
457,
459
],
[
455,
460
],
[
460,
461
],
[
460,
462
],
[
455,
463
],
[
463,
464
],
[
464,
465
],
[
455,
466
],
[
466,
467
],
[
467,
468
],
[
468,
469
],
[
469,
470
],
[
469,
471
],
[
467,
472
],
[
472,
473
],
[
472,
474
],
[
467,
475
],
[
475,
476
],
[
476,
477
],
[
467,
478
],
[
478,
479
],
[
479,
480
],
[
480,
481
],
[
481,
482
],
[
481,
483
],
[
480,
484
],
[
479,
485
],
[
485,
486
],
[
486,
487
],
[
449,
488
],
[
488,
489
],
[
447,
490
],
[
490,
491
],
[
447,
492
],
[
492,
493
],
[
906,
494
],
[
494,
495
],
[
494,
496
],
[
496,
497
],
[
497,
498
],
[
497,
499
],
[
496,
502
],
[
502,
503
],
[
503,
504
],
[
504,
505
],
[
504,
506
],
[
502,
507
],
[
507,
508
],
[
507,
509
],
[
502,
510
],
[
510,
511
],
[
511,
512
],
[
502,
513
],
[
513,
514
],
[
514,
515
],
[
515,
516
],
[
516,
517
],
[
516,
518
],
[
514,
519
],
[
519,
520
],
[
519,
521
],
[
514,
522
],
[
522,
523
],
[
523,
524
],
[
514,
525
],
[
525,
526
],
[
526,
527
],
[
527,
528
],
[
528,
529
],
[
528,
530
],
[
527,
531
],
[
526,
532
],
[
532,
533
],
[
533,
534
],
[
496,
535
],
[
535,
536
],
[
494,
537
],
[
537,
538
],
[
494,
539
],
[
539,
540
],
[
906,
541
],
[
541,
542
],
[
541,
543
],
[
543,
544
],
[
544,
545
],
[
544,
546
],
[
544,
547
],
[
547,
548
],
[
548,
549
],
[
549,
550
],
[
548,
551
],
[
551,
552
],
[
551,
553
],
[
543,
554
],
[
554,
555
],
[
555,
556
],
[
541,
557
],
[
557,
558
],
[
906,
559
],
[
559,
560
],
[
559,
561
],
[
561,
562
],
[
562,
563
],
[
562,
564
],
[
562,
565
],
[
565,
566
],
[
566,
567
],
[
567,
568
],
[
566,
569
],
[
569,
570
],
[
569,
571
],
[
561,
572
],
[
572,
573
],
[
573,
574
],
[
559,
575
],
[
575,
576
],
[
906,
577
],
[
577,
578
],
[
577,
579
],
[
579,
580
],
[
580,
581
],
[
580,
582
],
[
580,
583
],
[
584,
584
],
[
584,
585
],
[
585,
586
],
[
585,
587
],
[
585,
588
],
[
588,
589
],
[
589,
590
],
[
590,
591
],
[
589,
592
],
[
592,
593
],
[
592,
594
],
[
584,
595
],
[
595,
596
],
[
596,
597
],
[
577,
598
],
[
598,
599
],
[
906,
600
],
[
600,
601
],
[
600,
602
],
[
602,
603
],
[
603,
604
],
[
603,
605
],
[
603,
606
],
[
607,
607
],
[
607,
608
],
[
608,
609
],
[
608,
610
],
[
608,
611
],
[
611,
612
],
[
612,
613
],
[
613,
614
],
[
612,
615
],
[
615,
616
],
[
615,
617
],
[
607,
618
],
[
618,
619
],
[
619,
620
],
[
600,
621
],
[
621,
622
],
[
906,
623
],
[
623,
624
],
[
623,
625
],
[
625,
626
],
[
626,
627
],
[
627,
628
],
[
626,
629
],
[
631,
630
],
[
630,
631
],
[
631,
632
],
[
631,
633
],
[
633,
634
],
[
633,
635
],
[
630,
636
],
[
631,
637
],
[
623,
638
],
[
638,
639
],
[
623,
640
],
[
640,
641
],
[
906,
642
],
[
642,
643
],
[
642,
644
],
[
644,
645
],
[
645,
646
],
[
646,
647
],
[
645,
648
],
[
650,
649
],
[
649,
650
],
[
650,
651
],
[
650,
652
],
[
652,
653
],
[
652,
654
],
[
649,
655
],
[
650,
656
],
[
642,
657
],
[
657,
658
],
[
642,
659
],
[
659,
660
],
[
906,
661
],
[
661,
662
],
[
661,
663
],
[
663,
664
],
[
664,
665
],
[
665,
666
],
[
664,
667
],
[
668,
668
],
[
668,
669
],
[
668,
670
],
[
670,
671
],
[
670,
672
],
[
668,
673
],
[
663,
674
],
[
674,
675
],
[
674,
676
],
[
674,
677
],
[
677,
678
],
[
678,
679
],
[
679,
680
],
[
678,
681
],
[
681,
682
],
[
681,
683
],
[
663,
684
],
[
684,
685
],
[
685,
686
],
[
661,
687
],
[
687,
688
],
[
661,
689
],
[
689,
690
],
[
906,
691
],
[
691,
692
],
[
691,
693
],
[
693,
694
],
[
691,
695
],
[
695,
696
],
[
691,
697
],
[
697,
698
],
[
697,
699
],
[
699,
700
],
[
700,
701
],
[
701,
702
],
[
701,
703
],
[
700,
704
],
[
699,
705
],
[
705,
706
],
[
706,
707
],
[
706,
708
],
[
705,
709
],
[
697,
710
],
[
710,
711
],
[
697,
712
],
[
712,
713
],
[
691,
714
],
[
714,
715
],
[
714,
716
],
[
716,
717
],
[
717,
718
],
[
718,
719
],
[
719,
720
],
[
719,
721
],
[
718,
722
],
[
722,
723
],
[
722,
724
],
[
717,
725
],
[
725,
726
],
[
717,
727
],
[
727,
728
],
[
728,
729
],
[
729,
730
],
[
729,
731
],
[
728,
732
],
[
732,
733
],
[
732,
734
],
[
727,
735
],
[
735,
736
],
[
727,
737
],
[
737,
738
],
[
738,
739
],
[
714,
740
],
[
740,
741
],
[
691,
742
],
[
742,
743
],
[
742,
744
],
[
744,
745
],
[
745,
746
],
[
746,
747
],
[
747,
748
],
[
747,
749
],
[
746,
750
],
[
750,
751
],
[
750,
752
],
[
742,
753
],
[
753,
754
],
[
691,
755
],
[
906,
756
],
[
756,
757
],
[
756,
758
],
[
758,
759
],
[
756,
760
],
[
760,
761
],
[
756,
762
],
[
762,
763
],
[
756,
764
],
[
764,
765
],
[
764,
766
],
[
766,
767
],
[
767,
768
],
[
768,
769
],
[
768,
770
],
[
767,
771
],
[
766,
772
],
[
772,
773
],
[
773,
774
],
[
773,
775
],
[
772,
776
],
[
766,
777
],
[
777,
778
],
[
778,
779
],
[
778,
780
],
[
777,
781
],
[
764,
782
],
[
782,
783
],
[
764,
784
],
[
784,
785
],
[
764,
786
],
[
786,
787
],
[
756,
788
],
[
788,
789
],
[
788,
790
],
[
790,
791
],
[
791,
792
],
[
792,
793
],
[
793,
794
],
[
793,
795
],
[
792,
796
],
[
796,
797
],
[
796,
798
],
[
791,
799
],
[
799,
800
],
[
791,
801
],
[
801,
802
],
[
802,
803
],
[
803,
804
],
[
803,
805
],
[
802,
806
],
[
806,
807
],
[
806,
808
],
[
801,
809
],
[
809,
810
],
[
801,
811
],
[
811,
812
],
[
812,
813
],
[
788,
814
],
[
814,
815
],
[
756,
816
],
[
906,
817
],
[
817,
818
],
[
817,
819
],
[
819,
820
],
[
817,
821
],
[
821,
822
],
[
817,
823
],
[
823,
824
],
[
823,
825
],
[
825,
826
],
[
826,
827
],
[
826,
828
],
[
817,
829
],
[
829,
830
],
[
829,
831
],
[
831,
832
],
[
832,
833
],
[
833,
834
],
[
834,
835
],
[
834,
836
],
[
833,
837
],
[
837,
838
],
[
838,
839
],
[
839,
840
],
[
832,
841
],
[
841,
842
],
[
842,
843
],
[
843,
844
],
[
843,
845
],
[
845,
846
],
[
846,
847
],
[
847,
848
],
[
842,
849
],
[
849,
850
],
[
850,
851
],
[
850,
852
],
[
831,
853
],
[
853,
854
],
[
854,
855
],
[
855,
856
],
[
817,
857
],
[
857,
858
],
[
857,
859
],
[
859,
860
],
[
860,
861
],
[
861,
862
],
[
862,
863
],
[
861,
864
],
[
864,
865
],
[
817,
866
],
[
866,
867
],
[
866,
868
],
[
868,
869
],
[
869,
870
],
[
870,
871
],
[
871,
872
],
[
870,
873
],
[
873,
874
],
[
817,
875
],
[
875,
876
],
[
875,
877
],
[
877,
878
],
[
878,
879
],
[
879,
880
],
[
880,
881
],
[
879,
882
],
[
882,
883
],
[
817,
884
],
[
884,
885
],
[
884,
886
],
[
886,
887
],
[
887,
888
],
[
887,
889
],
[
886,
890
],
[
890,
891
],
[
891,
892
],
[
891,
893
],
[
893,
894
],
[
894,
895
],
[
895,
896
],
[
890,
897
],
[
897,
898
],
[
898,
899
],
[
898,
900
],
[
900,
901
],
[
901,
902
],
[
886,
903
],
[
903,
904
],
[
0,
905
],
[
905,
906
],
[
905,
907
]
]
| [
"import java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\npublic class Main {\n public static MyScanner scan;\n public static PrintWriter out;\n public static void main(String[] args) {\n scan=new MyScanner();\n out=new PrintWriter(new BufferedOutputStream(System.out));\n\n int t=1;\n// int t=scan.nextInt();\n while(t-->0) {\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }\n out.close();\n }\n\n //-----------------------------------------------------COMP-SPACE-----------------------------------------------------\n\n\n\n //--------------------------------------------------------------------------------------------------------------------\n\n //node\n static class Node implements Comparable<Node> {\n public int x,y;\n public Node(int x,int y) {\n this.x=x;\n this.y=y;\n }\n\n public int compareTo(Node other) {\n if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;\n }\n\n public boolean equals(Node other) {\n return this.x==other.x;\n }\n\n// public int compareTo(Node other) {\n// if(this.y==other.y) return 0;\n// else if(this.y>other.y) return 1;\n// else return -1;\n// }\n//\n// public boolean equals(Node other) {\n// return this.y==other.y;\n// }\n }\n //edge\n static class Edge implements Comparable<Edge> {\n public Node a,b;\n public int weight;\n\n public Edge(Node a,Node b,int weight) {\n this.a=a;\n this.b=b;\n this.weight=weight;\n }\n\n public int compareTo(Edge other) {\n if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;\n }\n }\n\n //util\n public static int gcd(int a, int b) {\n if (b == 0)\n return a;\n if (a == 0)\n return b;\n return (a > b) ? gcd(a % b, b) : gcd(a, b % a);\n }\n\n public static int lcm(int a, int b) {\n return a * b / gcd(a, b);\n }\n\n public static int min(int a,int b) {\n if(a<=b) return a;\n else return b;\n }\n\n public static int max(int a,int b) {\n if(a>=b) return a;\n else return b;\n }\n\n public static int abs(int a) {\n if(a<0) return a*-1;\n else return a;\n }\n\n public static ArrayList<Integer> getPrimes(int n) {\n boolean prime[]=new boolean[n+1];\n Arrays.fill(prime,true);\n for (int p=2;p*p<=n;p++) {\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }\n ArrayList<Integer> primeNumbers=new ArrayList<Integer>();\n for (int i = 2; i <= n; i++) {\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }\n return primeNumbers;\n }\n\n public static boolean isPrime(int a) {\n if (a == 0 || a == 1) {\n return false;\n }\n if (a == 2) {\n return true;\n }\n for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n return false;\n }\n }\n return true;\n }\n\n public static ArrayList<Integer> getDivisors(int n) {\n ArrayList<Integer> div = new ArrayList<Integer>();\n for (int i=1;i*i<=n;i++) {\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }\n return div;\n }\n\n //scanner\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n public static int[] nextIntArray(int n) {\n int[] a=new int[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static Integer[] nextIntegerArray(int n) {\n Integer[] a=new Integer[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static int[][] nextIntMatrix(int n,int m) {\n int[][] a=new int[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n public static Integer[][] nextIntegerMatrix(int n,int m) {\n Integer[][] a=new Integer[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n //print\n public static void printIntArray(int[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntegerArray(Integer[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntMatrix(int[][] a) {\n for(int[] i:a) {\n for(int j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void printIntegerMatrix(Integer[][] a) {\n for(Integer[] i:a) {\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void help(int t,int n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,String n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,char[] n) { out.print(\"Test Case: \"+(t+1)+\" | Variable Output: \"); for(char c:n) out.print(c+\" \"); out.println(); }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"public class Main {\n public static MyScanner scan;\n public static PrintWriter out;\n public static void main(String[] args) {\n scan=new MyScanner();\n out=new PrintWriter(new BufferedOutputStream(System.out));\n\n int t=1;\n// int t=scan.nextInt();\n while(t-->0) {\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }\n out.close();\n }\n\n //-----------------------------------------------------COMP-SPACE-----------------------------------------------------\n\n\n\n //--------------------------------------------------------------------------------------------------------------------\n\n //node\n static class Node implements Comparable<Node> {\n public int x,y;\n public Node(int x,int y) {\n this.x=x;\n this.y=y;\n }\n\n public int compareTo(Node other) {\n if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;\n }\n\n public boolean equals(Node other) {\n return this.x==other.x;\n }\n\n// public int compareTo(Node other) {\n// if(this.y==other.y) return 0;\n// else if(this.y>other.y) return 1;\n// else return -1;\n// }\n//\n// public boolean equals(Node other) {\n// return this.y==other.y;\n// }\n }\n //edge\n static class Edge implements Comparable<Edge> {\n public Node a,b;\n public int weight;\n\n public Edge(Node a,Node b,int weight) {\n this.a=a;\n this.b=b;\n this.weight=weight;\n }\n\n public int compareTo(Edge other) {\n if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;\n }\n }\n\n //util\n public static int gcd(int a, int b) {\n if (b == 0)\n return a;\n if (a == 0)\n return b;\n return (a > b) ? gcd(a % b, b) : gcd(a, b % a);\n }\n\n public static int lcm(int a, int b) {\n return a * b / gcd(a, b);\n }\n\n public static int min(int a,int b) {\n if(a<=b) return a;\n else return b;\n }\n\n public static int max(int a,int b) {\n if(a>=b) return a;\n else return b;\n }\n\n public static int abs(int a) {\n if(a<0) return a*-1;\n else return a;\n }\n\n public static ArrayList<Integer> getPrimes(int n) {\n boolean prime[]=new boolean[n+1];\n Arrays.fill(prime,true);\n for (int p=2;p*p<=n;p++) {\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }\n ArrayList<Integer> primeNumbers=new ArrayList<Integer>();\n for (int i = 2; i <= n; i++) {\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }\n return primeNumbers;\n }\n\n public static boolean isPrime(int a) {\n if (a == 0 || a == 1) {\n return false;\n }\n if (a == 2) {\n return true;\n }\n for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n return false;\n }\n }\n return true;\n }\n\n public static ArrayList<Integer> getDivisors(int n) {\n ArrayList<Integer> div = new ArrayList<Integer>();\n for (int i=1;i*i<=n;i++) {\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }\n return div;\n }\n\n //scanner\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n public static int[] nextIntArray(int n) {\n int[] a=new int[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static Integer[] nextIntegerArray(int n) {\n Integer[] a=new Integer[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static int[][] nextIntMatrix(int n,int m) {\n int[][] a=new int[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n public static Integer[][] nextIntegerMatrix(int n,int m) {\n Integer[][] a=new Integer[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n //print\n public static void printIntArray(int[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntegerArray(Integer[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntMatrix(int[][] a) {\n for(int[] i:a) {\n for(int j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void printIntegerMatrix(Integer[][] a) {\n for(Integer[] i:a) {\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void help(int t,int n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,String n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,char[] n) { out.print(\"Test Case: \"+(t+1)+\" | Variable Output: \"); for(char c:n) out.print(c+\" \"); out.println(); }\n}",
"Main",
"public static MyScanner scan;",
"scan",
"public static PrintWriter out;",
"out",
"public static void main(String[] args) {\n scan=new MyScanner();\n out=new PrintWriter(new BufferedOutputStream(System.out));\n\n int t=1;\n// int t=scan.nextInt();\n while(t-->0) {\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }\n out.close();\n }",
"main",
"{\n scan=new MyScanner();\n out=new PrintWriter(new BufferedOutputStream(System.out));\n\n int t=1;\n// int t=scan.nextInt();\n while(t-->0) {\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }\n out.close();\n }",
"scan=new MyScanner()",
"scan",
"new MyScanner()",
"out=new PrintWriter(new BufferedOutputStream(System.out))",
"out",
"new PrintWriter(new BufferedOutputStream(System.out))",
"int t=1;",
"t",
"1",
"while(t-->0) {\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }",
"t-->0",
"t--",
"t",
"0",
"{\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }",
"int x=scan.nextInt()",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"n=scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"ArrayList<Integer> a=new ArrayList<>();",
"a",
"new ArrayList<>()",
"for(int c=0;c<n;c++) a.add(scan.nextInt());",
"int c=0;",
"int c=0;",
"c",
"0",
"c<n",
"c",
"n",
"c++",
"c++",
"c",
"a.add(scan.nextInt());",
"a.add(scan.nextInt())",
"a.add",
"a",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int l=x",
"l",
"x",
"r=x;",
"r",
"x",
"while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }",
"true",
"{\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }",
"if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }",
"a.contains(l)",
"a.contains",
"a",
"l",
"l--",
"l",
"{\n out.println(l);\n break;\n }",
"out.println(l)",
"out.println",
"out",
"l",
"break;",
"if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }",
"a.contains(r)",
"a.contains",
"a",
"r",
"r++",
"r",
"{\n out.println(r);\n break;\n }",
"out.println(r)",
"out.println",
"out",
"r",
"break;",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"//util\n public static int gcd(int a, int b) {\n if (b == 0)\n return a;\n if (a == 0)\n return b;\n return (a > b) ? gcd(a % b, b) : gcd(a, b % a);\n }",
"gcd",
"{\n if (b == 0)\n return a;\n if (a == 0)\n return b;\n return (a > b) ? gcd(a % b, b) : gcd(a, b % a);\n }",
"if (b == 0)\n return a;",
"b == 0",
"b",
"0",
"return a;",
"a",
"if (a == 0)\n return b;",
"a == 0",
"a",
"0",
"return b;",
"b",
"return (a > b) ? gcd(a % b, b) : gcd(a, b % a);",
"(a > b) ? gcd(a % b, b) : gcd(a, b % a)",
"(a > b)",
"a",
"b",
"gcd(a % b, b)",
"gcd",
"a % b",
"a",
"b",
"b",
"gcd(a, b % a)",
"gcd",
"a",
"b % a",
"b",
"a",
"int a",
"a",
"int b",
"b",
"public static int lcm(int a, int 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",
"int a",
"a",
"int b",
"b",
"public static int min(int a,int b) {\n if(a<=b) return a;\n else return b;\n }",
"min",
"{\n if(a<=b) return a;\n else return b;\n }",
"if(a<=b) return a;\n else return b;",
"a<=b",
"a",
"b",
"return a;",
"a",
"return b;",
"b",
"int a",
"a",
"int b",
"b",
"public static int max(int a,int b) {\n if(a>=b) return a;\n else return b;\n }",
"max",
"{\n if(a>=b) return a;\n else return b;\n }",
"if(a>=b) return a;\n else return b;",
"a>=b",
"a",
"b",
"return a;",
"a",
"return b;",
"b",
"int a",
"a",
"int b",
"b",
"public static int abs(int a) {\n if(a<0) return a*-1;\n else return a;\n }",
"abs",
"{\n if(a<0) return a*-1;\n else return a;\n }",
"if(a<0) return a*-1;\n else return a;",
"a<0",
"a",
"0",
"return a*-1;",
"a*-1",
"a",
"-1",
"1",
"return a;",
"a",
"int a",
"a",
"public static ArrayList<Integer> getPrimes(int n) {\n boolean prime[]=new boolean[n+1];\n Arrays.fill(prime,true);\n for (int p=2;p*p<=n;p++) {\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }\n ArrayList<Integer> primeNumbers=new ArrayList<Integer>();\n for (int i = 2; i <= n; i++) {\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }\n return primeNumbers;\n }",
"getPrimes",
"{\n boolean prime[]=new boolean[n+1];\n Arrays.fill(prime,true);\n for (int p=2;p*p<=n;p++) {\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }\n ArrayList<Integer> primeNumbers=new ArrayList<Integer>();\n for (int i = 2; i <= n; i++) {\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }\n return primeNumbers;\n }",
"boolean prime[]=new boolean[n+1];",
"prime",
"new boolean[n+1]",
"n+1",
"n",
"1",
"Arrays.fill(prime,true)",
"Arrays.fill",
"Arrays",
"prime",
"true",
"for (int p=2;p*p<=n;p++) {\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }",
"int p=2;",
"int p=2;",
"p",
"2",
"p*p<=n",
"p*p",
"p",
"p",
"n",
"p++",
"p++",
"p",
"{\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }",
"{\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }",
"if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }",
"prime[p]",
"prime",
"p",
"{\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }",
"for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }",
"int i=p*2;",
"int i=p*2;",
"i",
"p*2",
"p",
"2",
"i<=n",
"i",
"n",
"i+=p",
"i+=p",
"i",
"p",
"{\n prime[i]=false;\n }",
"{\n prime[i]=false;\n }",
"prime[i]=false",
"prime[i]",
"prime",
"i",
"false",
"ArrayList<Integer> primeNumbers=new ArrayList<Integer>();",
"primeNumbers",
"new ArrayList<Integer>()",
"for (int i = 2; i <= n; i++) {\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }",
"int i = 2;",
"int i = 2;",
"i",
"2",
"i <= n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }",
"{\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }",
"if (prime[i]) {\n primeNumbers.add(i);\n }",
"prime[i]",
"prime",
"i",
"{\n primeNumbers.add(i);\n }",
"primeNumbers.add(i)",
"primeNumbers.add",
"primeNumbers",
"i",
"return primeNumbers;",
"primeNumbers",
"int n",
"n",
"public static boolean isPrime(int a) {\n if (a == 0 || a == 1) {\n return false;\n }\n if (a == 2) {\n return true;\n }\n for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n return false;\n }\n }\n return true;\n }",
"isPrime",
"{\n if (a == 0 || a == 1) {\n return false;\n }\n if (a == 2) {\n return true;\n }\n for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n return false;\n }\n }\n return true;\n }",
"if (a == 0 || a == 1) {\n return false;\n }",
"a == 0 || a == 1",
"a == 0",
"a",
"0",
"a == 1",
"a",
"1",
"{\n return false;\n }",
"return false;",
"false",
"if (a == 2) {\n return true;\n }",
"a == 2",
"a",
"2",
"{\n return true;\n }",
"return true;",
"true",
"for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n return false;\n }\n }",
"int i = 2;",
"int i = 2;",
"i",
"2",
"i < Math.sqrt(a) + 1",
"i",
"Math.sqrt(a) + 1",
"Math.sqrt(a)",
"Math.sqrt",
"Math",
"a",
"1",
"i++",
"i++",
"i",
"{\n if (a % i == 0) {\n return false;\n }\n }",
"{\n if (a % i == 0) {\n return false;\n }\n }",
"if (a % i == 0) {\n return false;\n }",
"a % i == 0",
"a % i",
"a",
"i",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"int a",
"a",
"public static ArrayList<Integer> getDivisors(int n) {\n ArrayList<Integer> div = new ArrayList<Integer>();\n for (int i=1;i*i<=n;i++) {\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }\n return div;\n }",
"getDivisors",
"{\n ArrayList<Integer> div = new ArrayList<Integer>();\n for (int i=1;i*i<=n;i++) {\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }\n return div;\n }",
"ArrayList<Integer> div = new ArrayList<Integer>();",
"div",
"new ArrayList<Integer>()",
"for (int i=1;i*i<=n;i++) {\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i*i<=n",
"i*i",
"i",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }",
"{\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }",
"if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }",
"n%i==0",
"n%i",
"n",
"i",
"0",
"{\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }",
"div.add(i)",
"div.add",
"div",
"i",
"if (n/i!=i)\n div.add(n/i);",
"n/i!=i",
"n/i",
"n",
"i",
"i",
"div.add(n/i)",
"div.add",
"div",
"n/i",
"n",
"i",
"return div;",
"div",
"int n",
"n",
"public static int[] nextIntArray(int n) {\n int[] a=new int[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }",
"nextIntArray",
"{\n int[] a=new int[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }",
"int[] a=new int[n];",
"a",
"new int[n]",
"n",
"for(int c=0;c<n;c++) a[c]=scan.nextInt();",
"int c=0;",
"int c=0;",
"c",
"0",
"c<n",
"c",
"n",
"c++",
"c++",
"c",
"a[c]=scan.nextInt();",
"a[c]=scan.nextInt()",
"a[c]",
"a",
"c",
"scan.nextInt()",
"scan.nextInt",
"scan",
"return a;",
"a",
"int n",
"n",
"public static Integer[] nextIntegerArray(int n) {\n Integer[] a=new Integer[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }",
"nextIntegerArray",
"{\n Integer[] a=new Integer[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }",
"Integer[] a=new Integer[n];",
"a",
"new Integer[n]",
"n",
"for(int c=0;c<n;c++) a[c]=scan.nextInt();",
"int c=0;",
"int c=0;",
"c",
"0",
"c<n",
"c",
"n",
"c++",
"c++",
"c",
"a[c]=scan.nextInt();",
"a[c]=scan.nextInt()",
"a[c]",
"a",
"c",
"scan.nextInt()",
"scan.nextInt",
"scan",
"return a;",
"a",
"int n",
"n",
"public static int[][] nextIntMatrix(int n,int m) {\n int[][] a=new int[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }",
"nextIntMatrix",
"{\n int[][] a=new int[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }",
"int[][] a=new int[n][m];",
"a",
"new int[n][m]",
"n",
"m",
"for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"for(int j=0;j<m;j++) a[i][j]=scan.nextInt();",
"for(int j=0;j<m;j++) a[i][j]=scan.nextInt();",
"int j=0;",
"int j=0;",
"j",
"0",
"j<m",
"j",
"m",
"j++",
"j++",
"j",
"a[i][j]=scan.nextInt();",
"a[i][j]=scan.nextInt()",
"a[i][j]",
"a[i]",
"a",
"i",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"return a;",
"a",
"int n",
"n",
"int m",
"m",
"public static Integer[][] nextIntegerMatrix(int n,int m) {\n Integer[][] a=new Integer[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }",
"nextIntegerMatrix",
"{\n Integer[][] a=new Integer[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }",
"Integer[][] a=new Integer[n][m];",
"a",
"new Integer[n][m]",
"n",
"m",
"for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"for(int j=0;j<m;j++) a[i][j]=scan.nextInt();",
"for(int j=0;j<m;j++) a[i][j]=scan.nextInt();",
"int j=0;",
"int j=0;",
"j",
"0",
"j<m",
"j",
"m",
"j++",
"j++",
"j",
"a[i][j]=scan.nextInt();",
"a[i][j]=scan.nextInt()",
"a[i][j]",
"a[i]",
"a",
"i",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"return a;",
"a",
"int n",
"n",
"int m",
"m",
"//print\n public static void printIntArray(int[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }",
"printIntArray",
"{\n for(int c:a) out.print(c+\" \");\n out.println();\n }",
"for(int c:a) out.print(c+\" \");",
"int c",
"a",
"out.print(c+\" \");",
"out.print(c+\" \")",
"out.print",
"out",
"c+\" \"",
"c",
"\" \"",
"out.println()",
"out.println",
"out",
"int[] a",
"a",
"public static void printIntegerArray(Integer[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }",
"printIntegerArray",
"{\n for(int c:a) out.print(c+\" \");\n out.println();\n }",
"for(int c:a) out.print(c+\" \");",
"int c",
"a",
"out.print(c+\" \");",
"out.print(c+\" \")",
"out.print",
"out",
"c+\" \"",
"c",
"\" \"",
"out.println()",
"out.println",
"out",
"Integer[] a",
"a",
"public static void printIntMatrix(int[][] a) {\n for(int[] i:a) {\n for(int j:i) out.print(j+\" \");\n out.println();\n }\n }",
"printIntMatrix",
"{\n for(int[] i:a) {\n for(int j:i) out.print(j+\" \");\n out.println();\n }\n }",
"for(int[] i:a) {\n for(int j:i) out.print(j+\" \");\n out.println();\n }",
"int[] i",
"a",
"{\n for(int j:i) out.print(j+\" \");\n out.println();\n }",
"{\n for(int j:i) out.print(j+\" \");\n out.println();\n }",
"for(int j:i) out.print(j+\" \");",
"int j",
"i",
"out.print(j+\" \");",
"out.print(j+\" \")",
"out.print",
"out",
"j+\" \"",
"j",
"\" \"",
"out.println()",
"out.println",
"out",
"int[][] a",
"a",
"public static void printIntegerMatrix(Integer[][] a) {\n for(Integer[] i:a) {\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }\n }",
"printIntegerMatrix",
"{\n for(Integer[] i:a) {\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }\n }",
"for(Integer[] i:a) {\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }",
"Integer[] i",
"a",
"{\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }",
"{\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }",
"for(Integer j:i) out.print(j+\" \");",
"Integer j",
"i",
"out.print(j+\" \");",
"out.print(j+\" \")",
"out.print",
"out",
"j+\" \"",
"j",
"\" \"",
"out.println()",
"out.println",
"out",
"Integer[][] a",
"a",
"public static void help(int t,int n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }",
"help",
"{ out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }",
"out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n)",
"out.println",
"out",
"\"Test Case: \"+(t+1)+\" | Variable Output: \"+n",
"\" | Variable Output: \"",
"\"Test Case: \"+(t+1)+\" | Variable Output: \"+n",
"\"Test Case: \"",
"(t+1)",
"t",
"1",
"\" | Variable Output: \"",
"n",
"int t",
"t",
"int n",
"n",
"public static void help(int t,String n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }",
"help",
"{ out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }",
"out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n)",
"out.println",
"out",
"\"Test Case: \"+(t+1)+\" | Variable Output: \"+n",
"\" | Variable Output: \"",
"\"Test Case: \"+(t+1)+\" | Variable Output: \"+n",
"\"Test Case: \"",
"(t+1)",
"t",
"1",
"\" | Variable Output: \"",
"n",
"int t",
"t",
"String n",
"n",
"public static void help(int t,char[] n) { out.print(\"Test Case: \"+(t+1)+\" | Variable Output: \"); for(char c:n) out.print(c+\" \"); out.println(); }",
"help",
"{ out.print(\"Test Case: \"+(t+1)+\" | Variable Output: \"); for(char c:n) out.print(c+\" \"); out.println(); }",
"out.print(\"Test Case: \"+(t+1)+\" | Variable Output: \")",
"out.print",
"out",
"\"Test Case: \"+(t+1)+\" | Variable Output: \"",
"\"Test Case: \"+(t+1)+\" | Variable Output: \"",
"\"Test Case: \"",
"(t+1)",
"t",
"1",
"\" | Variable Output: \"",
"for(char c:n) out.print(c+\" \");",
"char c",
"n",
"out.print(c+\" \");",
"out.print(c+\" \")",
"out.print",
"out",
"c+\" \"",
"c",
"\" \"",
"out.println()",
"out.println",
"out",
"int t",
"t",
"char[] n",
"n",
"static class Node implements Comparable<Node> {\n public int x,y;\n public Node(int x,int y) {\n this.x=x;\n this.y=y;\n }\n\n public int compareTo(Node other) {\n if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;\n }\n\n public boolean equals(Node other) {\n return this.x==other.x;\n }\n\n// public int compareTo(Node other) {\n// if(this.y==other.y) return 0;\n// else if(this.y>other.y) return 1;\n// else return -1;\n// }\n//\n// public boolean equals(Node other) {\n// return this.y==other.y;\n// }\n }",
"Node",
"public int x",
"x",
"y;",
"y",
"public Node(int x,int y) {\n this.x=x;\n this.y=y;\n }",
"Node",
"{\n this.x=x;\n this.y=y;\n }",
"this.x=x",
"this.x",
"this",
"this.x",
"x",
"this.y=y",
"this.y",
"this",
"this.y",
"y",
"int x",
"x",
"int y",
"y",
"public int compareTo(Node other) {\n if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;\n }",
"compareTo",
"{\n if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;\n }",
"if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;",
"this.x==other.x",
"this.x",
"this",
"this.x",
"other.x",
"other",
"other.x",
"return 0;",
"0",
"if(this.x>other.x) return 1;\n else return -1;",
"this.x>other.x",
"this.x",
"this",
"this.x",
"other.x",
"other",
"other.x",
"return 1;",
"1",
"return -1;",
"-1",
"1",
"Node other",
"other",
"public boolean equals(Node other) {\n return this.x==other.x;\n }",
"equals",
"{\n return this.x==other.x;\n }",
"return this.x==other.x;",
"this.x==other.x",
"this.x",
"this",
"this.x",
"other.x",
"other",
"other.x",
"Node other",
"other",
"Comparable",
"static class Edge implements Comparable<Edge> {\n public Node a,b;\n public int weight;\n\n public Edge(Node a,Node b,int weight) {\n this.a=a;\n this.b=b;\n this.weight=weight;\n }\n\n public int compareTo(Edge other) {\n if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;\n }\n }",
"Edge",
"public Node a",
"a",
"b;",
"b",
"public int weight;",
"weight",
"public Edge(Node a,Node b,int weight) {\n this.a=a;\n this.b=b;\n this.weight=weight;\n }",
"Edge",
"{\n this.a=a;\n this.b=b;\n this.weight=weight;\n }",
"this.a=a",
"this.a",
"this",
"this.a",
"a",
"this.b=b",
"this.b",
"this",
"this.b",
"b",
"this.weight=weight",
"this.weight",
"this",
"this.weight",
"weight",
"Node a",
"a",
"Node b",
"b",
"int weight",
"weight",
"public int compareTo(Edge other) {\n if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;\n }",
"compareTo",
"{\n if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;\n }",
"if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;",
"this.weight==other.weight",
"this.weight",
"this",
"this.weight",
"other.weight",
"other",
"other.weight",
"return 0;",
"0",
"if(this.weight>other.weight) return 1;\n else return -1;",
"this.weight>other.weight",
"this.weight",
"this",
"this.weight",
"other.weight",
"other",
"other.weight",
"return 1;",
"1",
"return -1;",
"-1",
"1",
"Edge other",
"other",
"Comparable",
"public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }",
"MyScanner",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }",
"MyScanner",
"{\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 } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"nextLine",
"{\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"String str = \"\";",
"str",
"\"\"",
"try {\n str = 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 str = br.readLine();\n }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main {\n public static MyScanner scan;\n public static PrintWriter out;\n public static void main(String[] args) {\n scan=new MyScanner();\n out=new PrintWriter(new BufferedOutputStream(System.out));\n\n int t=1;\n// int t=scan.nextInt();\n while(t-->0) {\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }\n out.close();\n }\n\n //-----------------------------------------------------COMP-SPACE-----------------------------------------------------\n\n\n\n //--------------------------------------------------------------------------------------------------------------------\n\n //node\n static class Node implements Comparable<Node> {\n public int x,y;\n public Node(int x,int y) {\n this.x=x;\n this.y=y;\n }\n\n public int compareTo(Node other) {\n if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;\n }\n\n public boolean equals(Node other) {\n return this.x==other.x;\n }\n\n// public int compareTo(Node other) {\n// if(this.y==other.y) return 0;\n// else if(this.y>other.y) return 1;\n// else return -1;\n// }\n//\n// public boolean equals(Node other) {\n// return this.y==other.y;\n// }\n }\n //edge\n static class Edge implements Comparable<Edge> {\n public Node a,b;\n public int weight;\n\n public Edge(Node a,Node b,int weight) {\n this.a=a;\n this.b=b;\n this.weight=weight;\n }\n\n public int compareTo(Edge other) {\n if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;\n }\n }\n\n //util\n public static int gcd(int a, int b) {\n if (b == 0)\n return a;\n if (a == 0)\n return b;\n return (a > b) ? gcd(a % b, b) : gcd(a, b % a);\n }\n\n public static int lcm(int a, int b) {\n return a * b / gcd(a, b);\n }\n\n public static int min(int a,int b) {\n if(a<=b) return a;\n else return b;\n }\n\n public static int max(int a,int b) {\n if(a>=b) return a;\n else return b;\n }\n\n public static int abs(int a) {\n if(a<0) return a*-1;\n else return a;\n }\n\n public static ArrayList<Integer> getPrimes(int n) {\n boolean prime[]=new boolean[n+1];\n Arrays.fill(prime,true);\n for (int p=2;p*p<=n;p++) {\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }\n ArrayList<Integer> primeNumbers=new ArrayList<Integer>();\n for (int i = 2; i <= n; i++) {\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }\n return primeNumbers;\n }\n\n public static boolean isPrime(int a) {\n if (a == 0 || a == 1) {\n return false;\n }\n if (a == 2) {\n return true;\n }\n for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n return false;\n }\n }\n return true;\n }\n\n public static ArrayList<Integer> getDivisors(int n) {\n ArrayList<Integer> div = new ArrayList<Integer>();\n for (int i=1;i*i<=n;i++) {\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }\n return div;\n }\n\n //scanner\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n public static int[] nextIntArray(int n) {\n int[] a=new int[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static Integer[] nextIntegerArray(int n) {\n Integer[] a=new Integer[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static int[][] nextIntMatrix(int n,int m) {\n int[][] a=new int[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n public static Integer[][] nextIntegerMatrix(int n,int m) {\n Integer[][] a=new Integer[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n //print\n public static void printIntArray(int[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntegerArray(Integer[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntMatrix(int[][] a) {\n for(int[] i:a) {\n for(int j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void printIntegerMatrix(Integer[][] a) {\n for(Integer[] i:a) {\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void help(int t,int n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,String n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,char[] n) { out.print(\"Test Case: \"+(t+1)+\" | Variable Output: \"); for(char c:n) out.print(c+\" \"); out.println(); }\n}",
"public class Main {\n public static MyScanner scan;\n public static PrintWriter out;\n public static void main(String[] args) {\n scan=new MyScanner();\n out=new PrintWriter(new BufferedOutputStream(System.out));\n\n int t=1;\n// int t=scan.nextInt();\n while(t-->0) {\n\n int x=scan.nextInt(),n=scan.nextInt();\n ArrayList<Integer> a=new ArrayList<>();\n for(int c=0;c<n;c++) a.add(scan.nextInt());\n\n int l=x,r=x;\n while(true) {\n if(a.contains(l)) l--;\n else {\n out.println(l);\n break;\n }\n if(a.contains(r)) r++;\n else {\n out.println(r);\n break;\n }\n }\n\n }\n out.close();\n }\n\n //-----------------------------------------------------COMP-SPACE-----------------------------------------------------\n\n\n\n //--------------------------------------------------------------------------------------------------------------------\n\n //node\n static class Node implements Comparable<Node> {\n public int x,y;\n public Node(int x,int y) {\n this.x=x;\n this.y=y;\n }\n\n public int compareTo(Node other) {\n if(this.x==other.x) return 0;\n else if(this.x>other.x) return 1;\n else return -1;\n }\n\n public boolean equals(Node other) {\n return this.x==other.x;\n }\n\n// public int compareTo(Node other) {\n// if(this.y==other.y) return 0;\n// else if(this.y>other.y) return 1;\n// else return -1;\n// }\n//\n// public boolean equals(Node other) {\n// return this.y==other.y;\n// }\n }\n //edge\n static class Edge implements Comparable<Edge> {\n public Node a,b;\n public int weight;\n\n public Edge(Node a,Node b,int weight) {\n this.a=a;\n this.b=b;\n this.weight=weight;\n }\n\n public int compareTo(Edge other) {\n if(this.weight==other.weight) return 0;\n else if(this.weight>other.weight) return 1;\n else return -1;\n }\n }\n\n //util\n public static int gcd(int a, int b) {\n if (b == 0)\n return a;\n if (a == 0)\n return b;\n return (a > b) ? gcd(a % b, b) : gcd(a, b % a);\n }\n\n public static int lcm(int a, int b) {\n return a * b / gcd(a, b);\n }\n\n public static int min(int a,int b) {\n if(a<=b) return a;\n else return b;\n }\n\n public static int max(int a,int b) {\n if(a>=b) return a;\n else return b;\n }\n\n public static int abs(int a) {\n if(a<0) return a*-1;\n else return a;\n }\n\n public static ArrayList<Integer> getPrimes(int n) {\n boolean prime[]=new boolean[n+1];\n Arrays.fill(prime,true);\n for (int p=2;p*p<=n;p++) {\n if (prime[p]) {\n for (int i=p*2;i<=n;i+=p) {\n prime[i]=false;\n }\n }\n }\n ArrayList<Integer> primeNumbers=new ArrayList<Integer>();\n for (int i = 2; i <= n; i++) {\n if (prime[i]) {\n primeNumbers.add(i);\n }\n }\n return primeNumbers;\n }\n\n public static boolean isPrime(int a) {\n if (a == 0 || a == 1) {\n return false;\n }\n if (a == 2) {\n return true;\n }\n for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n return false;\n }\n }\n return true;\n }\n\n public static ArrayList<Integer> getDivisors(int n) {\n ArrayList<Integer> div = new ArrayList<Integer>();\n for (int i=1;i*i<=n;i++) {\n if (n%i==0) {\n div.add(i);\n if (n/i!=i)\n div.add(n/i);\n }\n }\n return div;\n }\n\n //scanner\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n public static int[] nextIntArray(int n) {\n int[] a=new int[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static Integer[] nextIntegerArray(int n) {\n Integer[] a=new Integer[n];\n for(int c=0;c<n;c++) a[c]=scan.nextInt();\n return a;\n }\n\n public static int[][] nextIntMatrix(int n,int m) {\n int[][] a=new int[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n public static Integer[][] nextIntegerMatrix(int n,int m) {\n Integer[][] a=new Integer[n][m];\n for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();\n return a;\n }\n\n //print\n public static void printIntArray(int[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntegerArray(Integer[] a) {\n for(int c:a) out.print(c+\" \");\n out.println();\n }\n\n public static void printIntMatrix(int[][] a) {\n for(int[] i:a) {\n for(int j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void printIntegerMatrix(Integer[][] a) {\n for(Integer[] i:a) {\n for(Integer j:i) out.print(j+\" \");\n out.println();\n }\n }\n\n public static void help(int t,int n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,String n) { out.println(\"Test Case: \"+(t+1)+\" | Variable Output: \"+n); }\n public static void help(int t,char[] n) { out.print(\"Test Case: \"+(t+1)+\" | Variable Output: \"); for(char c:n) out.print(c+\" \"); out.println(); }\n}",
"Main"
]
| import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
public static MyScanner scan;
public static PrintWriter out;
public static void main(String[] args) {
scan=new MyScanner();
out=new PrintWriter(new BufferedOutputStream(System.out));
int t=1;
// int t=scan.nextInt();
while(t-->0) {
int x=scan.nextInt(),n=scan.nextInt();
ArrayList<Integer> a=new ArrayList<>();
for(int c=0;c<n;c++) a.add(scan.nextInt());
int l=x,r=x;
while(true) {
if(a.contains(l)) l--;
else {
out.println(l);
break;
}
if(a.contains(r)) r++;
else {
out.println(r);
break;
}
}
}
out.close();
}
//-----------------------------------------------------COMP-SPACE-----------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------
//node
static class Node implements Comparable<Node> {
public int x,y;
public Node(int x,int y) {
this.x=x;
this.y=y;
}
public int compareTo(Node other) {
if(this.x==other.x) return 0;
else if(this.x>other.x) return 1;
else return -1;
}
public boolean equals(Node other) {
return this.x==other.x;
}
// public int compareTo(Node other) {
// if(this.y==other.y) return 0;
// else if(this.y>other.y) return 1;
// else return -1;
// }
//
// public boolean equals(Node other) {
// return this.y==other.y;
// }
}
//edge
static class Edge implements Comparable<Edge> {
public Node a,b;
public int weight;
public Edge(Node a,Node b,int weight) {
this.a=a;
this.b=b;
this.weight=weight;
}
public int compareTo(Edge other) {
if(this.weight==other.weight) return 0;
else if(this.weight>other.weight) return 1;
else return -1;
}
}
//util
public static int gcd(int a, int b) {
if (b == 0)
return a;
if (a == 0)
return b;
return (a > b) ? gcd(a % b, b) : gcd(a, b % a);
}
public static int lcm(int a, int b) {
return a * b / gcd(a, b);
}
public static int min(int a,int b) {
if(a<=b) return a;
else return b;
}
public static int max(int a,int b) {
if(a>=b) return a;
else return b;
}
public static int abs(int a) {
if(a<0) return a*-1;
else return a;
}
public static ArrayList<Integer> getPrimes(int n) {
boolean prime[]=new boolean[n+1];
Arrays.fill(prime,true);
for (int p=2;p*p<=n;p++) {
if (prime[p]) {
for (int i=p*2;i<=n;i+=p) {
prime[i]=false;
}
}
}
ArrayList<Integer> primeNumbers=new ArrayList<Integer>();
for (int i = 2; i <= n; i++) {
if (prime[i]) {
primeNumbers.add(i);
}
}
return primeNumbers;
}
public static boolean isPrime(int a) {
if (a == 0 || a == 1) {
return false;
}
if (a == 2) {
return true;
}
for (int i = 2; i < Math.sqrt(a) + 1; i++) {
if (a % i == 0) {
return false;
}
}
return true;
}
public static ArrayList<Integer> getDivisors(int n) {
ArrayList<Integer> div = new ArrayList<Integer>();
for (int i=1;i*i<=n;i++) {
if (n%i==0) {
div.add(i);
if (n/i!=i)
div.add(n/i);
}
}
return div;
}
//scanner
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
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;
}
}
public static int[] nextIntArray(int n) {
int[] a=new int[n];
for(int c=0;c<n;c++) a[c]=scan.nextInt();
return a;
}
public static Integer[] nextIntegerArray(int n) {
Integer[] a=new Integer[n];
for(int c=0;c<n;c++) a[c]=scan.nextInt();
return a;
}
public static int[][] nextIntMatrix(int n,int m) {
int[][] a=new int[n][m];
for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();
return a;
}
public static Integer[][] nextIntegerMatrix(int n,int m) {
Integer[][] a=new Integer[n][m];
for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=scan.nextInt();
return a;
}
//print
public static void printIntArray(int[] a) {
for(int c:a) out.print(c+" ");
out.println();
}
public static void printIntegerArray(Integer[] a) {
for(int c:a) out.print(c+" ");
out.println();
}
public static void printIntMatrix(int[][] a) {
for(int[] i:a) {
for(int j:i) out.print(j+" ");
out.println();
}
}
public static void printIntegerMatrix(Integer[][] a) {
for(Integer[] i:a) {
for(Integer j:i) out.print(j+" ");
out.println();
}
}
public static void help(int t,int n) { out.println("Test Case: "+(t+1)+" | Variable Output: "+n); }
public static void help(int t,String n) { out.println("Test Case: "+(t+1)+" | Variable Output: "+n); }
public static void help(int t,char[] n) { out.print("Test Case: "+(t+1)+" | Variable Output: "); for(char c:n) out.print(c+" "); out.println(); }
} |
[
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,
40,
17,
42,
18,
13,
13,
30,
0,
13,
13,
0,
13,
8,
2,
13,
17,
2,
40,
13,
17,
2,
40,
13,
17,
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
],
[
354,
11
],
[
354,
12
],
[
12,
13
],
[
12,
14
],
[
354,
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
],
[
60,
61
],
[
17,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
17,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
15,
88
],
[
88,
89
],
[
354,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
90,
96
],
[
96,
97
],
[
96,
98
],
[
90,
99
],
[
99,
100
],
[
99,
101
],
[
90,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
90,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
123,
126
],
[
123,
127
],
[
127,
128
],
[
127,
129
],
[
115,
130
],
[
130,
131
],
[
130,
132
],
[
110,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
90,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
90,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
150,
155
],
[
155,
156
],
[
157,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
161,
163
],
[
157,
164
],
[
164,
165
],
[
164,
166
],
[
155,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
172,
174
],
[
168,
175
],
[
175,
176
],
[
167,
177
],
[
177,
178
],
[
90,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
184,
189
],
[
189,
190
],
[
191,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
191,
195
],
[
195,
196
],
[
195,
197
],
[
191,
198
],
[
198,
199
],
[
198,
200
],
[
189,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
90,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
207,
210
],
[
210,
211
],
[
210,
212
],
[
207,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
214,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
221,
223
],
[
214,
224
],
[
224,
225
],
[
225,
226
],
[
214,
227
],
[
228,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
229,
233
],
[
233,
234
],
[
207,
235
],
[
235,
236
],
[
205,
237
],
[
237,
238
],
[
90,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
241,
246
],
[
246,
247
],
[
246,
248
],
[
241,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
255,
256
],
[
254,
257
],
[
251,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
259,
263
],
[
263,
264
],
[
263,
265
],
[
258,
266
],
[
251,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
269,
273
],
[
241,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
275,
279
],
[
90,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
287
],
[
287,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
287,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
294,
296
],
[
287,
297
],
[
297,
298
],
[
298,
299
],
[
287,
300
],
[
300,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
301,
305
],
[
305,
306
],
[
282,
307
],
[
307,
308
],
[
280,
309
],
[
309,
310
],
[
90,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
316,
317
],
[
313,
318
],
[
318,
319
],
[
318,
320
],
[
313,
321
],
[
321,
322
],
[
321,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
327,
328
],
[
326,
329
],
[
323,
330
],
[
330,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
331,
335
],
[
335,
336
],
[
335,
337
],
[
330,
338
],
[
323,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
341,
345
],
[
313,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
347,
351
],
[
90,
352
],
[
0,
353
],
[
353,
354
],
[
353,
355
]
]
| [
"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 i = -1;\n while (b[x]) {\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }\n out.println(x);\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 i = -1;\n while (b[x]) {\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }\n out.println(x);\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 i = -1;\n while (b[x]) {\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }\n out.println(x);\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 i = -1;\n while (b[x]) {\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }\n out.println(x);\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 i = -1;",
"i",
"-1",
"1",
"while (b[x]) {\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }",
"b[x]",
"b",
"x",
"{\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }",
"x += i",
"x",
"i",
"i = i > 0 ? -i - 1 : -i + 1",
"i",
"i > 0 ? -i - 1 : -i + 1",
"i > 0",
"i",
"0",
"-i - 1",
"-i",
"i",
"1",
"-i + 1",
"-i",
"i",
"1",
"out.println(x)",
"out.println",
"out",
"x",
"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 i = -1;\n while (b[x]) {\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }\n out.println(x);\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 i = -1;\n while (b[x]) {\n x += i;\n i = i > 0 ? -i - 1 : -i + 1;\n }\n out.println(x);\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 i = -1;
while (b[x]) {
x += i;
i = i > 0 ? -i - 1 : -i + 1;
}
out.println(x);
}
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,
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,
4,
18,
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,
17,
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,
4,
18,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
112,
5
],
[
112,
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
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
26,
36
],
[
8,
37
],
[
37,
38
],
[
37,
39
],
[
8,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
8,
59
],
[
59,
60
],
[
59,
61
],
[
8,
62
],
[
62,
63
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
68,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
67,
98
],
[
98,
99
],
[
8,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
6,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
]
| [
"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 \tif(N==0){\n System.out.println(String.valueOf(X));\n return;\n }\n \n List<Integer> forbits = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n forbits.add(sc.nextInt());\n }\n \n int diff = 0;\n int answer = 0;\n while(true){\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }\n \n System.out.println(String.valueOf(answer));\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 \tif(N==0){\n System.out.println(String.valueOf(X));\n return;\n }\n \n List<Integer> forbits = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n forbits.add(sc.nextInt());\n }\n \n int diff = 0;\n int answer = 0;\n while(true){\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }\n \n System.out.println(String.valueOf(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 \tif(N==0){\n System.out.println(String.valueOf(X));\n return;\n }\n \n List<Integer> forbits = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n forbits.add(sc.nextInt());\n }\n \n int diff = 0;\n int answer = 0;\n while(true){\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }\n \n System.out.println(String.valueOf(answer));\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n \tif(N==0){\n System.out.println(String.valueOf(X));\n return;\n }\n \n List<Integer> forbits = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n forbits.add(sc.nextInt());\n }\n \n int diff = 0;\n int answer = 0;\n while(true){\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }\n \n System.out.println(String.valueOf(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(String.valueOf(X));\n return;\n }",
"N==0",
"N",
"0",
"{\n System.out.println(String.valueOf(X));\n return;\n }",
"System.out.println(String.valueOf(X))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.valueOf(X)",
"String.valueOf",
"String",
"X",
"return;",
"List<Integer> forbits = new ArrayList<Integer>();",
"forbits",
"new ArrayList<Integer>()",
"for(int i=0;i<N;i++){\n forbits.add(sc.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n forbits.add(sc.nextInt());\n }",
"{\n forbits.add(sc.nextInt());\n }",
"forbits.add(sc.nextInt())",
"forbits.add",
"forbits",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int diff = 0;",
"diff",
"0",
"int answer = 0;",
"answer",
"0",
"while(true){\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }",
"true",
"{\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }",
"if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }",
"!forbits.contains(X-diff)",
"forbits.contains(X-diff)",
"forbits.contains",
"forbits",
"X-diff",
"X",
"diff",
"{\n answer = X-diff;\n break;\n }",
"answer = X-diff",
"answer",
"X-diff",
"X",
"diff",
"break;",
"if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }",
"!forbits.contains(X+diff)",
"forbits.contains(X+diff)",
"forbits.contains",
"forbits",
"X+diff",
"X",
"diff",
"{\n answer = X+diff;\n break;\n }",
"answer = X+diff",
"answer",
"X+diff",
"X",
"diff",
"break;",
"diff++",
"diff",
"System.out.println(String.valueOf(answer))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.valueOf(answer)",
"String.valueOf",
"String",
"answer",
"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 \tif(N==0){\n System.out.println(String.valueOf(X));\n return;\n }\n \n List<Integer> forbits = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n forbits.add(sc.nextInt());\n }\n \n int diff = 0;\n int answer = 0;\n while(true){\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }\n \n System.out.println(String.valueOf(answer));\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 \tif(N==0){\n System.out.println(String.valueOf(X));\n return;\n }\n \n List<Integer> forbits = new ArrayList<Integer>();\n for(int i=0;i<N;i++){\n forbits.add(sc.nextInt());\n }\n \n int diff = 0;\n int answer = 0;\n while(true){\n if(!forbits.contains(X-diff)){\n answer = X-diff;\n break;\n } else if(!forbits.contains(X+diff)){\n answer = X+diff;\n break;\n }\n diff++;\n }\n \n System.out.println(String.valueOf(answer));\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(String.valueOf(X));
return;
}
List<Integer> forbits = new ArrayList<Integer>();
for(int i=0;i<N;i++){
forbits.add(sc.nextInt());
}
int diff = 0;
int answer = 0;
while(true){
if(!forbits.contains(X-diff)){
answer = X-diff;
break;
} else if(!forbits.contains(X+diff)){
answer = X+diff;
break;
}
diff++;
}
System.out.println(String.valueOf(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,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
4,
18,
4,
18,
13,
13,
13,
30,
9,
0,
13,
4,
18,
13,
13,
4,
18,
13,
2,
13,
13,
41,
13,
2,
13,
13,
14,
4,
18,
4,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
119,
5
],
[
119,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
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
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
51,
57
],
[
57,
58
],
[
57,
59
],
[
51,
60
],
[
60,
61
],
[
61,
62
],
[
51,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
66,
72
],
[
65,
73
],
[
73,
74
],
[
64,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
8,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
93,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
106,
108
],
[
92,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
6,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
]
| [
"//package atcoder;\n \nimport java.util.*;\n//import java.math.BigDecimal;\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\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\t\t/*for(int i=0;i<N;i++) {\n\t\t\tSystem.out.println(p[i]);\n\t\t}*/\n\t int min=Integer.MAX_VALUE;\n\t\tfor(int j=-1000;j<1000;j++) {\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}\n\t\tint a = X-min;\n\t\tif(Arrays.asList(p).contains(a)) {\n\t\t\tSystem.out.println(X+min);\n\t\t}else {\n\t\t\tSystem.out.println(a);\n\t\t}\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\t\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\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\t\t/*for(int i=0;i<N;i++) {\n\t\t\tSystem.out.println(p[i]);\n\t\t}*/\n\t int min=Integer.MAX_VALUE;\n\t\tfor(int j=-1000;j<1000;j++) {\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}\n\t\tint a = X-min;\n\t\tif(Arrays.asList(p).contains(a)) {\n\t\t\tSystem.out.println(X+min);\n\t\t}else {\n\t\t\tSystem.out.println(a);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\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\t\t/*for(int i=0;i<N;i++) {\n\t\t\tSystem.out.println(p[i]);\n\t\t}*/\n\t int min=Integer.MAX_VALUE;\n\t\tfor(int j=-1000;j<1000;j++) {\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}\n\t\tint a = X-min;\n\t\tif(Arrays.asList(p).contains(a)) {\n\t\t\tSystem.out.println(X+min);\n\t\t}else {\n\t\t\tSystem.out.println(a);\n\t\t}\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\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\t\t/*for(int i=0;i<N;i++) {\n\t\t\tSystem.out.println(p[i]);\n\t\t}*/\n\t int min=Integer.MAX_VALUE;\n\t\tfor(int j=-1000;j<1000;j++) {\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}\n\t\tint a = X-min;\n\t\tif(Arrays.asList(p).contains(a)) {\n\t\t\tSystem.out.println(X+min);\n\t\t}else {\n\t\t\tSystem.out.println(a);\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",
"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",
"int min=Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for(int j=-1000;j<1000;j++) {\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}",
"int j=-1000;",
"int j=-1000;",
"j",
"-1000",
"1000",
"j<1000",
"j",
"1000",
"j++",
"j++",
"j",
"{\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}",
"{\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}",
"if(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}",
"Arrays.asList(p).contains(j)",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"j",
"{\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}",
"continue;",
"min = Math.min(min, Math.abs(X-j))",
"min",
"Math.min(min, Math.abs(X-j))",
"Math.min",
"Math",
"min",
"Math.abs(X-j)",
"Math.abs",
"Math",
"X-j",
"X",
"j",
"int a = X-min;",
"a",
"X-min",
"X",
"min",
"if(Arrays.asList(p).contains(a)) {\n\t\t\tSystem.out.println(X+min);\n\t\t}else {\n\t\t\tSystem.out.println(a);\n\t\t}",
"Arrays.asList(p).contains(a)",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"a",
"{\n\t\t\tSystem.out.println(X+min);\n\t\t}",
"System.out.println(X+min)",
"System.out.println",
"System.out",
"System",
"System.out",
"X+min",
"X",
"min",
"{\n\t\t\tSystem.out.println(a);\n\t\t}",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"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\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\t\t/*for(int i=0;i<N;i++) {\n\t\t\tSystem.out.println(p[i]);\n\t\t}*/\n\t int min=Integer.MAX_VALUE;\n\t\tfor(int j=-1000;j<1000;j++) {\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}\n\t\tint a = X-min;\n\t\tif(Arrays.asList(p).contains(a)) {\n\t\t\tSystem.out.println(X+min);\n\t\t}else {\n\t\t\tSystem.out.println(a);\n\t\t}\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\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\t\t/*for(int i=0;i<N;i++) {\n\t\t\tSystem.out.println(p[i]);\n\t\t}*/\n\t int min=Integer.MAX_VALUE;\n\t\tfor(int j=-1000;j<1000;j++) {\n\t\t\tif(Arrays.asList(p).contains(j)) {\n\t\t\t\t//System.out.println(j);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//System.out.println(j);\n\t\t min = Math.min(min, Math.abs(X-j));\n\t\t}\n\t\tint a = X-min;\n\t\tif(Arrays.asList(p).contains(a)) {\n\t\t\tSystem.out.println(X+min);\n\t\t}else {\n\t\t\tSystem.out.println(a);\n\t\t}\n\t}\n}",
"Main"
]
| //package atcoder;
import java.util.*;
//import java.math.BigDecimal;
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();
}
/*for(int i=0;i<N;i++) {
System.out.println(p[i]);
}*/
int min=Integer.MAX_VALUE;
for(int j=-1000;j<1000;j++) {
if(Arrays.asList(p).contains(j)) {
//System.out.println(j);
continue;
}
//System.out.println(j);
min = Math.min(min, Math.abs(X-j));
}
int a = X-min;
if(Arrays.asList(p).contains(a)) {
System.out.println(X+min);
}else {
System.out.println(a);
}
}
} |
[
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,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
40,
13,
0,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
18,
13,
13,
2,
13,
17,
30,
40,
13,
0,
13,
40,
17,
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
],
[
139,
5
],
[
139,
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
],
[
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
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
98,
100
],
[
91,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
113,
115
],
[
109,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
119,
121
],
[
108,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
108,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
6,
136
],
[
136,
137
],
[
0,
138
],
[
138,
139
],
[
138,
140
]
]
| [
"import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tint[] c= new int[b];\n\t\tint d=a;\n\t\tint f=a;\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tc[i]=sc.nextInt();\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(d-a)>=Math.abs(f-a)) {\n\t\tSystem.out.println(f);\n\t\t}else {\n\t\t\tSystem.out.println(d);\n\t\t}\n\t\t\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tint[] c= new int[b];\n\t\tint d=a;\n\t\tint f=a;\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tc[i]=sc.nextInt();\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(d-a)>=Math.abs(f-a)) {\n\t\tSystem.out.println(f);\n\t\t}else {\n\t\t\tSystem.out.println(d);\n\t\t}\n\t\t\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tint[] c= new int[b];\n\t\tint d=a;\n\t\tint f=a;\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tc[i]=sc.nextInt();\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(d-a)>=Math.abs(f-a)) {\n\t\tSystem.out.println(f);\n\t\t}else {\n\t\t\tSystem.out.println(d);\n\t\t}\n\t\t\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tint[] c= new int[b];\n\t\tint d=a;\n\t\tint f=a;\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tc[i]=sc.nextInt();\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(d-a)>=Math.abs(f-a)) {\n\t\tSystem.out.println(f);\n\t\t}else {\n\t\t\tSystem.out.println(d);\n\t\t}\n\t\t\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int a=sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int b=sc.nextInt();",
"b",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] c= new int[b];",
"c",
"new int[b]",
"b",
"int d=a;",
"d",
"a",
"int f=a;",
"f",
"a",
"for(int i =0;i<b;i++) {\n\t\t\tc[i]=sc.nextInt();\n\t\t}",
"int i =0;",
"int i =0;",
"i",
"0",
"i<b",
"i",
"b",
"i++",
"i++",
"i",
"{\n\t\t\tc[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\tc[i]=sc.nextInt();\n\t\t}",
"c[i]=sc.nextInt()",
"c[i]",
"c",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i =0;i<b;i++) {\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}",
"int i =0;",
"int i =0;",
"i",
"0",
"i<b",
"i",
"b",
"i++",
"i++",
"i",
"{\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}",
"if(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}",
"d==c[i]",
"d",
"c[i]",
"c",
"i",
"{\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}",
"d++",
"d",
"i=-1",
"i",
"-1",
"1",
"for(int i =0;i<b;i++) {\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}",
"int i =0;",
"int i =0;",
"i",
"0",
"i<b",
"i",
"b",
"i++",
"i++",
"i",
"{\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}",
"if(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}",
"f==c[i]&&f>0",
"f==c[i]",
"f",
"c[i]",
"c",
"i",
"f>0",
"f",
"0",
"{\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}",
"f--",
"f",
"i=-1",
"i",
"-1",
"1",
"if(Math.abs(d-a)>=Math.abs(f-a)) {\n\t\tSystem.out.println(f);\n\t\t}else {\n\t\t\tSystem.out.println(d);\n\t\t}",
"Math.abs(d-a)>=Math.abs(f-a)",
"Math.abs(d-a)",
"Math.abs",
"Math",
"d-a",
"d",
"a",
"Math.abs(f-a)",
"Math.abs",
"Math",
"f-a",
"f",
"a",
"{\n\t\tSystem.out.println(f);\n\t\t}",
"System.out.println(f)",
"System.out.println",
"System.out",
"System",
"System.out",
"f",
"{\n\t\t\tSystem.out.println(d);\n\t\t}",
"System.out.println(d)",
"System.out.println",
"System.out",
"System",
"System.out",
"d",
"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 a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tint[] c= new int[b];\n\t\tint d=a;\n\t\tint f=a;\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tc[i]=sc.nextInt();\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(d-a)>=Math.abs(f-a)) {\n\t\tSystem.out.println(f);\n\t\t}else {\n\t\t\tSystem.out.println(d);\n\t\t}\n\t\t\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 a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tint[] c= new int[b];\n\t\tint d=a;\n\t\tint f=a;\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tc[i]=sc.nextInt();\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(d==c[i]) {\n\t\t\t\td++;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tfor(int i =0;i<b;i++) {\n\t\t\tif(f==c[i]&&f>0) {\n\t\t\t\tf--;\n\t\t\t\ti=-1;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(d-a)>=Math.abs(f-a)) {\n\t\tSystem.out.println(f);\n\t\t}else {\n\t\t\tSystem.out.println(d);\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 a=sc.nextInt();
int b=sc.nextInt();
int[] c= new int[b];
int d=a;
int f=a;
for(int i =0;i<b;i++) {
c[i]=sc.nextInt();
}
for(int i =0;i<b;i++) {
if(d==c[i]) {
d++;
i=-1;
}
}
for(int i =0;i<b;i++) {
if(f==c[i]&&f>0) {
f--;
i=-1;
}
}
if(Math.abs(d-a)>=Math.abs(f-a)) {
System.out.println(f);
}else {
System.out.println(d);
}
}
}
|
[
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,
0,
18,
13,
4,
18,
13,
17,
41,
13,
13,
41,
13,
13,
41,
13,
17,
41,
13,
13,
42,
40,
18,
13,
13,
30,
14,
2,
2,
13,
17,
17,
30,
0,
13,
17,
14,
18,
13,
13,
30,
0,
13,
13,
3,
14,
2,
2,
13,
17,
17,
30,
0,
13,
17,
14,
18,
13,
13,
30,
0,
13,
13,
3,
0,
13,
17,
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,
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
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
57,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
67,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
73,
75
],
[
8,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
81,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
81,
120
],
[
120,
121
],
[
120,
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 public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner s = new Scanner(System.in);\n int X = s.nextInt();\n int N = s.nextInt();\n Boolean check[] = new Boolean[102];\n for(int i = 0; i < 102; i++){\n check[i] = true;\n } \n for(int i = 0; i < N; i++ ) {\n check[s.nextInt()] = false;\n }\n int puraN = X;\n int maiN = X;\n int i = 0;\n int answer = X;\n while(!check[X]){\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n } \n \n System.out.println(answer); \n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner s = new Scanner(System.in);\n int X = s.nextInt();\n int N = s.nextInt();\n Boolean check[] = new Boolean[102];\n for(int i = 0; i < 102; i++){\n check[i] = true;\n } \n for(int i = 0; i < N; i++ ) {\n check[s.nextInt()] = false;\n }\n int puraN = X;\n int maiN = X;\n int i = 0;\n int answer = X;\n while(!check[X]){\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n } \n \n System.out.println(answer); \n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner s = new Scanner(System.in);\n int X = s.nextInt();\n int N = s.nextInt();\n Boolean check[] = new Boolean[102];\n for(int i = 0; i < 102; i++){\n check[i] = true;\n } \n for(int i = 0; i < N; i++ ) {\n check[s.nextInt()] = false;\n }\n int puraN = X;\n int maiN = X;\n int i = 0;\n int answer = X;\n while(!check[X]){\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n } \n \n System.out.println(answer); \n }",
"main",
"{\n // Your code here!\n Scanner s = new Scanner(System.in);\n int X = s.nextInt();\n int N = s.nextInt();\n Boolean check[] = new Boolean[102];\n for(int i = 0; i < 102; i++){\n check[i] = true;\n } \n for(int i = 0; i < N; i++ ) {\n check[s.nextInt()] = false;\n }\n int puraN = X;\n int maiN = X;\n int i = 0;\n int answer = X;\n while(!check[X]){\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n } \n \n System.out.println(answer); \n }",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int X = s.nextInt();",
"X",
"s.nextInt()",
"s.nextInt",
"s",
"int N = s.nextInt();",
"N",
"s.nextInt()",
"s.nextInt",
"s",
"Boolean check[] = new Boolean[102];",
"check",
"new Boolean[102]",
"102",
"for(int i = 0; i < 102; i++){\n check[i] = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 102",
"i",
"102",
"i++",
"i++",
"i",
"{\n check[i] = true;\n }",
"{\n check[i] = true;\n }",
"check[i] = true",
"check[i]",
"check",
"i",
"true",
"for(int i = 0; i < N; i++ ) {\n check[s.nextInt()] = false;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n check[s.nextInt()] = false;\n }",
"{\n check[s.nextInt()] = false;\n }",
"check[s.nextInt()] = false",
"check[s.nextInt()]",
"check",
"s.nextInt()",
"s.nextInt",
"s",
"false",
"int puraN = X;",
"puraN",
"X",
"int maiN = X;",
"maiN",
"X",
"int i = 0;",
"i",
"0",
"int answer = X;",
"answer",
"X",
"while(!check[X]){\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n }",
"!check[X]",
"check[X]",
"check",
"X",
"{\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n }",
"if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }",
"i % 2 == 0",
"i % 2",
"i",
"2",
"0",
"{\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }",
"maiN -= 1",
"maiN",
"1",
"if(check[maiN]){\n answer = maiN;\n break;\n }",
"check[maiN]",
"check",
"maiN",
"{\n answer = maiN;\n break;\n }",
"answer = maiN",
"answer",
"maiN",
"break;",
"if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }",
"i % 2 != 0",
"i % 2",
"i",
"2",
"0",
"{\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }",
"puraN += 1",
"puraN",
"1",
"if(check[puraN]){\n answer = puraN;\n break; \n }",
"check[puraN]",
"check",
"puraN",
"{\n answer = puraN;\n break; \n }",
"answer = puraN",
"answer",
"puraN",
"break;",
"i += 1",
"i",
"1",
"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) throws Exception {\n // Your code here!\n Scanner s = new Scanner(System.in);\n int X = s.nextInt();\n int N = s.nextInt();\n Boolean check[] = new Boolean[102];\n for(int i = 0; i < 102; i++){\n check[i] = true;\n } \n for(int i = 0; i < N; i++ ) {\n check[s.nextInt()] = false;\n }\n int puraN = X;\n int maiN = X;\n int i = 0;\n int answer = X;\n while(!check[X]){\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n } \n \n System.out.println(answer); \n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner s = new Scanner(System.in);\n int X = s.nextInt();\n int N = s.nextInt();\n Boolean check[] = new Boolean[102];\n for(int i = 0; i < 102; i++){\n check[i] = true;\n } \n for(int i = 0; i < N; i++ ) {\n check[s.nextInt()] = false;\n }\n int puraN = X;\n int maiN = X;\n int i = 0;\n int answer = X;\n while(!check[X]){\n if(i % 2 == 0){\n maiN -= 1;\n if(check[maiN]){\n answer = maiN;\n break;\n } \n }\n if(i % 2 != 0){\n puraN += 1;\n if(check[puraN]){\n answer = puraN;\n break; \n }\n }\n i += 1;\n \n } \n \n System.out.println(answer); \n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner s = new Scanner(System.in);
int X = s.nextInt();
int N = s.nextInt();
Boolean check[] = new Boolean[102];
for(int i = 0; i < 102; i++){
check[i] = true;
}
for(int i = 0; i < N; i++ ) {
check[s.nextInt()] = false;
}
int puraN = X;
int maiN = X;
int i = 0;
int answer = X;
while(!check[X]){
if(i % 2 == 0){
maiN -= 1;
if(check[maiN]){
answer = maiN;
break;
}
}
if(i % 2 != 0){
puraN += 1;
if(check[puraN]){
answer = puraN;
break;
}
}
i += 1;
}
System.out.println(answer);
}
}
|
[
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,
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,
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,
18,
13,
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,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
18,
13,
13,
18,
13,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
4,
18,
13,
13,
29,
41,
13,
17,
11,
1,
41,
13,
13,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
3,
41,
13,
17,
11,
1,
41,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
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,
13,
13,
30,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
252,
20
],
[
252,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
26,
28
],
[
23,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
31,
33
],
[
23,
34
],
[
34,
35
],
[
34,
36
],
[
23,
37
],
[
37,
38
],
[
37,
39
],
[
23,
40
],
[
40,
41
],
[
40,
42
],
[
23,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
43,
47
],
[
43,
48
],
[
23,
49
],
[
49,
50
],
[
50,
51
],
[
21,
52
],
[
52,
53
],
[
252,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
58,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
69,
70
],
[
69,
71
],
[
58,
73
],
[
73,
74
],
[
73,
75
],
[
58,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
77,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
58,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
104,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
99,
110
],
[
111,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
117,
118
],
[
58,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
58,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
123,
133
],
[
133,
134
],
[
134,
135
],
[
123,
136
],
[
137,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
138,
144
],
[
144,
145
],
[
144,
146
],
[
58,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
152,
154
],
[
147,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
155,
160
],
[
58,
161
],
[
161,
162
],
[
161,
163
],
[
58,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
164,
174
],
[
174,
175
],
[
175,
176
],
[
164,
177
],
[
178,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
184,
185
],
[
184,
186
],
[
179,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
58,
192
],
[
192,
193
],
[
192,
194
],
[
58,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
195,
200
],
[
200,
201
],
[
200,
202
],
[
195,
203
],
[
203,
204
],
[
204,
205
],
[
195,
206
],
[
207,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
209,
213
],
[
213,
214
],
[
213,
215
],
[
208,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
216,
220
],
[
58,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
223,
226
],
[
226,
227
],
[
226,
228
],
[
222,
229
],
[
229,
230
],
[
230,
231
],
[
229,
232
],
[
232,
233
],
[
232,
234
],
[
221,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
236,
239
],
[
221,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
241,
244
],
[
56,
245
],
[
245,
246
],
[
56,
247
],
[
247,
248
],
[
56,
249
],
[
249,
250
],
[
0,
251
],
[
251,
252
],
[
251,
253
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\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 ABC170_c solver = new ABC170_c();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ABC170_c {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int X = in.nextInt();\n int N = in.nextInt();\n int p[] = new int[N];\n int mas[] = new int[110];\n for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }\n for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }\n Arrays.sort(p);\n for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }\n if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }\n int plus = 0;\n for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }\n int minus = 0;\n for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }\n if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\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.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 ABC170_c solver = new ABC170_c();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ABC170_c {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int X = in.nextInt();\n int N = in.nextInt();\n int p[] = new int[N];\n int mas[] = new int[110];\n for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }\n for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }\n Arrays.sort(p);\n for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }\n if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }\n int plus = 0;\n for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }\n int minus = 0;\n for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }\n if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\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 ABC170_c solver = new ABC170_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 ABC170_c solver = new ABC170_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)",
"ABC170_c solver = new ABC170_c();",
"solver",
"new ABC170_c()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class ABC170_c {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int X = in.nextInt();\n int N = in.nextInt();\n int p[] = new int[N];\n int mas[] = new int[110];\n for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }\n for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }\n Arrays.sort(p);\n for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }\n if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }\n int plus = 0;\n for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }\n int minus = 0;\n for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }\n if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\n }\n }\n\n }",
"ABC170_c",
"public void solve(int testNumber, Scanner in, PrintWriter out) {\n int X = in.nextInt();\n int N = in.nextInt();\n int p[] = new int[N];\n int mas[] = new int[110];\n for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }\n for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }\n Arrays.sort(p);\n for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }\n if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }\n int plus = 0;\n for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }\n int minus = 0;\n for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }\n if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\n }\n }",
"solve",
"{\n int X = in.nextInt();\n int N = in.nextInt();\n int p[] = new int[N];\n int mas[] = new int[110];\n for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }\n for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }\n Arrays.sort(p);\n for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }\n if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }\n int plus = 0;\n for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }\n int minus = 0;\n for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }\n if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\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",
"int mas[] = new int[110];",
"mas",
"new int[110]",
"110",
"for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < mas.length",
"i",
"mas.length",
"mas",
"mas.length",
"i++",
"i++",
"i",
"{\n mas[i] = Integer.MAX_VALUE;\n }",
"{\n mas[i] = Integer.MAX_VALUE;\n }",
"mas[i] = Integer.MAX_VALUE",
"mas[i]",
"mas",
"i",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n p[i] = in.nextInt();\n }",
"{\n p[i] = in.nextInt();\n }",
"p[i] = in.nextInt()",
"p[i]",
"p",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < p.length",
"i",
"p.length",
"p",
"p.length",
"i++",
"i++",
"i",
"{\n mas[p[i]] = p[i];\n }",
"{\n mas[p[i]] = p[i];\n }",
"mas[p[i]] = p[i]",
"mas[p[i]]",
"mas",
"p[i]",
"p",
"i",
"p[i]",
"p",
"i",
"if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }",
"mas[X] == Integer.MAX_VALUE",
"mas[X]",
"mas",
"X",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"{\n out.println(X);\n return;\n }",
"out.println(X)",
"out.println",
"out",
"X",
"return;",
"int plus = 0;",
"plus",
"0",
"for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }",
"int i = X;",
"int i = X;",
"i",
"X",
"i < mas.length",
"i",
"mas.length",
"mas",
"mas.length",
"i++",
"i++",
"i",
"{\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }",
"{\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }",
"if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }",
"mas[i] == Integer.MAX_VALUE",
"mas[i]",
"mas",
"i",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"{\n plus = i;\n break;\n }",
"plus = i",
"plus",
"i",
"break;",
"int minus = 0;",
"minus",
"0",
"for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }",
"int i = X;",
"int i = X;",
"i",
"X",
"i >= 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }",
"{\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }",
"if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }",
"mas[i] == Integer.MAX_VALUE",
"mas[i]",
"mas",
"i",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"{\n minus = i;\n break;\n }",
"minus = i",
"minus",
"i",
"break;",
"if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\n }",
"Math.abs(X - plus) >= Math.abs(X - minus)",
"Math.abs(X - plus)",
"Math.abs",
"Math",
"X - plus",
"X",
"plus",
"Math.abs(X - minus)",
"Math.abs",
"Math",
"X - minus",
"X",
"minus",
"{\n out.println(minus);\n }",
"out.println(minus)",
"out.println",
"out",
"minus",
"{\n out.println(plus);\n }",
"out.println(plus)",
"out.println",
"out",
"plus",
"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 ABC170_c solver = new ABC170_c();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ABC170_c {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int X = in.nextInt();\n int N = in.nextInt();\n int p[] = new int[N];\n int mas[] = new int[110];\n for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }\n for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }\n Arrays.sort(p);\n for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }\n if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }\n int plus = 0;\n for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }\n int minus = 0;\n for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }\n if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\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 ABC170_c solver = new ABC170_c();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ABC170_c {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int X = in.nextInt();\n int N = in.nextInt();\n int p[] = new int[N];\n int mas[] = new int[110];\n for (int i = 0; i < mas.length; i++) {\n mas[i] = Integer.MAX_VALUE;\n }\n for (int i = 0; i < N; i++) {\n p[i] = in.nextInt();\n }\n Arrays.sort(p);\n for (int i = 0; i < p.length; i++) {\n mas[p[i]] = p[i];\n }\n if (mas[X] == Integer.MAX_VALUE) {\n out.println(X);\n return;\n }\n int plus = 0;\n for (int i = X; i < mas.length; i++) {\n if (mas[i] == Integer.MAX_VALUE) {\n plus = i;\n break;\n }\n }\n int minus = 0;\n for (int i = X; i >= 0; i--) {\n if (mas[i] == Integer.MAX_VALUE) {\n minus = i;\n break;\n }\n }\n if (Math.abs(X - plus) >= Math.abs(X - minus)) {\n out.println(minus);\n } else {\n out.println(plus);\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.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);
ABC170_c solver = new ABC170_c();
solver.solve(1, in, out);
out.close();
}
static class ABC170_c {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int X = in.nextInt();
int N = in.nextInt();
int p[] = new int[N];
int mas[] = new int[110];
for (int i = 0; i < mas.length; i++) {
mas[i] = Integer.MAX_VALUE;
}
for (int i = 0; i < N; i++) {
p[i] = in.nextInt();
}
Arrays.sort(p);
for (int i = 0; i < p.length; i++) {
mas[p[i]] = p[i];
}
if (mas[X] == Integer.MAX_VALUE) {
out.println(X);
return;
}
int plus = 0;
for (int i = X; i < mas.length; i++) {
if (mas[i] == Integer.MAX_VALUE) {
plus = i;
break;
}
}
int minus = 0;
for (int i = X; i >= 0; i--) {
if (mas[i] == Integer.MAX_VALUE) {
minus = i;
break;
}
}
if (Math.abs(X - plus) >= Math.abs(X - minus)) {
out.println(minus);
} else {
out.println(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,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
2,
13,
13,
14,
2,
13,
17,
30,
4,
18,
13,
13,
30,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
13,
30,
0,
13,
17,
14,
13,
30,
0,
13,
13,
3,
41,
13,
40,
17,
11,
1,
41,
13,
40,
17,
2,
13,
40,
17,
1,
40,
13,
30,
30,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
13,
30,
0,
13,
17,
14,
13,
30,
0,
13,
13,
3,
41,
13,
4,
18,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
196,
11
],
[
196,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
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
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
46,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
57,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
14,
71
],
[
71,
72
],
[
71,
73
],
[
14,
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
],
[
90,
92
],
[
90,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
86,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
14,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
14,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
114,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
114,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
132,
134
],
[
132,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
128,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
14,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
14,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
168,
169
],
[
168,
170
],
[
158,
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
],
[
171,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
185,
190
],
[
190,
191
],
[
190,
192
],
[
12,
193
],
[
193,
194
],
[
0,
195
],
[
195,
196
],
[
195,
197
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\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 List<Integer> listPlus = new ArrayList<>();\n List<Integer> listMinus = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }\n int plusX = 0;\n for (int i = 0; i < 101; i++) {\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }\n int minusX = -101;\n for (int i = -1; i > -101; i--) {\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }\n int abs = Math.abs(minusX);\n if (plusX == abs) {\n System.out.println(x + minusX);\n } else if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\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 int x = sc.nextInt();\n int n = sc.nextInt();\n List<Integer> listPlus = new ArrayList<>();\n List<Integer> listMinus = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }\n int plusX = 0;\n for (int i = 0; i < 101; i++) {\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }\n int minusX = -101;\n for (int i = -1; i > -101; i--) {\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }\n int abs = Math.abs(minusX);\n if (plusX == abs) {\n System.out.println(x + minusX);\n } else if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\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 List<Integer> listPlus = new ArrayList<>();\n List<Integer> listMinus = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }\n int plusX = 0;\n for (int i = 0; i < 101; i++) {\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }\n int minusX = -101;\n for (int i = -1; i > -101; i--) {\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }\n int abs = Math.abs(minusX);\n if (plusX == abs) {\n System.out.println(x + minusX);\n } else if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n List<Integer> listPlus = new ArrayList<>();\n List<Integer> listMinus = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }\n int plusX = 0;\n for (int i = 0; i < 101; i++) {\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }\n int minusX = -101;\n for (int i = -1; i > -101; i--) {\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }\n int abs = Math.abs(minusX);\n if (plusX == abs) {\n System.out.println(x + minusX);\n } else if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\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",
"List<Integer> listPlus = new ArrayList<>();",
"listPlus",
"new ArrayList<>()",
"List<Integer> listMinus = new ArrayList<>();",
"listMinus",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }",
"{\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }",
"int pi = sc.nextInt();",
"pi",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int xpi = pi - x;",
"xpi",
"pi - x",
"pi",
"x",
"if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }",
"xpi >= 0",
"xpi",
"0",
"{\n listPlus.add(xpi);\n }",
"listPlus.add(xpi)",
"listPlus.add",
"listPlus",
"xpi",
"{\n listMinus.add(xpi);\n }",
"listMinus.add(xpi)",
"listMinus.add",
"listMinus",
"xpi",
"int plusX = 0;",
"plusX",
"0",
"for (int i = 0; i < 101; i++) {\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }",
"{\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }",
"boolean check1 = true;",
"check1",
"true",
"for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }",
"Integer plus",
"listPlus",
"{\n if (i == plus) {\n check1 = false;\n }\n }",
"{\n if (i == plus) {\n check1 = false;\n }\n }",
"if (i == plus) {\n check1 = false;\n }",
"i == plus",
"i",
"plus",
"{\n check1 = false;\n }",
"check1 = false",
"check1",
"false",
"if (check1) {\n plusX = i;\n break;\n }",
"check1",
"{\n plusX = i;\n break;\n }",
"plusX = i",
"plusX",
"i",
"break;",
"int minusX = -101;",
"minusX",
"-101",
"101",
"for (int i = -1; i > -101; i--) {\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }",
"int i = -1;",
"int i = -1;",
"i",
"-1",
"1",
"i > -101",
"i",
"-101",
"101",
"i--",
"i--",
"i",
"{\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }",
"{\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }",
"boolean check1 = true;",
"check1",
"true",
"for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }",
"Integer minus",
"listMinus",
"{\n if (i == minus) {\n check1 = false;\n }\n }",
"{\n if (i == minus) {\n check1 = false;\n }\n }",
"if (i == minus) {\n check1 = false;\n }",
"i == minus",
"i",
"minus",
"{\n check1 = false;\n }",
"check1 = false",
"check1",
"false",
"if (check1) {\n minusX = i;\n break;\n }",
"check1",
"{\n minusX = i;\n break;\n }",
"minusX = i",
"minusX",
"i",
"break;",
"int abs = Math.abs(minusX);",
"abs",
"Math.abs(minusX)",
"Math.abs",
"Math",
"minusX",
"if (plusX == abs) {\n System.out.println(x + minusX);\n } else if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\n }",
"plusX == abs",
"plusX",
"abs",
"{\n System.out.println(x + minusX);\n }",
"System.out.println(x + minusX)",
"System.out.println",
"System.out",
"System",
"System.out",
"x + minusX",
"x",
"minusX",
"if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\n }",
"plusX > abs",
"plusX",
"abs",
"{\n System.out.println(x + minusX);\n }",
"System.out.println(x + minusX)",
"System.out.println",
"System.out",
"System",
"System.out",
"x + minusX",
"x",
"minusX",
"{\n System.out.println(x + plusX);\n }",
"System.out.println(x + plusX)",
"System.out.println",
"System.out",
"System",
"System.out",
"x + plusX",
"x",
"plusX",
"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 List<Integer> listPlus = new ArrayList<>();\n List<Integer> listMinus = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }\n int plusX = 0;\n for (int i = 0; i < 101; i++) {\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }\n int minusX = -101;\n for (int i = -1; i > -101; i--) {\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }\n int abs = Math.abs(minusX);\n if (plusX == abs) {\n System.out.println(x + minusX);\n } else if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\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 List<Integer> listPlus = new ArrayList<>();\n List<Integer> listMinus = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n int pi = sc.nextInt();\n int xpi = pi - x;\n if (xpi >= 0) {\n listPlus.add(xpi);\n } else {\n listMinus.add(xpi);\n }\n }\n int plusX = 0;\n for (int i = 0; i < 101; i++) {\n boolean check1 = true;\n for (Integer plus : listPlus) {\n if (i == plus) {\n check1 = false;\n }\n }\n if (check1) {\n plusX = i;\n break;\n }\n }\n int minusX = -101;\n for (int i = -1; i > -101; i--) {\n boolean check1 = true;\n for (Integer minus : listMinus) {\n if (i == minus) {\n check1 = false;\n }\n }\n if (check1) {\n minusX = i;\n break;\n }\n }\n int abs = Math.abs(minusX);\n if (plusX == abs) {\n System.out.println(x + minusX);\n } else if (plusX > abs) {\n System.out.println(x + minusX);\n } else {\n System.out.println(x + plusX);\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();
List<Integer> listPlus = new ArrayList<>();
List<Integer> listMinus = new ArrayList<>();
for (int i = 0; i < n; i++) {
int pi = sc.nextInt();
int xpi = pi - x;
if (xpi >= 0) {
listPlus.add(xpi);
} else {
listMinus.add(xpi);
}
}
int plusX = 0;
for (int i = 0; i < 101; i++) {
boolean check1 = true;
for (Integer plus : listPlus) {
if (i == plus) {
check1 = false;
}
}
if (check1) {
plusX = i;
break;
}
}
int minusX = -101;
for (int i = -1; i > -101; i--) {
boolean check1 = true;
for (Integer minus : listMinus) {
if (i == minus) {
check1 = false;
}
}
if (check1) {
minusX = i;
break;
}
}
int abs = Math.abs(minusX);
if (plusX == abs) {
System.out.println(x + minusX);
} else if (plusX > abs) {
System.out.println(x + minusX);
} else {
System.out.println(x + plusX);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
41,
13,
41,
13,
17,
41,
13,
20,
17,
41,
13,
20,
41,
13,
2,
17,
17,
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,
2,
2,
2,
2,
13,
13,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
2,
2,
2,
13,
13,
2,
13,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
4,
18,
13,
13,
4,
18,
13,
17,
23,
13,
12,
13,
30,
41,
13,
17,
42,
2,
13,
17,
30,
14,
2,
2,
13,
17,
17,
0,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
20,
29,
2,
4,
18,
13,
13,
13,
23,
13,
12,
13,
30,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
18,
13,
13,
30,
11,
1,
41,
13,
2,
17,
13,
2,
13,
17,
1,
0,
13,
13,
30,
0,
18,
13,
13,
17,
12,
13,
30,
14,
2,
13,
17,
29,
17,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
29,
17,
29,
17,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
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,
30,
4,
18,
13,
4,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
30,
41,
13,
40,
17,
11,
1,
41,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
11,
1,
41,
13,
2,
13,
17,
2,
13,
40,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
41,
13,
4,
18,
13,
2,
13,
13,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
2,
13,
13,
2,
2,
13,
13,
2,
13,
13,
30,
0,
13,
13,
3,
4,
18,
13,
13,
12,
13,
30,
41,
13,
17,
42,
2,
40,
13,
17,
30,
4,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
20,
17,
41,
13,
17,
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
],
[
489,
17
],
[
489,
18
],
[
18,
19
],
[
18,
20
],
[
489,
21
],
[
21,
22
],
[
21,
23
],
[
489,
24
],
[
24,
25
],
[
489,
26
],
[
26,
27
],
[
26,
28
],
[
489,
29
],
[
29,
30
],
[
29,
31
],
[
489,
33
],
[
33,
34
],
[
33,
35
],
[
489,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
489,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
44,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
54,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
43,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
489,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
75,
76
],
[
489,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
489,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
91,
97
],
[
90,
98
],
[
86,
99
],
[
99,
100
],
[
86,
101
],
[
101,
102
],
[
489,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
103,
112
],
[
112,
113
],
[
103,
114
],
[
114,
115
],
[
489,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
126,
128
],
[
121,
129
],
[
120,
130
],
[
116,
131
],
[
131,
132
],
[
116,
133
],
[
133,
134
],
[
489,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
139,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
135,
148
],
[
148,
149
],
[
489,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
161,
167
],
[
167,
168
],
[
167,
169
],
[
160,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
172,
174
],
[
160,
175
],
[
175,
176
],
[
175,
177
],
[
152,
178
],
[
178,
179
],
[
150,
180
],
[
180,
181
],
[
150,
182
],
[
182,
183
],
[
489,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
194,
197
],
[
186,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
200,
203
],
[
199,
204
],
[
184,
205
],
[
205,
206
],
[
489,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
209,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
215,
220
],
[
220,
221
],
[
220,
222
],
[
215,
223
],
[
223,
224
],
[
224,
225
],
[
215,
226
],
[
227,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
228,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
238,
239
],
[
238,
240
],
[
234,
241
],
[
241,
242
],
[
241,
243
],
[
234,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
234,
248
],
[
248,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
489,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
257,
261
],
[
261,
262
],
[
256,
263
],
[
263,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
263,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
268,
272
],
[
263,
273
],
[
273,
274
],
[
274,
275
],
[
263,
276
],
[
277,
277
],
[
277,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
279,
283
],
[
278,
284
],
[
284,
285
],
[
256,
286
],
[
286,
287
],
[
254,
288
],
[
288,
289
],
[
489,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
293,
297
],
[
297,
298
],
[
292,
299
],
[
299,
300
],
[
300,
301
],
[
300,
302
],
[
300,
303
],
[
303,
304
],
[
303,
305
],
[
290,
306
],
[
306,
307
],
[
290,
308
],
[
308,
309
],
[
489,
310
],
[
310,
311
],
[
310,
312
],
[
312,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
313,
317
],
[
317,
318
],
[
313,
319
],
[
319,
320
],
[
320,
321
],
[
320,
322
],
[
320,
323
],
[
323,
324
],
[
323,
325
],
[
310,
326
],
[
326,
327
],
[
310,
328
],
[
328,
329
],
[
489,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
333,
334
],
[
333,
335
],
[
335,
336
],
[
332,
337
],
[
337,
338
],
[
337,
339
],
[
339,
340
],
[
332,
341
],
[
341,
342
],
[
341,
343
],
[
332,
344
],
[
344,
345
],
[
345,
346
],
[
346,
347
],
[
346,
348
],
[
344,
349
],
[
349,
350
],
[
349,
351
],
[
344,
352
],
[
352,
353
],
[
353,
354
],
[
344,
355
],
[
356,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
357,
360
],
[
360,
361
],
[
357,
362
],
[
332,
363
],
[
363,
364
],
[
364,
365
],
[
364,
366
],
[
363,
367
],
[
367,
368
],
[
368,
369
],
[
367,
370
],
[
363,
371
],
[
371,
372
],
[
372,
373
],
[
372,
374
],
[
374,
375
],
[
371,
376
],
[
376,
377
],
[
377,
378
],
[
378,
379
],
[
378,
380
],
[
376,
381
],
[
381,
382
],
[
381,
383
],
[
376,
384
],
[
384,
385
],
[
385,
386
],
[
376,
387
],
[
388,
388
],
[
388,
389
],
[
389,
390
],
[
390,
391
],
[
391,
392
],
[
392,
393
],
[
391,
394
],
[
389,
395
],
[
395,
396
],
[
396,
397
],
[
396,
398
],
[
395,
399
],
[
371,
400
],
[
400,
401
],
[
401,
402
],
[
402,
403
],
[
402,
404
],
[
404,
405
],
[
404,
406
],
[
400,
407
],
[
407,
408
],
[
407,
409
],
[
409,
410
],
[
400,
411
],
[
411,
412
],
[
412,
413
],
[
400,
414
],
[
415,
415
],
[
415,
416
],
[
416,
417
],
[
417,
418
],
[
418,
419
],
[
419,
420
],
[
418,
421
],
[
416,
422
],
[
422,
423
],
[
423,
424
],
[
423,
425
],
[
425,
426
],
[
426,
427
],
[
425,
428
],
[
428,
429
],
[
428,
430
],
[
422,
431
],
[
431,
432
],
[
431,
433
],
[
433,
434
],
[
434,
435
],
[
433,
436
],
[
436,
437
],
[
436,
438
],
[
422,
439
],
[
439,
440
],
[
440,
441
],
[
441,
442
],
[
441,
443
],
[
440,
444
],
[
444,
445
],
[
445,
446
],
[
445,
447
],
[
444,
448
],
[
448,
449
],
[
448,
450
],
[
439,
451
],
[
451,
452
],
[
452,
453
],
[
452,
454
],
[
451,
455
],
[
371,
456
],
[
456,
457
],
[
457,
458
],
[
456,
459
],
[
489,
460
],
[
460,
461
],
[
460,
462
],
[
462,
463
],
[
463,
464
],
[
463,
465
],
[
462,
466
],
[
466,
467
],
[
467,
468
],
[
468,
469
],
[
467,
470
],
[
466,
471
],
[
471,
472
],
[
472,
473
],
[
462,
474
],
[
474,
475
],
[
475,
476
],
[
460,
477
],
[
477,
478
],
[
489,
479
],
[
479,
480
],
[
479,
481
],
[
481,
482
],
[
481,
483
],
[
479,
485
],
[
485,
486
],
[
485,
487
],
[
0,
488
],
[
488,
489
],
[
488,
490
]
]
| [
"import javax.swing.plaf.metal.MetalInternalFrameTitlePane;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.io.*;\nimport java.text.*;\n\npublic class Main {\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);\n static PrintWriter out = new PrintWriter(System.out);\n static StringTokenizer t;\n\n static String sn() {\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }\n\n static int ni() {\n return Integer.parseInt(sn());\n }\n\n static long nlo() {\n return Long.parseLong(sn());\n }\n\n static long mod = (long) 1000000007;\n\n static long pro(long a, long b) {\n return (a % mod * b % mod) % mod;\n }\n\n static long add(long a, long b) {\n return (a + b) % mod;\n }\n\n static long sub(long a, long b) {\n return ((a % mod - b % mod) + mod) % mod;\n }\n\n static int pow(int n) {\n return (int) (Math.log10(n) / Math.log10(2));\n }\n\n static int modpow(int x, int y) {\n int res = 1;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }\n\n// static class pair {\n// String a;\n// int b;\n//\n// pair(String x, int y) {\n// a = x;\n// b = y;\n// }\n// }\n\n static long modInverse(long n) {\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s) % mod;\n }\n\n static boolean v[] = new boolean[1000005];\n\n static void seive() {\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }\n\n static boolean isprime(long n) {\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n\n static DecimalFormat df = new DecimalFormat(\"0.000000000000000000000\");\n\n static class trie {\n trie a[] = new trie[26];\n int cnt = 0;\n }\n\n static int maxn = (int) 3e5 + 5;\n\n static long gcd(long a, long b) {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }\n\n static void solve() {\n int x = ni();\n int n = ni();\n HashMap<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n map.put(ni(), 1);\n }\n if (n == 0)\n out.println(x);\n else {\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }\n }\n\n public static void main(String args[]) {\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }\n}\n",
"import javax.swing.plaf.metal.MetalInternalFrameTitlePane;",
"MetalInternalFrameTitlePane",
"javax.swing.plaf.metal",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.text.*;",
"text.*",
"java",
"public class Main {\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);\n static PrintWriter out = new PrintWriter(System.out);\n static StringTokenizer t;\n\n static String sn() {\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }\n\n static int ni() {\n return Integer.parseInt(sn());\n }\n\n static long nlo() {\n return Long.parseLong(sn());\n }\n\n static long mod = (long) 1000000007;\n\n static long pro(long a, long b) {\n return (a % mod * b % mod) % mod;\n }\n\n static long add(long a, long b) {\n return (a + b) % mod;\n }\n\n static long sub(long a, long b) {\n return ((a % mod - b % mod) + mod) % mod;\n }\n\n static int pow(int n) {\n return (int) (Math.log10(n) / Math.log10(2));\n }\n\n static int modpow(int x, int y) {\n int res = 1;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }\n\n// static class pair {\n// String a;\n// int b;\n//\n// pair(String x, int y) {\n// a = x;\n// b = y;\n// }\n// }\n\n static long modInverse(long n) {\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s) % mod;\n }\n\n static boolean v[] = new boolean[1000005];\n\n static void seive() {\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }\n\n static boolean isprime(long n) {\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n\n static DecimalFormat df = new DecimalFormat(\"0.000000000000000000000\");\n\n static class trie {\n trie a[] = new trie[26];\n int cnt = 0;\n }\n\n static int maxn = (int) 3e5 + 5;\n\n static long gcd(long a, long b) {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }\n\n static void solve() {\n int x = ni();\n int n = ni();\n HashMap<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n map.put(ni(), 1);\n }\n if (n == 0)\n out.println(x);\n else {\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }\n }\n\n public static void main(String args[]) {\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }\n}",
"Main",
"static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);",
"br",
"new BufferedReader(new InputStreamReader(System.in), 32768)",
"static PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"static StringTokenizer t;",
"t",
"static long mod = (long) 1000000007;",
"mod",
"(long) 1000000007",
"static boolean v[] = new boolean[1000005];",
"v",
"new boolean[1000005]",
"1000005",
"static DecimalFormat df = new DecimalFormat(\"0.000000000000000000000\");",
"df",
"new DecimalFormat(\"0.000000000000000000000\")",
"static int maxn = (int) 3e5 + 5;",
"maxn",
"(int) 3e5 + 5",
"(int) 3e5",
"5",
"static String sn() {\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }",
"sn",
"{\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }",
"while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }",
"t == null || !t.hasMoreTokens()",
"t == null",
"t",
"null",
"!t.hasMoreTokens()",
"t.hasMoreTokens()",
"t.hasMoreTokens",
"t",
"{\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }",
"try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }",
"catch (IOException e) {\n throw new RuntimeException();\n }",
"IOException e",
"{\n throw new RuntimeException();\n }",
"throw new RuntimeException();",
"new RuntimeException()",
"{\n t = new StringTokenizer(br.readLine());\n }",
"t = new StringTokenizer(br.readLine())",
"t",
"new StringTokenizer(br.readLine())",
"return t.nextToken();",
"t.nextToken()",
"t.nextToken",
"t",
"static int ni() {\n return Integer.parseInt(sn());\n }",
"ni",
"{\n return Integer.parseInt(sn());\n }",
"return Integer.parseInt(sn());",
"Integer.parseInt(sn())",
"Integer.parseInt",
"Integer",
"sn()",
"sn",
"static long nlo() {\n return Long.parseLong(sn());\n }",
"nlo",
"{\n return Long.parseLong(sn());\n }",
"return Long.parseLong(sn());",
"Long.parseLong(sn())",
"Long.parseLong",
"Long",
"sn()",
"sn",
"static long pro(long a, long b) {\n return (a % mod * b % mod) % mod;\n }",
"pro",
"{\n return (a % mod * b % mod) % mod;\n }",
"return (a % mod * b % mod) % mod;",
"(a % mod * b % mod) % mod",
"(a % mod * b % mod)",
"a % mod * b",
"a % mod",
"a",
"mod",
"b",
"mod",
"mod",
"long a",
"a",
"long b",
"b",
"static long add(long a, long b) {\n return (a + b) % mod;\n }",
"add",
"{\n return (a + b) % mod;\n }",
"return (a + b) % mod;",
"(a + b) % mod",
"(a + b)",
"a",
"b",
"mod",
"long a",
"a",
"long b",
"b",
"static long sub(long a, long b) {\n return ((a % mod - b % mod) + mod) % mod;\n }",
"sub",
"{\n return ((a % mod - b % mod) + mod) % mod;\n }",
"return ((a % mod - b % mod) + mod) % mod;",
"((a % mod - b % mod) + mod) % mod",
"((a % mod - b % mod) + mod)",
"(a % mod - b % mod)",
"a % mod",
"a",
"mod",
"b % mod",
"b",
"mod",
"mod",
"mod",
"long a",
"a",
"long b",
"b",
"static int pow(int n) {\n return (int) (Math.log10(n) / Math.log10(2));\n }",
"pow",
"{\n return (int) (Math.log10(n) / Math.log10(2));\n }",
"return (int) (Math.log10(n) / Math.log10(2));",
"(int) (Math.log10(n) / Math.log10(2))",
"Math.log10(n)",
"Math.log10",
"Math",
"n",
"Math.log10(2)",
"Math.log10",
"Math",
"2",
"int n",
"n",
"static int modpow(int x, int y) {\n int res = 1;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }",
"modpow",
"{\n int res = 1;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }",
"int res = 1;",
"res",
"1",
"while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }",
"y > 0",
"y",
"0",
"{\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }",
"if (y % 2 != 0)\n res *= x;",
"y % 2 != 0",
"y % 2",
"y",
"2",
"0",
"res *= x",
"res",
"x",
"x = x * x",
"x",
"x * x",
"x",
"x",
"y /= 2",
"y",
"2",
"return res;",
"res",
"int x",
"x",
"int y",
"y",
"static long modInverse(long n) {\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s) % mod;\n }",
"modInverse",
"{\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s) % mod;\n }",
"BigInteger n1 = new BigInteger(Long.toString(n));",
"n1",
"new BigInteger(Long.toString(n))",
"String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();",
"s",
"(n1.modInverse(new BigInteger(Long.toString(mod)))).toString()",
"(n1.modInverse(new BigInteger(Long.toString(mod)))).toString",
"(n1.modInverse(new BigInteger(Long.toString(mod))))",
"n1.modInverse",
"n1",
"new BigInteger(Long.toString(mod))",
"return Long.parseLong(s) % mod;",
"Long.parseLong(s) % mod",
"Long.parseLong(s)",
"Long.parseLong",
"Long",
"s",
"mod",
"long n",
"n",
"static void seive() {\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }",
"seive",
"{\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }",
"v[1] = true",
"v[1]",
"v",
"1",
"true",
"for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }",
"int i = 2;",
"int i = 2;",
"i",
"2",
"i < 1000005",
"i",
"1000005",
"i++",
"i++",
"i",
"{\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }",
"{\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }",
"if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }",
"!v[i]",
"v[i]",
"v",
"i",
"{\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }",
"for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;",
"int j = 2 * i;",
"int j = 2 * i;",
"j",
"2 * i",
"2",
"i",
"j < 1000005",
"j",
"1000005",
"j += i",
"j += i",
"j",
"i",
"v[j] = true;",
"v[j] = true",
"v[j]",
"v",
"j",
"true",
"static boolean isprime(long n) {\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }",
"isprime",
"{\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }",
"if (n == 1)\n return false;",
"n == 1",
"n",
"1",
"return false;",
"false",
"for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }",
"int i = 2;",
"int i = 2;",
"i",
"2",
"i * i <= n",
"i * i",
"i",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (n % i == 0)\n return false;\n }",
"{\n if (n % i == 0)\n return false;\n }",
"if (n % i == 0)\n return false;",
"n % i == 0",
"n % i",
"n",
"i",
"0",
"return false;",
"false",
"return true;",
"true",
"long n",
"n",
"static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }",
"gcd",
"{\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }",
"if (b == 0)\n return a;",
"b == 0",
"b",
"0",
"return a;",
"a",
"return gcd(b, a % b);",
"gcd(b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"int a",
"a",
"int b",
"b",
"static long gcd(long a, long b) {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }",
"gcd",
"{\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }",
"if (b == 0)\n return a;\n else\n return gcd(b, a % b);",
"b == 0",
"b",
"0",
"return a;",
"a",
"return gcd(b, a % b);",
"gcd(b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"long a",
"a",
"long b",
"b",
"static void solve() {\n int x = ni();\n int n = ni();\n HashMap<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n map.put(ni(), 1);\n }\n if (n == 0)\n out.println(x);\n else {\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }\n }",
"solve",
"{\n int x = ni();\n int n = ni();\n HashMap<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n map.put(ni(), 1);\n }\n if (n == 0)\n out.println(x);\n else {\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }\n }",
"int x = ni();",
"x",
"ni()",
"ni",
"int n = ni();",
"n",
"ni()",
"ni",
"HashMap<Integer, Integer> map = new HashMap<>();",
"map",
"new HashMap<>()",
"for (int i = 0; i < n; i++) {\n map.put(ni(), 1);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n map.put(ni(), 1);\n }",
"{\n map.put(ni(), 1);\n }",
"map.put(ni(), 1)",
"map.put",
"map",
"ni()",
"ni",
"1",
"if (n == 0)\n out.println(x);\n else {\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }",
"n == 0",
"n",
"0",
"out.println(x)",
"out.println",
"out",
"x",
"{\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }",
"int ans = -1;",
"ans",
"-1",
"1",
"for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }",
"int i = x;",
"int i = x;",
"i",
"x",
"i <= 1000",
"i",
"1000",
"i++",
"i++",
"i",
"{\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }",
"{\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }",
"if (!map.containsKey(i)) {\n ans = i;\n break;\n }",
"!map.containsKey(i)",
"map.containsKey(i)",
"map.containsKey",
"map",
"i",
"{\n ans = i;\n break;\n }",
"ans = i",
"ans",
"i",
"break;",
"for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }",
"int i = x - 1;",
"int i = x - 1;",
"i",
"x - 1",
"x",
"1",
"i >= -1000",
"i",
"-1000",
"1000",
"i--",
"i--",
"i",
"{\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }",
"{\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }",
"if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }",
"!map.containsKey(i)",
"map.containsKey(i)",
"map.containsKey",
"map",
"i",
"{\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }",
"int d1=Math.abs(x - i);",
"d1",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"int d2=Math.abs(x - ans);",
"d2",
"Math.abs(x - ans)",
"Math.abs",
"Math",
"x - ans",
"x",
"ans",
"if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }",
"d1<d2 || (d1==d2 && i<ans)",
"d1<d2",
"d1",
"d2",
"(d1==d2 && i<ans)",
"d1==d2",
"d1",
"d2",
"i<ans",
"i",
"ans",
"{\n ans = i;\n break;\n }",
"ans = i",
"ans",
"i",
"break;",
"out.println(ans)",
"out.println",
"out",
"ans",
"public static void main(String args[]) {\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }",
"main",
"{\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }",
"int t = 1;",
"t",
"1",
"while (t-- > 0) {\n solve();\n }",
"t-- > 0",
"t--",
"t",
"0",
"{\n solve();\n }",
"solve()",
"solve",
"out.close()",
"out.close",
"out",
"String args[]",
"args",
"static class trie {\n trie a[] = new trie[26];\n int cnt = 0;\n }",
"trie",
"trie a[] = new trie[26];",
"a",
"new trie[26]",
"26",
"int cnt = 0;",
"cnt",
"0",
"public class Main {\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);\n static PrintWriter out = new PrintWriter(System.out);\n static StringTokenizer t;\n\n static String sn() {\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }\n\n static int ni() {\n return Integer.parseInt(sn());\n }\n\n static long nlo() {\n return Long.parseLong(sn());\n }\n\n static long mod = (long) 1000000007;\n\n static long pro(long a, long b) {\n return (a % mod * b % mod) % mod;\n }\n\n static long add(long a, long b) {\n return (a + b) % mod;\n }\n\n static long sub(long a, long b) {\n return ((a % mod - b % mod) + mod) % mod;\n }\n\n static int pow(int n) {\n return (int) (Math.log10(n) / Math.log10(2));\n }\n\n static int modpow(int x, int y) {\n int res = 1;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }\n\n// static class pair {\n// String a;\n// int b;\n//\n// pair(String x, int y) {\n// a = x;\n// b = y;\n// }\n// }\n\n static long modInverse(long n) {\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s) % mod;\n }\n\n static boolean v[] = new boolean[1000005];\n\n static void seive() {\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }\n\n static boolean isprime(long n) {\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n\n static DecimalFormat df = new DecimalFormat(\"0.000000000000000000000\");\n\n static class trie {\n trie a[] = new trie[26];\n int cnt = 0;\n }\n\n static int maxn = (int) 3e5 + 5;\n\n static long gcd(long a, long b) {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }\n\n static void solve() {\n int x = ni();\n int n = ni();\n HashMap<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n map.put(ni(), 1);\n }\n if (n == 0)\n out.println(x);\n else {\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }\n }\n\n public static void main(String args[]) {\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }\n}",
"public class Main {\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);\n static PrintWriter out = new PrintWriter(System.out);\n static StringTokenizer t;\n\n static String sn() {\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }\n\n static int ni() {\n return Integer.parseInt(sn());\n }\n\n static long nlo() {\n return Long.parseLong(sn());\n }\n\n static long mod = (long) 1000000007;\n\n static long pro(long a, long b) {\n return (a % mod * b % mod) % mod;\n }\n\n static long add(long a, long b) {\n return (a + b) % mod;\n }\n\n static long sub(long a, long b) {\n return ((a % mod - b % mod) + mod) % mod;\n }\n\n static int pow(int n) {\n return (int) (Math.log10(n) / Math.log10(2));\n }\n\n static int modpow(int x, int y) {\n int res = 1;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }\n\n// static class pair {\n// String a;\n// int b;\n//\n// pair(String x, int y) {\n// a = x;\n// b = y;\n// }\n// }\n\n static long modInverse(long n) {\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s) % mod;\n }\n\n static boolean v[] = new boolean[1000005];\n\n static void seive() {\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }\n\n static boolean isprime(long n) {\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n\n static DecimalFormat df = new DecimalFormat(\"0.000000000000000000000\");\n\n static class trie {\n trie a[] = new trie[26];\n int cnt = 0;\n }\n\n static int maxn = (int) 3e5 + 5;\n\n static long gcd(long a, long b) {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }\n\n static void solve() {\n int x = ni();\n int n = ni();\n HashMap<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < n; i++) {\n map.put(ni(), 1);\n }\n if (n == 0)\n out.println(x);\n else {\n int ans = -1;\n for (int i = x; i <= 1000; i++) {\n if (!map.containsKey(i)) {\n ans = i;\n break;\n }\n }\n for (int i = x - 1; i >= -1000; i--) {\n if (!map.containsKey(i)) {\n int d1=Math.abs(x - i);\n int d2=Math.abs(x - ans);\n if (d1<d2 || (d1==d2 && i<ans)) {\n ans = i;\n break;\n }\n }\n }\n out.println(ans);\n }\n }\n\n public static void main(String args[]) {\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }\n}",
"Main"
]
| import javax.swing.plaf.metal.MetalInternalFrameTitlePane;
import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
static PrintWriter out = new PrintWriter(System.out);
static StringTokenizer t;
static String sn() {
while (t == null || !t.hasMoreTokens()) {
try {
t = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new RuntimeException();
}
}
return t.nextToken();
}
static int ni() {
return Integer.parseInt(sn());
}
static long nlo() {
return Long.parseLong(sn());
}
static long mod = (long) 1000000007;
static long pro(long a, long b) {
return (a % mod * b % mod) % mod;
}
static long add(long a, long b) {
return (a + b) % mod;
}
static long sub(long a, long b) {
return ((a % mod - b % mod) + mod) % mod;
}
static int pow(int n) {
return (int) (Math.log10(n) / Math.log10(2));
}
static int modpow(int x, int y) {
int res = 1;
// x %= mod;
while (y > 0) {
if (y % 2 != 0)
res *= x;
x = x * x;
y /= 2;
}
return res;
}
// static class pair {
// String a;
// int b;
//
// pair(String x, int y) {
// a = x;
// b = y;
// }
// }
static long modInverse(long n) {
BigInteger n1 = new BigInteger(Long.toString(n));
String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
return Long.parseLong(s) % mod;
}
static boolean v[] = new boolean[1000005];
static void seive() {
v[1] = true;
for (int i = 2; i < 1000005; i++) {
if (!v[i]) {
for (int j = 2 * i; j < 1000005; j += i)
v[j] = true;
}
}
}
static boolean isprime(long n) {
if (n == 1)
return false;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0)
return false;
}
return true;
}
static int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
static DecimalFormat df = new DecimalFormat("0.000000000000000000000");
static class trie {
trie a[] = new trie[26];
int cnt = 0;
}
static int maxn = (int) 3e5 + 5;
static long gcd(long a, long b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
static void solve() {
int x = ni();
int n = ni();
HashMap<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < n; i++) {
map.put(ni(), 1);
}
if (n == 0)
out.println(x);
else {
int ans = -1;
for (int i = x; i <= 1000; i++) {
if (!map.containsKey(i)) {
ans = i;
break;
}
}
for (int i = x - 1; i >= -1000; i--) {
if (!map.containsKey(i)) {
int d1=Math.abs(x - i);
int d2=Math.abs(x - ans);
if (d1<d2 || (d1==d2 && i<ans)) {
ans = i;
break;
}
}
}
out.println(ans);
}
}
public static void main(String args[]) {
int t = 1;
while (t-- > 0) {
solve();
}
out.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
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,
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,
0,
13,
2,
13,
13,
3,
14,
40,
4,
18,
13,
2,
13,
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
],
[
102,
5
],
[
102,
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,
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
],
[
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
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
63,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
6,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
]
| [
"import java.util.*;\npublic class Main { \n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int o=0;\n int x=sc.nextInt();\n int y=sc.nextInt();\n PriorityQueue<Integer> q=new PriorityQueue<>();\n\t\tfor(int i=0;i<y;i++){\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}\n \tfor(int i=0;i<=100;i++){ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n } \n System.out.println(o);\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 o=0;\n int x=sc.nextInt();\n int y=sc.nextInt();\n PriorityQueue<Integer> q=new PriorityQueue<>();\n\t\tfor(int i=0;i<y;i++){\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}\n \tfor(int i=0;i<=100;i++){ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n } \n System.out.println(o);\n }\n \n}",
"Main",
"public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int o=0;\n int x=sc.nextInt();\n int y=sc.nextInt();\n PriorityQueue<Integer> q=new PriorityQueue<>();\n\t\tfor(int i=0;i<y;i++){\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}\n \tfor(int i=0;i<=100;i++){ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n } \n System.out.println(o);\n }",
"main",
"{\n Scanner sc=new Scanner(System.in);\n int o=0;\n int x=sc.nextInt();\n int y=sc.nextInt();\n PriorityQueue<Integer> q=new PriorityQueue<>();\n\t\tfor(int i=0;i<y;i++){\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}\n \tfor(int i=0;i<=100;i++){ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n } \n System.out.println(o);\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int o=0;",
"o",
"0",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int y=sc.nextInt();",
"y",
"sc.nextInt()",
"sc.nextInt",
"sc",
"PriorityQueue<Integer> q=new PriorityQueue<>();",
"q",
"new PriorityQueue<>()",
"for(int i=0;i<y;i++){\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<y",
"i",
"y",
"i++",
"i++",
"i",
"{\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}",
"{\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}",
"int p=sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q.add(p)",
"q.add",
"q",
"p",
"for(int i=0;i<=100;i++){ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=100",
"i",
"100",
"i++",
"i++",
"i",
"{ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n }",
"{ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n }",
"if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }",
"!q.contains(x-i)",
"q.contains(x-i)",
"q.contains",
"q",
"x-i",
"x",
"i",
"{\n \to=x-i;\n break;\n }",
"o=x-i",
"o",
"x-i",
"x",
"i",
"break;",
"if(!q.contains(x+i)){\n \to=x+i;\n break;\n }",
"!q.contains(x+i)",
"q.contains(x+i)",
"q.contains",
"q",
"x+i",
"x",
"i",
"{\n \to=x+i;\n break;\n }",
"o=x+i",
"o",
"x+i",
"x",
"i",
"break;",
"System.out.println(o)",
"System.out.println",
"System.out",
"System",
"System.out",
"o",
"String[] args",
"args",
"public class Main { \n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int o=0;\n int x=sc.nextInt();\n int y=sc.nextInt();\n PriorityQueue<Integer> q=new PriorityQueue<>();\n\t\tfor(int i=0;i<y;i++){\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}\n \tfor(int i=0;i<=100;i++){ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n } \n System.out.println(o);\n }\n \n}",
"public class Main { \n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int o=0;\n int x=sc.nextInt();\n int y=sc.nextInt();\n PriorityQueue<Integer> q=new PriorityQueue<>();\n\t\tfor(int i=0;i<y;i++){\n \t\tint p=sc.nextInt();\n \t\tq.add(p);\n\t\t}\n \tfor(int i=0;i<=100;i++){ \n if(!q.contains(x-i)){\n \to=x-i;\n break;\n }else if(!q.contains(x+i)){\n \to=x+i;\n break;\n }\n } \n System.out.println(o);\n }\n \n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int o=0;
int x=sc.nextInt();
int y=sc.nextInt();
PriorityQueue<Integer> q=new PriorityQueue<>();
for(int i=0;i<y;i++){
int p=sc.nextInt();
q.add(p);
}
for(int i=0;i<=100;i++){
if(!q.contains(x-i)){
o=x-i;
break;
}else if(!q.contains(x+i)){
o=x+i;
break;
}
}
System.out.println(o);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
14,
2,
13,
17,
30,
4,
13,
13,
4,
18,
13,
17,
41,
13,
0,
13,
17,
41,
13,
20,
13,
41,
13,
41,
13,
41,
13,
0,
13,
17,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
28,
13,
13,
30,
30,
14,
2,
13,
13,
30,
0,
13,
17,
14,
13,
30,
4,
13,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
2,
13,
13,
28,
13,
13,
30,
30,
14,
2,
13,
13,
30,
0,
13,
17,
0,
13,
13,
30,
0,
13,
17,
3,
14,
13,
30,
4,
13,
13,
4,
18,
13,
17,
0,
13,
17,
0,
13,
2,
13,
13,
28,
13,
13,
30,
30,
14,
2,
13,
13,
30,
0,
13,
17,
0,
13,
13,
30,
0,
13,
17,
3,
14,
13,
30,
4,
13,
13,
4,
18,
13,
17,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
14,
13,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
42,
2,
0,
13,
2,
13,
13,
17,
30,
0,
13,
13,
0,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
13,
0,
13,
13,
42,
2,
0,
13,
2,
13,
13,
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
],
[
326,
5
],
[
326,
6
],
[
6,
7
],
[
6,
8
],
[
326,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
11,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
11,
32
],
[
32,
33
],
[
11,
34
],
[
34,
35
],
[
34,
36
],
[
11,
37
],
[
37,
38
],
[
37,
39
],
[
11,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
11,
45
],
[
45,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
11,
72
],
[
72,
73
],
[
72,
74
],
[
72,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
11,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
11,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
95,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
107,
116
],
[
116,
117
],
[
116,
118
],
[
116,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
129,
131
],
[
121,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
107,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
107,
147
],
[
147,
148
],
[
147,
149
],
[
107,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
107,
155
],
[
155,
156
],
[
155,
157
],
[
155,
158
],
[
159,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
168,
170
],
[
160,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
107,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
178,
182
],
[
182,
183
],
[
183,
184
],
[
182,
185
],
[
9,
186
],
[
186,
187
],
[
326,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
195,
196
],
[
196,
197
],
[
326,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
202,
205
],
[
205,
206
],
[
206,
207
],
[
326,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
326,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
222,
223
],
[
223,
224
],
[
326,
225
],
[
225,
226
],
[
225,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
229,
232
],
[
232,
233
],
[
233,
234
],
[
326,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
240,
245
],
[
238,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
248,
250
],
[
246,
251
],
[
235,
252
],
[
252,
253
],
[
326,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
257,
262
],
[
254,
263
],
[
263,
264
],
[
326,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
268,
269
],
[
267,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
274,
276
],
[
271,
277
],
[
270,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
278,
282
],
[
282,
283
],
[
282,
284
],
[
267,
285
],
[
285,
286
],
[
265,
287
],
[
287,
288
],
[
265,
289
],
[
289,
290
],
[
326,
291
],
[
291,
292
],
[
291,
293
],
[
293,
294
],
[
294,
295
],
[
293,
296
],
[
296,
297
],
[
296,
298
],
[
293,
299
],
[
299,
300
],
[
299,
301
],
[
293,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
306,
308
],
[
303,
309
],
[
302,
310
],
[
310,
311
],
[
311,
312
],
[
311,
313
],
[
310,
314
],
[
314,
315
],
[
314,
316
],
[
293,
317
],
[
317,
318
],
[
318,
319
],
[
318,
320
],
[
291,
321
],
[
321,
322
],
[
291,
323
],
[
323,
324
],
[
0,
325
],
[
325,
326
],
[
325,
327
]
]
| [
"import java.util.Scanner;\n\n\npublic class Main{\n public static Scanner scan = new Scanner(System.in);\n public static void main(String[]args){\n int x = nextInt();\n int n = nextInt();\n\n if(n==0){\n print(x);\n System.exit(0);\n }\n\n boolean flag;\n flag = true;\n int[] arr = new int[n];\n\n int min,min_i,tmp;\n min = 1000;\n min_i = 1000;\n for(int i=0;i<n;i++){\n arr[i] = nextInt();\n }\n for(int a:arr){\n if(x==a){\n flag = false;\n }\n }\n if(flag){\n print(x);\n System.exit(0);\n }\n\n for(int i=1;i<101;i++){\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }\n }\n\n public static int nextInt(){\n return Integer.parseInt(scan.next());\n }\n public static long nextLong(){\n return Long.parseLong(scan.next());\n }\n public static String next(){\n return scan.next();\n }\n public static double nextDouble(){\n return Double.parseDouble(scan.next());\n }\n public static float nextFloat(){\n return Float.parseFloat(scan.next());\n }\n\n //Yes or No\n public static void yesNo(boolean flag){\n if(flag) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n\n //print\n public static void print(Object a){\n System.out.println(a);\n }\n\n\n //gcd\n public static int gcd (int a, int b){\n int tmp;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return b;\n }\n\n\n //lcm\n public static int lcm(int a,int b){\n int tmp;\n long c = a;\n c *= b;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return (int)(c/b);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static Scanner scan = new Scanner(System.in);\n public static void main(String[]args){\n int x = nextInt();\n int n = nextInt();\n\n if(n==0){\n print(x);\n System.exit(0);\n }\n\n boolean flag;\n flag = true;\n int[] arr = new int[n];\n\n int min,min_i,tmp;\n min = 1000;\n min_i = 1000;\n for(int i=0;i<n;i++){\n arr[i] = nextInt();\n }\n for(int a:arr){\n if(x==a){\n flag = false;\n }\n }\n if(flag){\n print(x);\n System.exit(0);\n }\n\n for(int i=1;i<101;i++){\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }\n }\n\n public static int nextInt(){\n return Integer.parseInt(scan.next());\n }\n public static long nextLong(){\n return Long.parseLong(scan.next());\n }\n public static String next(){\n return scan.next();\n }\n public static double nextDouble(){\n return Double.parseDouble(scan.next());\n }\n public static float nextFloat(){\n return Float.parseFloat(scan.next());\n }\n\n //Yes or No\n public static void yesNo(boolean flag){\n if(flag) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n\n //print\n public static void print(Object a){\n System.out.println(a);\n }\n\n\n //gcd\n public static int gcd (int a, int b){\n int tmp;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return b;\n }\n\n\n //lcm\n public static int lcm(int a,int b){\n int tmp;\n long c = a;\n c *= b;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return (int)(c/b);\n }\n}",
"Main",
"public static Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"public static void main(String[]args){\n int x = nextInt();\n int n = nextInt();\n\n if(n==0){\n print(x);\n System.exit(0);\n }\n\n boolean flag;\n flag = true;\n int[] arr = new int[n];\n\n int min,min_i,tmp;\n min = 1000;\n min_i = 1000;\n for(int i=0;i<n;i++){\n arr[i] = nextInt();\n }\n for(int a:arr){\n if(x==a){\n flag = false;\n }\n }\n if(flag){\n print(x);\n System.exit(0);\n }\n\n for(int i=1;i<101;i++){\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }\n }",
"main",
"{\n int x = nextInt();\n int n = nextInt();\n\n if(n==0){\n print(x);\n System.exit(0);\n }\n\n boolean flag;\n flag = true;\n int[] arr = new int[n];\n\n int min,min_i,tmp;\n min = 1000;\n min_i = 1000;\n for(int i=0;i<n;i++){\n arr[i] = nextInt();\n }\n for(int a:arr){\n if(x==a){\n flag = false;\n }\n }\n if(flag){\n print(x);\n System.exit(0);\n }\n\n for(int i=1;i<101;i++){\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }\n }",
"int x = nextInt();",
"x",
"nextInt()",
"nextInt",
"int n = nextInt();",
"n",
"nextInt()",
"nextInt",
"if(n==0){\n print(x);\n System.exit(0);\n }",
"n==0",
"n",
"0",
"{\n print(x);\n System.exit(0);\n }",
"print(x)",
"print",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"boolean flag;",
"flag",
"flag = true",
"flag",
"true",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"int min",
"min",
"min_i",
"min_i",
"tmp;",
"tmp",
"min = 1000",
"min",
"1000",
"min_i = 1000",
"min_i",
"1000",
"for(int i=0;i<n;i++){\n arr[i] = nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = nextInt();\n }",
"{\n arr[i] = nextInt();\n }",
"arr[i] = nextInt()",
"arr[i]",
"arr",
"i",
"nextInt()",
"nextInt",
"for(int a:arr){\n if(x==a){\n flag = false;\n }\n }",
"int a",
"arr",
"{\n if(x==a){\n flag = false;\n }\n }",
"{\n if(x==a){\n flag = false;\n }\n }",
"if(x==a){\n flag = false;\n }",
"x==a",
"x",
"a",
"{\n flag = false;\n }",
"flag = false",
"flag",
"false",
"if(flag){\n print(x);\n System.exit(0);\n }",
"flag",
"{\n print(x);\n System.exit(0);\n }",
"print(x)",
"print",
"x",
"System.exit(0)",
"System.exit",
"System",
"0",
"for(int i=1;i<101;i++){\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<101",
"i",
"101",
"i++",
"i++",
"i",
"{\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }",
"{\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }",
"flag = true",
"flag",
"true",
"tmp = x-i",
"tmp",
"x-i",
"x",
"i",
"for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }",
"int a",
"arr",
"{\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }",
"{\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }",
"if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }",
"a!=tmp",
"a",
"tmp",
"{\n flag=true;\n min = tmp;\n }",
"flag=true",
"flag",
"true",
"min = tmp",
"min",
"tmp",
"{\n flag = false;\n break;\n }",
"flag = false",
"flag",
"false",
"break;",
"if(flag){\n print(min);\n System.exit(0);\n }",
"flag",
"{\n print(min);\n System.exit(0);\n }",
"print(min)",
"print",
"min",
"System.exit(0)",
"System.exit",
"System",
"0",
"flag = true",
"flag",
"true",
"tmp = x+i",
"tmp",
"x+i",
"x",
"i",
"for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }",
"int a",
"arr",
"{\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }",
"{\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }",
"if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }",
"a!=tmp",
"a",
"tmp",
"{\n flag=true;\n min = tmp;\n }",
"flag=true",
"flag",
"true",
"min = tmp",
"min",
"tmp",
"{\n flag = false;\n break;\n }",
"flag = false",
"flag",
"false",
"break;",
"if(flag){\n print(min);\n System.exit(0);\n }",
"flag",
"{\n print(min);\n System.exit(0);\n }",
"print(min)",
"print",
"min",
"System.exit(0)",
"System.exit",
"System",
"0",
"String[]args",
"args",
"public static int nextInt(){\n return Integer.parseInt(scan.next());\n }",
"nextInt",
"{\n return Integer.parseInt(scan.next());\n }",
"return Integer.parseInt(scan.next());",
"Integer.parseInt(scan.next())",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"public static long nextLong(){\n return Long.parseLong(scan.next());\n }",
"nextLong",
"{\n return Long.parseLong(scan.next());\n }",
"return Long.parseLong(scan.next());",
"Long.parseLong(scan.next())",
"Long.parseLong",
"Long",
"scan.next()",
"scan.next",
"scan",
"public static String next(){\n return scan.next();\n }",
"next",
"{\n return scan.next();\n }",
"return scan.next();",
"scan.next()",
"scan.next",
"scan",
"public static double nextDouble(){\n return Double.parseDouble(scan.next());\n }",
"nextDouble",
"{\n return Double.parseDouble(scan.next());\n }",
"return Double.parseDouble(scan.next());",
"Double.parseDouble(scan.next())",
"Double.parseDouble",
"Double",
"scan.next()",
"scan.next",
"scan",
"public static float nextFloat(){\n return Float.parseFloat(scan.next());\n }",
"nextFloat",
"{\n return Float.parseFloat(scan.next());\n }",
"return Float.parseFloat(scan.next());",
"Float.parseFloat(scan.next())",
"Float.parseFloat",
"Float",
"scan.next()",
"scan.next",
"scan",
"//Yes or No\n public static void yesNo(boolean flag){\n if(flag) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }",
"yesNo",
"{\n if(flag) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }",
"if(flag) System.out.println(\"Yes\");\n else System.out.println(\"No\");",
"flag",
"System.out.println(\"Yes\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"Yes\"",
"System.out.println(\"No\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"No\"",
"boolean flag",
"flag",
"//print\n public static void print(Object a){\n System.out.println(a);\n }",
"print",
"{\n System.out.println(a);\n }",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"Object a",
"a",
"//gcd\n public static int gcd (int a, int b){\n int tmp;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return b;\n }",
"gcd",
"{\n int tmp;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return b;\n }",
"int tmp;",
"tmp",
"while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }",
"(tmp = a%b) != 0",
"(tmp = a%b)",
"tmp",
"a%b",
"a",
"b",
"0",
"{\n a = b;\n b = tmp;\n }",
"a = b",
"a",
"b",
"b = tmp",
"b",
"tmp",
"return b;",
"b",
"int a",
"a",
"int b",
"b",
"//lcm\n public static int lcm(int a,int b){\n int tmp;\n long c = a;\n c *= b;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return (int)(c/b);\n }",
"lcm",
"{\n int tmp;\n long c = a;\n c *= b;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return (int)(c/b);\n }",
"int tmp;",
"tmp",
"long c = a;",
"c",
"a",
"c *= b",
"c",
"b",
"while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }",
"(tmp = a%b) != 0",
"(tmp = a%b)",
"tmp",
"a%b",
"a",
"b",
"0",
"{\n a = b;\n b = tmp;\n }",
"a = b",
"a",
"b",
"b = tmp",
"b",
"tmp",
"return (int)(c/b);",
"(int)(c/b)",
"c",
"b",
"int a",
"a",
"int b",
"b",
"public class Main{\n public static Scanner scan = new Scanner(System.in);\n public static void main(String[]args){\n int x = nextInt();\n int n = nextInt();\n\n if(n==0){\n print(x);\n System.exit(0);\n }\n\n boolean flag;\n flag = true;\n int[] arr = new int[n];\n\n int min,min_i,tmp;\n min = 1000;\n min_i = 1000;\n for(int i=0;i<n;i++){\n arr[i] = nextInt();\n }\n for(int a:arr){\n if(x==a){\n flag = false;\n }\n }\n if(flag){\n print(x);\n System.exit(0);\n }\n\n for(int i=1;i<101;i++){\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }\n }\n\n public static int nextInt(){\n return Integer.parseInt(scan.next());\n }\n public static long nextLong(){\n return Long.parseLong(scan.next());\n }\n public static String next(){\n return scan.next();\n }\n public static double nextDouble(){\n return Double.parseDouble(scan.next());\n }\n public static float nextFloat(){\n return Float.parseFloat(scan.next());\n }\n\n //Yes or No\n public static void yesNo(boolean flag){\n if(flag) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n\n //print\n public static void print(Object a){\n System.out.println(a);\n }\n\n\n //gcd\n public static int gcd (int a, int b){\n int tmp;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return b;\n }\n\n\n //lcm\n public static int lcm(int a,int b){\n int tmp;\n long c = a;\n c *= b;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return (int)(c/b);\n }\n}",
"public class Main{\n public static Scanner scan = new Scanner(System.in);\n public static void main(String[]args){\n int x = nextInt();\n int n = nextInt();\n\n if(n==0){\n print(x);\n System.exit(0);\n }\n\n boolean flag;\n flag = true;\n int[] arr = new int[n];\n\n int min,min_i,tmp;\n min = 1000;\n min_i = 1000;\n for(int i=0;i<n;i++){\n arr[i] = nextInt();\n }\n for(int a:arr){\n if(x==a){\n flag = false;\n }\n }\n if(flag){\n print(x);\n System.exit(0);\n }\n\n for(int i=1;i<101;i++){\n flag = true;\n tmp = x-i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n flag = true;\n tmp = x+i;\n for(int a:arr){\n if(a!=tmp){\n flag=true;\n min = tmp;\n }\n else{\n flag = false;\n break;\n }\n }\n if(flag){\n print(min);\n System.exit(0);\n }\n\n }\n }\n\n public static int nextInt(){\n return Integer.parseInt(scan.next());\n }\n public static long nextLong(){\n return Long.parseLong(scan.next());\n }\n public static String next(){\n return scan.next();\n }\n public static double nextDouble(){\n return Double.parseDouble(scan.next());\n }\n public static float nextFloat(){\n return Float.parseFloat(scan.next());\n }\n\n //Yes or No\n public static void yesNo(boolean flag){\n if(flag) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n\n //print\n public static void print(Object a){\n System.out.println(a);\n }\n\n\n //gcd\n public static int gcd (int a, int b){\n int tmp;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return b;\n }\n\n\n //lcm\n public static int lcm(int a,int b){\n int tmp;\n long c = a;\n c *= b;\n while((tmp = a%b) != 0){\n a = b;\n b = tmp;\n }\n return (int)(c/b);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main{
public static Scanner scan = new Scanner(System.in);
public static void main(String[]args){
int x = nextInt();
int n = nextInt();
if(n==0){
print(x);
System.exit(0);
}
boolean flag;
flag = true;
int[] arr = new int[n];
int min,min_i,tmp;
min = 1000;
min_i = 1000;
for(int i=0;i<n;i++){
arr[i] = nextInt();
}
for(int a:arr){
if(x==a){
flag = false;
}
}
if(flag){
print(x);
System.exit(0);
}
for(int i=1;i<101;i++){
flag = true;
tmp = x-i;
for(int a:arr){
if(a!=tmp){
flag=true;
min = tmp;
}
else{
flag = false;
break;
}
}
if(flag){
print(min);
System.exit(0);
}
flag = true;
tmp = x+i;
for(int a:arr){
if(a!=tmp){
flag=true;
min = tmp;
}
else{
flag = false;
break;
}
}
if(flag){
print(min);
System.exit(0);
}
}
}
public static int nextInt(){
return Integer.parseInt(scan.next());
}
public static long nextLong(){
return Long.parseLong(scan.next());
}
public static String next(){
return scan.next();
}
public static double nextDouble(){
return Double.parseDouble(scan.next());
}
public static float nextFloat(){
return Float.parseFloat(scan.next());
}
//Yes or No
public static void yesNo(boolean flag){
if(flag) System.out.println("Yes");
else System.out.println("No");
}
//print
public static void print(Object a){
System.out.println(a);
}
//gcd
public static int gcd (int a, int b){
int tmp;
while((tmp = a%b) != 0){
a = b;
b = tmp;
}
return b;
}
//lcm
public static int lcm(int a,int b){
int tmp;
long c = a;
c *= b;
while((tmp = a%b) != 0){
a = b;
b = tmp;
}
return (int)(c/b);
}
} |
[
7,
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,
0,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
4,
18,
13,
13,
9,
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
]
| [
[
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
],
[
14,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
34,
35
],
[
35,
36
],
[
14,
37
],
[
37,
38
],
[
37,
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
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
62,
63
],
[
14,
64
],
[
64,
65
],
[
64,
66
],
[
14,
67
],
[
67,
68
],
[
67,
69
],
[
14,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
83,
88
],
[
82,
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
],
[
14,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
12,
116
],
[
116,
117
]
]
| [
"/* package codechef; // don't place package name! */\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\nclass Main\n{\n public static void main (String[] args) throws java.lang.Exception\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int X = Integer.parseInt(st.nextToken());\n int N = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n HashSet<Integer> hs = new HashSet<>();\n for (int i=0; i<N; i++)\n hs.add(Integer.parseInt(st.nextToken()));\n int ans=500,a=0;\n for (int i=0; i<200; i++){\n if (hs.contains(i))\n continue;\n if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }\n }\n System.out.println(a);\n }\n\n\n\n\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main\n{\n public static void main (String[] args) throws java.lang.Exception\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int X = Integer.parseInt(st.nextToken());\n int N = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n HashSet<Integer> hs = new HashSet<>();\n for (int i=0; i<N; i++)\n hs.add(Integer.parseInt(st.nextToken()));\n int ans=500,a=0;\n for (int i=0; i<200; i++){\n if (hs.contains(i))\n continue;\n if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }\n }\n System.out.println(a);\n }\n\n\n\n\n}",
"Main",
"public static void main (String[] args) throws java.lang.Exception\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int X = Integer.parseInt(st.nextToken());\n int N = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n HashSet<Integer> hs = new HashSet<>();\n for (int i=0; i<N; i++)\n hs.add(Integer.parseInt(st.nextToken()));\n int ans=500,a=0;\n for (int i=0; i<200; i++){\n if (hs.contains(i))\n continue;\n if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }\n }\n System.out.println(a);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int X = Integer.parseInt(st.nextToken());\n int N = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n HashSet<Integer> hs = new HashSet<>();\n for (int i=0; i<N; i++)\n hs.add(Integer.parseInt(st.nextToken()));\n int ans=500,a=0;\n for (int i=0; i<200; i++){\n if (hs.contains(i))\n continue;\n if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }\n }\n System.out.println(a);\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",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"HashSet<Integer> hs = new HashSet<>();",
"hs",
"new HashSet<>()",
"for (int i=0; i<N; i++)\n hs.add(Integer.parseInt(st.nextToken()));",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"hs.add(Integer.parseInt(st.nextToken()));",
"hs.add(Integer.parseInt(st.nextToken()))",
"hs.add",
"hs",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"int ans=500",
"ans",
"500",
"a=0;",
"a",
"0",
"for (int i=0; i<200; i++){\n if (hs.contains(i))\n continue;\n if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if (hs.contains(i))\n continue;\n if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }\n }",
"{\n if (hs.contains(i))\n continue;\n if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }\n }",
"if (hs.contains(i))\n continue;",
"hs.contains(i)",
"hs.contains",
"hs",
"i",
"continue;",
"if (Math.abs(i-X)<ans){\n ans=Math.abs(i-X);\n a=i;\n }",
"Math.abs(i-X)<ans",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"ans",
"{\n ans=Math.abs(i-X);\n a=i;\n }",
"ans=Math.abs(i-X)",
"ans",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"a=i",
"a",
"i",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"String[] args",
"args"
]
| /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
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());
st = new StringTokenizer(br.readLine());
HashSet<Integer> hs = new HashSet<>();
for (int i=0; i<N; i++)
hs.add(Integer.parseInt(st.nextToken()));
int ans=500,a=0;
for (int i=0; i<200; i++){
if (hs.contains(i))
continue;
if (Math.abs(i-X)<ans){
ans=Math.abs(i-X);
a=i;
}
}
System.out.println(a);
}
}
|
[
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,
20,
41,
13,
17,
41,
13,
41,
13,
41,
13,
20,
12,
13,
30,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
14,
2,
13,
17,
30,
4,
18,
13,
13,
4,
18,
13,
29,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
41,
13,
18,
13,
13,
41,
13,
18,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
2,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
18,
13,
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,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
18,
13,
13,
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,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
0,
13,
17,
29,
4,
18,
13,
12,
13,
30,
29,
17,
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
],
[
281,
32
],
[
281,
33
],
[
33,
34
],
[
33,
35
],
[
281,
36
],
[
36,
37
],
[
36,
38
],
[
281,
39
],
[
39,
40
],
[
281,
41
],
[
41,
42
],
[
281,
43
],
[
43,
44
],
[
43,
45
],
[
281,
46
],
[
46,
47
],
[
46,
48
],
[
281,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
51,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
64,
69
],
[
69,
70
],
[
70,
71
],
[
64,
72
],
[
51,
73
],
[
73,
74
],
[
73,
75
],
[
51,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
51,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
51,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
51,
106
],
[
106,
107
],
[
106,
108
],
[
51,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
109,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
125,
126
],
[
125,
127
],
[
121,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
121,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
51,
151
],
[
151,
152
],
[
151,
153
],
[
51,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
156,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
156,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
167,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
174,
177
],
[
173,
178
],
[
156,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
181,
184
],
[
179,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
186,
189
],
[
185,
190
],
[
156,
191
],
[
191,
192
],
[
51,
193
],
[
193,
194
],
[
194,
195
],
[
281,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
196,
202
],
[
202,
203
],
[
281,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
207,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
204,
216
],
[
216,
217
],
[
281,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
222,
225
],
[
225,
226
],
[
281,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
231,
234
],
[
234,
235
],
[
281,
236
],
[
236,
237
],
[
236,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
240,
243
],
[
243,
244
],
[
281,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
248,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
247,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
281,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
267,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
281,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
278,
279
],
[
0,
280
],
[
280,
281
],
[
280,
282
]
]
| [
"\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\npublic class Main {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tokenizer = null;\n int totalCases, testNum;\n\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n void solve() throws IOException {\n\n }\n\n void execute() throws IOException {\n int x = ni();\n int n = ni();\n if (n == 0) {\n out.println(x);\n out.close();\n return;\n }\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n int diff = Integer.MAX_VALUE;\n int target = arr[0];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }\n int offset = 1;\n while(true) {\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }\n\n out.close();\n }\n\n public static void main(String[] args) throws IOException {\n new Main().execute();\n }\n\n void debug(Object... os) {\n System.out.println(Arrays.deepToString(os));\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String ns() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(br.readLine());\n }\n return tokenizer.nextToken();\n }\n\n String nline() throws IOException {\n tokenizer = null;\n return br.readLine();\n }\n\n boolean input() throws IOException {\n return true;\n }\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.BufferedWriter;",
"BufferedWriter",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.OutputStreamWriter;",
"OutputStreamWriter",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tokenizer = null;\n int totalCases, testNum;\n\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n void solve() throws IOException {\n\n }\n\n void execute() throws IOException {\n int x = ni();\n int n = ni();\n if (n == 0) {\n out.println(x);\n out.close();\n return;\n }\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n int diff = Integer.MAX_VALUE;\n int target = arr[0];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }\n int offset = 1;\n while(true) {\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }\n\n out.close();\n }\n\n public static void main(String[] args) throws IOException {\n new Main().execute();\n }\n\n void debug(Object... os) {\n System.out.println(Arrays.deepToString(os));\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String ns() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(br.readLine());\n }\n return tokenizer.nextToken();\n }\n\n String nline() throws IOException {\n tokenizer = null;\n return br.readLine();\n }\n\n boolean input() throws IOException {\n return true;\n }\n\n}",
"Main",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringTokenizer tokenizer = null;",
"tokenizer",
"null",
"int totalCases",
"totalCases",
"testNum;",
"testNum",
"PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));",
"out",
"new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)))",
"void solve() throws IOException {\n\n }",
"solve",
"{\n\n }",
"void execute() throws IOException {\n int x = ni();\n int n = ni();\n if (n == 0) {\n out.println(x);\n out.close();\n return;\n }\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n int diff = Integer.MAX_VALUE;\n int target = arr[0];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }\n int offset = 1;\n while(true) {\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }\n\n out.close();\n }",
"execute",
"{\n int x = ni();\n int n = ni();\n if (n == 0) {\n out.println(x);\n out.close();\n return;\n }\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n int diff = Integer.MAX_VALUE;\n int target = arr[0];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }\n int offset = 1;\n while(true) {\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }\n\n out.close();\n }",
"int x = ni();",
"x",
"ni()",
"ni",
"int n = ni();",
"n",
"ni()",
"ni",
"if (n == 0) {\n out.println(x);\n out.close();\n return;\n }",
"n == 0",
"n",
"0",
"{\n out.println(x);\n out.close();\n return;\n }",
"out.println(x)",
"out.println",
"out",
"x",
"out.close()",
"out.close",
"out",
"return;",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = ni();\n }",
"{\n arr[i] = ni();\n }",
"arr[i] = ni()",
"arr[i]",
"arr",
"i",
"ni()",
"ni",
"int diff = Integer.MAX_VALUE;",
"diff",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int target = arr[0];",
"target",
"arr[0]",
"arr",
"0",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }",
"{\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }",
"set.add(arr[i])",
"set.add",
"set",
"arr[i]",
"arr",
"i",
"int currDiff = Math.abs(x - arr[i]);",
"currDiff",
"Math.abs(x - arr[i])",
"Math.abs",
"Math",
"x - arr[i]",
"x",
"arr[i]",
"arr",
"i",
"if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }",
"currDiff < diff",
"currDiff",
"diff",
"{\n diff = currDiff;\n target = arr[i];\n }",
"diff = currDiff",
"diff",
"currDiff",
"target = arr[i]",
"target",
"arr[i]",
"arr",
"i",
"int offset = 1;",
"offset",
"1",
"while(true) {\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }",
"true",
"{\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }",
"int left = target - offset;",
"left",
"target - offset",
"target",
"offset",
"int right = target + offset;",
"right",
"target + offset",
"target",
"offset",
"if (!set.contains(left)) {\n out.println(left);\n break;\n }",
"!set.contains(left)",
"set.contains(left)",
"set.contains",
"set",
"left",
"{\n out.println(left);\n break;\n }",
"out.println(left)",
"out.println",
"out",
"left",
"break;",
"if (!set.contains(right)) {\n out.println(right);\n break;\n }",
"!set.contains(right)",
"set.contains(right)",
"set.contains",
"set",
"right",
"{\n out.println(right);\n break;\n }",
"out.println(right)",
"out.println",
"out",
"right",
"break;",
"offset++",
"offset",
"out.close()",
"out.close",
"out",
"public static void main(String[] args) throws IOException {\n new Main().execute();\n }",
"main",
"{\n new Main().execute();\n }",
"new Main().execute()",
"new Main().execute",
"new Main()",
"String[] args",
"args",
"void debug(Object... os) {\n System.out.println(Arrays.deepToString(os));\n }",
"debug",
"{\n System.out.println(Arrays.deepToString(os));\n }",
"System.out.println(Arrays.deepToString(os))",
"System.out.println",
"System.out",
"System",
"System.out",
"Arrays.deepToString(os)",
"Arrays.deepToString",
"Arrays",
"os",
"Object... os",
"os",
"int ni() throws IOException {\n return Integer.parseInt(ns());\n }",
"ni",
"{\n return Integer.parseInt(ns());\n }",
"return Integer.parseInt(ns());",
"Integer.parseInt(ns())",
"Integer.parseInt",
"Integer",
"ns()",
"ns",
"long nl() throws IOException {\n return Long.parseLong(ns());\n }",
"nl",
"{\n return Long.parseLong(ns());\n }",
"return Long.parseLong(ns());",
"Long.parseLong(ns())",
"Long.parseLong",
"Long",
"ns()",
"ns",
"double nd() throws IOException {\n return Double.parseDouble(ns());\n }",
"nd",
"{\n return Double.parseDouble(ns());\n }",
"return Double.parseDouble(ns());",
"Double.parseDouble(ns())",
"Double.parseDouble",
"Double",
"ns()",
"ns",
"String ns() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(br.readLine());\n }\n return tokenizer.nextToken();\n }",
"ns",
"{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(br.readLine());\n }\n return tokenizer.nextToken();\n }",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(br.readLine());\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n tokenizer = new StringTokenizer(br.readLine());\n }",
"tokenizer = new StringTokenizer(br.readLine())",
"tokenizer",
"new StringTokenizer(br.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"String nline() throws IOException {\n tokenizer = null;\n return br.readLine();\n }",
"nline",
"{\n tokenizer = null;\n return br.readLine();\n }",
"tokenizer = null",
"tokenizer",
"null",
"return br.readLine();",
"br.readLine()",
"br.readLine",
"br",
"boolean input() throws IOException {\n return true;\n }",
"input",
"{\n return true;\n }",
"return true;",
"true",
"public class Main {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tokenizer = null;\n int totalCases, testNum;\n\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n void solve() throws IOException {\n\n }\n\n void execute() throws IOException {\n int x = ni();\n int n = ni();\n if (n == 0) {\n out.println(x);\n out.close();\n return;\n }\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n int diff = Integer.MAX_VALUE;\n int target = arr[0];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }\n int offset = 1;\n while(true) {\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }\n\n out.close();\n }\n\n public static void main(String[] args) throws IOException {\n new Main().execute();\n }\n\n void debug(Object... os) {\n System.out.println(Arrays.deepToString(os));\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String ns() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(br.readLine());\n }\n return tokenizer.nextToken();\n }\n\n String nline() throws IOException {\n tokenizer = null;\n return br.readLine();\n }\n\n boolean input() throws IOException {\n return true;\n }\n\n}",
"public class Main {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tokenizer = null;\n int totalCases, testNum;\n\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n void solve() throws IOException {\n\n }\n\n void execute() throws IOException {\n int x = ni();\n int n = ni();\n if (n == 0) {\n out.println(x);\n out.close();\n return;\n }\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n int diff = Integer.MAX_VALUE;\n int target = arr[0];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(arr[i]);\n int currDiff = Math.abs(x - arr[i]);\n if (currDiff < diff) {\n diff = currDiff;\n target = arr[i];\n }\n }\n int offset = 1;\n while(true) {\n int left = target - offset;\n int right = target + offset;\n if (!set.contains(left)) {\n out.println(left);\n break;\n }\n if (!set.contains(right)) {\n out.println(right);\n break;\n }\n offset++;\n }\n\n out.close();\n }\n\n public static void main(String[] args) throws IOException {\n new Main().execute();\n }\n\n void debug(Object... os) {\n System.out.println(Arrays.deepToString(os));\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String ns() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(br.readLine());\n }\n return tokenizer.nextToken();\n }\n\n String nline() throws IOException {\n tokenizer = null;\n return br.readLine();\n }\n\n boolean input() throws IOException {\n return true;\n }\n\n}",
"Main"
]
|
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
public class Main {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tokenizer = null;
int totalCases, testNum;
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
void solve() throws IOException {
}
void execute() throws IOException {
int x = ni();
int n = ni();
if (n == 0) {
out.println(x);
out.close();
return;
}
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = ni();
}
int diff = Integer.MAX_VALUE;
int target = arr[0];
Set<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
set.add(arr[i]);
int currDiff = Math.abs(x - arr[i]);
if (currDiff < diff) {
diff = currDiff;
target = arr[i];
}
}
int offset = 1;
while(true) {
int left = target - offset;
int right = target + offset;
if (!set.contains(left)) {
out.println(left);
break;
}
if (!set.contains(right)) {
out.println(right);
break;
}
offset++;
}
out.close();
}
public static void main(String[] args) throws IOException {
new Main().execute();
}
void debug(Object... os) {
System.out.println(Arrays.deepToString(os));
}
int ni() throws IOException {
return Integer.parseInt(ns());
}
long nl() throws IOException {
return Long.parseLong(ns());
}
double nd() throws IOException {
return Double.parseDouble(ns());
}
String ns() throws IOException {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(br.readLine());
}
return tokenizer.nextToken();
}
String nline() throws IOException {
tokenizer = null;
return br.readLine();
}
boolean input() throws IOException {
return true;
}
}
|
[
7,
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,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
4,
18,
13,
17,
41,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
17,
18,
13,
13,
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,
23,
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,
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,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
298,
14
],
[
298,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
20,
22
],
[
17,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
17,
28
],
[
28,
29
],
[
28,
30
],
[
17,
31
],
[
31,
32
],
[
31,
33
],
[
17,
34
],
[
34,
35
],
[
34,
36
],
[
17,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
37,
41
],
[
37,
42
],
[
17,
43
],
[
43,
44
],
[
44,
45
],
[
15,
46
],
[
46,
47
],
[
298,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
52,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
63,
64
],
[
63,
65
],
[
52,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
79,
85
],
[
52,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
52,
91
],
[
91,
92
],
[
91,
93
],
[
52,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
94,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
103,
104
],
[
104,
105
],
[
94,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
107,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
123,
125
],
[
117,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
132,
133
],
[
132,
134
],
[
126,
135
],
[
135,
136
],
[
135,
137
],
[
52,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
50,
144
],
[
144,
145
],
[
50,
146
],
[
146,
147
],
[
50,
148
],
[
148,
149
],
[
298,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
150,
154
],
[
154,
155
],
[
154,
156
],
[
150,
158
],
[
158,
159
],
[
150,
160
],
[
160,
161
],
[
150,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
162,
170
],
[
170,
171
],
[
150,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
175,
180
],
[
180,
181
],
[
174,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
190,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
199,
202
],
[
186,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
203,
207
],
[
207,
208
],
[
208,
209
],
[
174,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
150,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
217,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
217,
230
],
[
230,
231
],
[
230,
232
],
[
217,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
237,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
217,
246
],
[
246,
247
],
[
246,
248
],
[
217,
249
],
[
249,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
249,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
260,
262
],
[
254,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
217,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
150,
271
],
[
271,
272
],
[
271,
273
],
[
273,
274
],
[
274,
275
],
[
278,
276
],
[
288,
277
],
[
285,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
278,
282
],
[
282,
283
],
[
282,
284
],
[
285,
285
],
[
285,
286
],
[
285,
287
],
[
288,
288
],
[
288,
289
],
[
288,
290
],
[
278,
291
],
[
291,
292
],
[
291,
293
],
[
293,
294
],
[
271,
295
],
[
295,
296
],
[
0,
297
],
[
297,
298
],
[
297,
299
]
]
| [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Spandan Mishra\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.readInt();\n int n = in.readInt();\n boolean[] a = new boolean[201];\n\n for (int i = 0; i < n; i++)\n a[in.readInt()] = true;\n\n int min = Integer.MAX_VALUE;\n int ans = 0;\n for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }\n\n System.out.println(ans);\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}\n",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"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.readInt();\n int n = in.readInt();\n boolean[] a = new boolean[201];\n\n for (int i = 0; i < n; i++)\n a[in.readInt()] = true;\n\n int min = Integer.MAX_VALUE;\n int ans = 0;\n for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }\n\n System.out.println(ans);\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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.readInt();\n int n = in.readInt();\n boolean[] a = new boolean[201];\n\n for (int i = 0; i < n; i++)\n a[in.readInt()] = true;\n\n int min = Integer.MAX_VALUE;\n int ans = 0;\n for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }\n\n System.out.println(ans);\n }\n\n }",
"CForbiddenList",
"public void solve(int testNumber, InputReader in, PrintWriter out) {\n int x = in.readInt();\n int n = in.readInt();\n boolean[] a = new boolean[201];\n\n for (int i = 0; i < n; i++)\n a[in.readInt()] = true;\n\n int min = Integer.MAX_VALUE;\n int ans = 0;\n for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }\n\n System.out.println(ans);\n }",
"solve",
"{\n int x = in.readInt();\n int n = in.readInt();\n boolean[] a = new boolean[201];\n\n for (int i = 0; i < n; i++)\n a[in.readInt()] = true;\n\n int min = Integer.MAX_VALUE;\n int ans = 0;\n for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }\n\n System.out.println(ans);\n }",
"int x = in.readInt();",
"x",
"in.readInt()",
"in.readInt",
"in",
"int n = in.readInt();",
"n",
"in.readInt()",
"in.readInt",
"in",
"boolean[] a = new boolean[201];",
"a",
"new boolean[201]",
"201",
"for (int i = 0; i < n; i++)\n a[in.readInt()] = true;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[in.readInt()] = true;",
"a[in.readInt()] = true",
"a[in.readInt()]",
"a",
"in.readInt()",
"in.readInt",
"in",
"true",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int ans = 0;",
"ans",
"0",
"for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }",
"int i = -100;",
"int i = -100;",
"i",
"-100",
"100",
"i <= 200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }",
"{\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }",
"if (i >= 0 && a[i])\n continue;",
"i >= 0 && a[i]",
"i >= 0",
"i",
"0",
"a[i]",
"a",
"i",
"continue;",
"if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\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 ans = 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",
"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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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",
"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 RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"read",
"{\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"if (numChars == -1)\n throw new RuntimeException();",
"numChars == -1",
"numChars",
"-1",
"1",
"throw new RuntimeException();",
"new RuntimeException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\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 RuntimeException();\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 RuntimeException();\n }",
"catch (IOException e) {\n throw new RuntimeException();\n }",
"IOException e",
"{\n throw new RuntimeException();\n }",
"throw new RuntimeException();",
"new RuntimeException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0)\n return -1;",
"numChars <= 0",
"numChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\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 }",
"readInt",
"{\n int c = read();\n while (isSpaceChar(c))\n c = read();\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();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"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 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",
"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.readInt();\n int n = in.readInt();\n boolean[] a = new boolean[201];\n\n for (int i = 0; i < n; i++)\n a[in.readInt()] = true;\n\n int min = Integer.MAX_VALUE;\n int ans = 0;\n for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }\n\n System.out.println(ans);\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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.readInt();\n int n = in.readInt();\n boolean[] a = new boolean[201];\n\n for (int i = 0; i < n; i++)\n a[in.readInt()] = true;\n\n int min = Integer.MAX_VALUE;\n int ans = 0;\n for (int i = -100; i <= 200; i++) {\n if (i >= 0 && a[i])\n continue;\n\n if (min > Math.abs(x - i)) {\n min = Math.abs(x - i);\n ans = i;\n }\n\n }\n\n System.out.println(ans);\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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}",
"Main"
]
| import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Spandan Mishra
*/
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.readInt();
int n = in.readInt();
boolean[] a = new boolean[201];
for (int i = 0; i < n; i++)
a[in.readInt()] = true;
int min = Integer.MAX_VALUE;
int ans = 0;
for (int i = -100; i <= 200; i++) {
if (i >= 0 && a[i])
continue;
if (min > Math.abs(x - i)) {
min = Math.abs(x - i);
ans = i;
}
}
System.out.println(ans);
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1)
throw new RuntimeException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new RuntimeException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int readInt() {
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 boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -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,
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,
42,
17,
30,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
0,
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
],
[
96,
5
],
[
96,
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
],
[
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
],
[
47,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
52,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
58,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
52,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
52,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
74,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
52,
85
],
[
85,
86
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
6,
93
],
[
93,
94
],
[
0,
95
],
[
95,
96
],
[
95,
97
]
]
| [
"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 ans = 0;\n\t\tSet<Integer> dict = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdict.add(sc.nextInt());\n\t\t}\n\t\tint diff = 0;\n\t\twhile (true) {\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n\n\n\n\n\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 ans = 0;\n\t\tSet<Integer> dict = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdict.add(sc.nextInt());\n\t\t}\n\t\tint diff = 0;\n\t\twhile (true) {\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\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 = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 0;\n\t\tSet<Integer> dict = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdict.add(sc.nextInt());\n\t\t}\n\t\tint diff = 0;\n\t\twhile (true) {\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\n\t\t}\n\t\tSystem.out.println(ans);\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 ans = 0;\n\t\tSet<Integer> dict = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdict.add(sc.nextInt());\n\t\t}\n\t\tint diff = 0;\n\t\twhile (true) {\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\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",
"int ans = 0;",
"ans",
"0",
"Set<Integer> dict = new HashSet<>();",
"dict",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n\t\t\tdict.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tdict.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tdict.add(sc.nextInt());\n\t\t}",
"dict.add(sc.nextInt())",
"dict.add",
"dict",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int diff = 0;",
"diff",
"0",
"while (true) {\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\n\t\t}",
"true",
"{\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\n\t\t}",
"int a = x - diff;",
"a",
"x - diff",
"x",
"diff",
"if (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}",
"!dict.contains(a)",
"dict.contains(a)",
"dict.contains",
"dict",
"a",
"{\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = a",
"ans",
"a",
"break;",
"a = x + diff",
"a",
"x + diff",
"x",
"diff",
"if (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}",
"!dict.contains(a)",
"dict.contains(a)",
"dict.contains",
"dict",
"a",
"{\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = a",
"ans",
"a",
"break;",
"diff++",
"diff",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 0;\n\t\tSet<Integer> dict = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdict.add(sc.nextInt());\n\t\t}\n\t\tint diff = 0;\n\t\twhile (true) {\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans = 0;\n\t\tSet<Integer> dict = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdict.add(sc.nextInt());\n\t\t}\n\t\tint diff = 0;\n\t\twhile (true) {\n\t\t\tint a = x - diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta = x + diff;\n\t\t\tif (!dict.contains(a)) {\n\t\t\t\tans = a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdiff++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int ans = 0;
Set<Integer> dict = new HashSet<>();
for (int i = 0; i < n; i++) {
dict.add(sc.nextInt());
}
int diff = 0;
while (true) {
int a = x - diff;
if (!dict.contains(a)) {
ans = a;
break;
}
a = x + diff;
if (!dict.contains(a)) {
ans = a;
break;
}
diff++;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
0,
13,
4,
18,
13,
0,
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,
2,
40,
17,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
18,
13,
2,
17,
18,
13,
13,
40,
17,
41,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
2,
13,
18,
13,
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
],
[
138,
5
],
[
138,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
8,
85
],
[
85,
86
],
[
8,
87
],
[
87,
88
],
[
87,
89
],
[
8,
90
],
[
90,
91
],
[
90,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
105,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
8,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
6,
135
],
[
135,
136
],
[
0,
137
],
[
137,
138
],
[
137,
139
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X,N;\n\t\tX=sc.nextInt();\n\t\tN=sc.nextInt();\n\n\t\tint syoki_hairetu[] = new int[301];\n\t\tfor(int i=0;i<301;i++) {\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}\n\n\n\t\tint p[]=new int[N];\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tp[i]=sc.nextInt();\n\t\t\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}\n\n\t\tint tmp;\n\t\tint min_abs=1000;\n\t\tint min_number=1000;\n\n\t\tfor(int i=0;i<301;i++) {\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min_number);\n\t\t/*for(int i=0;i<301;i++) {\n\t\t\tSystem.out.print(syoki_hairetu[i]+\" \");\n\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 sc = new Scanner(System.in);\n\t\tint X,N;\n\t\tX=sc.nextInt();\n\t\tN=sc.nextInt();\n\n\t\tint syoki_hairetu[] = new int[301];\n\t\tfor(int i=0;i<301;i++) {\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}\n\n\n\t\tint p[]=new int[N];\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tp[i]=sc.nextInt();\n\t\t\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}\n\n\t\tint tmp;\n\t\tint min_abs=1000;\n\t\tint min_number=1000;\n\n\t\tfor(int i=0;i<301;i++) {\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min_number);\n\t\t/*for(int i=0;i<301;i++) {\n\t\t\tSystem.out.print(syoki_hairetu[i]+\" \");\n\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,N;\n\t\tX=sc.nextInt();\n\t\tN=sc.nextInt();\n\n\t\tint syoki_hairetu[] = new int[301];\n\t\tfor(int i=0;i<301;i++) {\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}\n\n\n\t\tint p[]=new int[N];\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tp[i]=sc.nextInt();\n\t\t\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}\n\n\t\tint tmp;\n\t\tint min_abs=1000;\n\t\tint min_number=1000;\n\n\t\tfor(int i=0;i<301;i++) {\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min_number);\n\t\t/*for(int i=0;i<301;i++) {\n\t\t\tSystem.out.print(syoki_hairetu[i]+\" \");\n\n\t\t}*/\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X,N;\n\t\tX=sc.nextInt();\n\t\tN=sc.nextInt();\n\n\t\tint syoki_hairetu[] = new int[301];\n\t\tfor(int i=0;i<301;i++) {\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}\n\n\n\t\tint p[]=new int[N];\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tp[i]=sc.nextInt();\n\t\t\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}\n\n\t\tint tmp;\n\t\tint min_abs=1000;\n\t\tint min_number=1000;\n\n\t\tfor(int i=0;i<301;i++) {\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min_number);\n\t\t/*for(int i=0;i<301;i++) {\n\t\t\tSystem.out.print(syoki_hairetu[i]+\" \");\n\n\t\t}*/\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int X",
"X",
"N;",
"N",
"X=sc.nextInt()",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"N=sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int syoki_hairetu[] = new int[301];",
"syoki_hairetu",
"new int[301]",
"301",
"for(int i=0;i<301;i++) {\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<301",
"i",
"301",
"i++",
"i++",
"i",
"{\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}",
"{\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}",
"syoki_hairetu[i]=-100+i",
"syoki_hairetu[i]",
"syoki_hairetu",
"i",
"-100+i",
"-100",
"100",
"i",
"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\tsyoki_hairetu[100+p[i]]=-101;\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\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}",
"{\n\t\t\tp[i]=sc.nextInt();\n\t\t\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}",
"p[i]=sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"syoki_hairetu[100+p[i]]=-101",
"syoki_hairetu[100+p[i]]",
"syoki_hairetu",
"100+p[i]",
"100",
"p[i]",
"p",
"i",
"-101",
"101",
"int tmp;",
"tmp",
"int min_abs=1000;",
"min_abs",
"1000",
"int min_number=1000;",
"min_number",
"1000",
"for(int i=0;i<301;i++) {\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<301",
"i",
"301",
"i++",
"i++",
"i",
"{\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}",
"tmp=Math.abs(X-syoki_hairetu[i])",
"tmp",
"Math.abs(X-syoki_hairetu[i])",
"Math.abs",
"Math",
"X-syoki_hairetu[i]",
"X",
"syoki_hairetu[i]",
"syoki_hairetu",
"i",
"if(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}",
"tmp<min_abs",
"tmp",
"min_abs",
"{\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}",
"min_abs=tmp",
"min_abs",
"tmp",
"min_number=syoki_hairetu[i]",
"min_number",
"syoki_hairetu[i]",
"syoki_hairetu",
"i",
"System.out.println(min_number)",
"System.out.println",
"System.out",
"System",
"System.out",
"min_number",
"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,N;\n\t\tX=sc.nextInt();\n\t\tN=sc.nextInt();\n\n\t\tint syoki_hairetu[] = new int[301];\n\t\tfor(int i=0;i<301;i++) {\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}\n\n\n\t\tint p[]=new int[N];\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tp[i]=sc.nextInt();\n\t\t\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}\n\n\t\tint tmp;\n\t\tint min_abs=1000;\n\t\tint min_number=1000;\n\n\t\tfor(int i=0;i<301;i++) {\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min_number);\n\t\t/*for(int i=0;i<301;i++) {\n\t\t\tSystem.out.print(syoki_hairetu[i]+\" \");\n\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,N;\n\t\tX=sc.nextInt();\n\t\tN=sc.nextInt();\n\n\t\tint syoki_hairetu[] = new int[301];\n\t\tfor(int i=0;i<301;i++) {\n\t\t\tsyoki_hairetu[i]=-100+i;\n\t\t}\n\n\n\t\tint p[]=new int[N];\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tp[i]=sc.nextInt();\n\t\t\tsyoki_hairetu[100+p[i]]=-101;\n\t\t}\n\n\t\tint tmp;\n\t\tint min_abs=1000;\n\t\tint min_number=1000;\n\n\t\tfor(int i=0;i<301;i++) {\n\t\t\ttmp=Math.abs(X-syoki_hairetu[i]);\n\t\t\tif(tmp<min_abs) {\n\t\t\t\tmin_abs=tmp;\n\t\t\t\tmin_number=syoki_hairetu[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min_number);\n\t\t/*for(int i=0;i<301;i++) {\n\t\t\tSystem.out.print(syoki_hairetu[i]+\" \");\n\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,N;
X=sc.nextInt();
N=sc.nextInt();
int syoki_hairetu[] = new int[301];
for(int i=0;i<301;i++) {
syoki_hairetu[i]=-100+i;
}
int p[]=new int[N];
for(int i=0;i<N;i++) {
p[i]=sc.nextInt();
syoki_hairetu[100+p[i]]=-101;
}
int tmp;
int min_abs=1000;
int min_number=1000;
for(int i=0;i<301;i++) {
tmp=Math.abs(X-syoki_hairetu[i]);
if(tmp<min_abs) {
min_abs=tmp;
min_number=syoki_hairetu[i];
}
}
System.out.println(min_number);
/*for(int i=0;i<301;i++) {
System.out.print(syoki_hairetu[i]+" ");
}*/
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
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,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
17,
41,
13,
17,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
40,
18,
13,
13,
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,
30,
0,
13,
4,
18,
13,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
4,
18,
13,
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
],
[
145,
5
],
[
145,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
14,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
33,
34
],
[
33,
35
],
[
8,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
38,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
68,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
8,
81
],
[
81,
82
],
[
81,
83
],
[
8,
84
],
[
84,
85
],
[
84,
86
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
109,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
116,
117
],
[
116,
118
],
[
106,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
125,
126
],
[
125,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
131,
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\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tString[] tmp = scanner.nextLine().split(\" \");\n\t\tint x = Integer.parseInt(tmp[0]);\n\t\tint n = Integer.parseInt(tmp[1]);\n\n\t\tString[] tmp1 = scanner.nextLine().split(\" \");\n\t\tint[] list = new int[102];\n\t\tint a = 0;\n\t\tlist[0] = 0;\n \t\tfor(int i = 0; i < n; i++) {\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}\n\n\t\tint ans = 101;\n\t\tint count = 101;\n\t\tfor(int i = 101; i >= 0; i --) {\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\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 scanner = new Scanner(System.in);\n\n\t\tString[] tmp = scanner.nextLine().split(\" \");\n\t\tint x = Integer.parseInt(tmp[0]);\n\t\tint n = Integer.parseInt(tmp[1]);\n\n\t\tString[] tmp1 = scanner.nextLine().split(\" \");\n\t\tint[] list = new int[102];\n\t\tint a = 0;\n\t\tlist[0] = 0;\n \t\tfor(int i = 0; i < n; i++) {\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}\n\n\t\tint ans = 101;\n\t\tint count = 101;\n\t\tfor(int i = 101; i >= 0; i --) {\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tString[] tmp = scanner.nextLine().split(\" \");\n\t\tint x = Integer.parseInt(tmp[0]);\n\t\tint n = Integer.parseInt(tmp[1]);\n\n\t\tString[] tmp1 = scanner.nextLine().split(\" \");\n\t\tint[] list = new int[102];\n\t\tint a = 0;\n\t\tlist[0] = 0;\n \t\tfor(int i = 0; i < n; i++) {\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}\n\n\t\tint ans = 101;\n\t\tint count = 101;\n\t\tfor(int i = 101; i >= 0; i --) {\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\n\n\t}",
"main",
"{\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tString[] tmp = scanner.nextLine().split(\" \");\n\t\tint x = Integer.parseInt(tmp[0]);\n\t\tint n = Integer.parseInt(tmp[1]);\n\n\t\tString[] tmp1 = scanner.nextLine().split(\" \");\n\t\tint[] list = new int[102];\n\t\tint a = 0;\n\t\tlist[0] = 0;\n \t\tfor(int i = 0; i < n; i++) {\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}\n\n\t\tint ans = 101;\n\t\tint count = 101;\n\t\tfor(int i = 101; i >= 0; i --) {\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\n\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"String[] tmp = scanner.nextLine().split(\" \");",
"tmp",
"scanner.nextLine().split(\" \")",
"scanner.nextLine().split",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"\" \"",
"int x = Integer.parseInt(tmp[0]);",
"x",
"Integer.parseInt(tmp[0])",
"Integer.parseInt",
"Integer",
"tmp[0]",
"tmp",
"0",
"int n = Integer.parseInt(tmp[1]);",
"n",
"Integer.parseInt(tmp[1])",
"Integer.parseInt",
"Integer",
"tmp[1]",
"tmp",
"1",
"String[] tmp1 = scanner.nextLine().split(\" \");",
"tmp1",
"scanner.nextLine().split(\" \")",
"scanner.nextLine().split",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"\" \"",
"int[] list = new int[102];",
"list",
"new int[102]",
"102",
"int a = 0;",
"a",
"0",
"list[0] = 0",
"list[0]",
"list",
"0",
"0",
"for(int i = 0; i < n; i++) {\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}",
"{\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}",
"a = Integer.parseInt(tmp1[i])",
"a",
"Integer.parseInt(tmp1[i])",
"Integer.parseInt",
"Integer",
"tmp1[i]",
"tmp1",
"i",
"list[a]++",
"list[a]",
"list",
"a",
"int ans = 101;",
"ans",
"101",
"int count = 101;",
"count",
"101",
"for(int i = 101; i >= 0; i --) {\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"int i = 101;",
"int i = 101;",
"i",
"101",
"i >= 0",
"i",
"0",
"i --",
"i --",
"i",
"{\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"{\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"if(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}",
"list[i] != 1",
"list[i]",
"list",
"i",
"1",
"{\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}",
"ans = Math.min(ans, Math.abs(x - i))",
"ans",
"Math.min(ans, Math.abs(x - i))",
"Math.min",
"Math",
"ans",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"if(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}",
"ans == Math.abs(x - i)",
"ans",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"{\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}",
"count = Math.min(count, i)",
"count",
"Math.min(count, i)",
"Math.min",
"Math",
"count",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tString[] tmp = scanner.nextLine().split(\" \");\n\t\tint x = Integer.parseInt(tmp[0]);\n\t\tint n = Integer.parseInt(tmp[1]);\n\n\t\tString[] tmp1 = scanner.nextLine().split(\" \");\n\t\tint[] list = new int[102];\n\t\tint a = 0;\n\t\tlist[0] = 0;\n \t\tfor(int i = 0; i < n; i++) {\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}\n\n\t\tint ans = 101;\n\t\tint count = 101;\n\t\tfor(int i = 101; i >= 0; i --) {\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\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\t\tString[] tmp = scanner.nextLine().split(\" \");\n\t\tint x = Integer.parseInt(tmp[0]);\n\t\tint n = Integer.parseInt(tmp[1]);\n\n\t\tString[] tmp1 = scanner.nextLine().split(\" \");\n\t\tint[] list = new int[102];\n\t\tint a = 0;\n\t\tlist[0] = 0;\n \t\tfor(int i = 0; i < n; i++) {\n\n\t\t\ta = Integer.parseInt(tmp1[i]);\n\n\t\t\tlist[a]++;\n\n\t\t}\n\n\t\tint ans = 101;\n\t\tint count = 101;\n\t\tfor(int i = 101; i >= 0; i --) {\n\n\n\t\t\tif(list[i] != 1) {\n\n\t\t\t\tans = Math.min(ans, Math.abs(x - i));\n\n\t\t\t\tif(ans == Math.abs(x - i)) {\n\n\t\t\t\t\tcount = Math.min(count, i);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\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);
String[] tmp = scanner.nextLine().split(" ");
int x = Integer.parseInt(tmp[0]);
int n = Integer.parseInt(tmp[1]);
String[] tmp1 = scanner.nextLine().split(" ");
int[] list = new int[102];
int a = 0;
list[0] = 0;
for(int i = 0; i < n; i++) {
a = Integer.parseInt(tmp1[i]);
list[a]++;
}
int ans = 101;
int count = 101;
for(int i = 101; i >= 0; i --) {
if(list[i] != 1) {
ans = Math.min(ans, Math.abs(x - i));
if(ans == Math.abs(x - i)) {
count = Math.min(count, i);
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
20,
0,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
4,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
4,
18,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
133,
14
],
[
133,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
23,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
34,
35
],
[
34,
36
],
[
17,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
42,
43
],
[
42,
44
],
[
17,
45
],
[
45,
46
],
[
45,
47
],
[
17,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
17,
53
],
[
53,
54
],
[
53,
55
],
[
17,
56
],
[
56,
57
],
[
56,
58
],
[
17,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
61,
66
],
[
17,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
85,
86
],
[
85,
87
],
[
17,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
93,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
88,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
17,
126
],
[
126,
127
],
[
127,
128
],
[
126,
129
],
[
15,
130
],
[
130,
131
],
[
0,
132
],
[
132,
133
],
[
132,
134
]
]
| [
"import java.io.*;\nimport java.util.*;\nimport static java.lang.System.*;\nimport static java.lang.Math.*;\n\npublic class Main\n{\t\n\tpublic static void main(String []args)throws IOException\n\t{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//long X=Long.parseLong(br.readLine());\n\t\tString []s=br.readLine().split(\" \");\n\t\t/*long X=Long.parseLong(s[0]);\n\t\tlong N=Long.parseLong(s[1]);\n\t\tlong C=Long.parseLong(s[2]);\n\t\tlong K=Long.parseLong(s[3]);*/\n\t\tint X=Integer.parseInt(s[0]);\n\t\tint N=Integer.parseInt(s[1]);\n\t\t\n\t\t\n\t\t\n\t\t/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array\n\t\tint ht[]=new int[N+1];\n\t\tboolean flag=false;*/\n\t\t//String ans=\"\";\n\t\t\n\t\tint ans=0, mindiff=Integer.MAX_VALUE, diff=0;\n\t\t\n\t\tHashSet<Integer> h= new HashSet<Integer>();\n\t\ts=br.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<N;i++)\n\t\t\th.add(Integer.parseInt(s[i]));\n\t\t\t\n\t\tfor(int i=0;i<=101;i++)\n\t\t{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t//ans = flag==true? \"Yes\" : \"No\";\n\t\t\n\t\tout.println(ans);\n\t\t\n\t}\n\t\n\t\n}\n\n",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import static java.lang.System.*;",
"import static java.lang.System.*;",
"import static java.lang.System.*;",
"import static java.lang.Math.*;",
"import static java.lang.Math.*;",
"import static java.lang.Math.*;",
"public class Main\n{\t\n\tpublic static void main(String []args)throws IOException\n\t{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//long X=Long.parseLong(br.readLine());\n\t\tString []s=br.readLine().split(\" \");\n\t\t/*long X=Long.parseLong(s[0]);\n\t\tlong N=Long.parseLong(s[1]);\n\t\tlong C=Long.parseLong(s[2]);\n\t\tlong K=Long.parseLong(s[3]);*/\n\t\tint X=Integer.parseInt(s[0]);\n\t\tint N=Integer.parseInt(s[1]);\n\t\t\n\t\t\n\t\t\n\t\t/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array\n\t\tint ht[]=new int[N+1];\n\t\tboolean flag=false;*/\n\t\t//String ans=\"\";\n\t\t\n\t\tint ans=0, mindiff=Integer.MAX_VALUE, diff=0;\n\t\t\n\t\tHashSet<Integer> h= new HashSet<Integer>();\n\t\ts=br.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<N;i++)\n\t\t\th.add(Integer.parseInt(s[i]));\n\t\t\t\n\t\tfor(int i=0;i<=101;i++)\n\t\t{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t//ans = flag==true? \"Yes\" : \"No\";\n\t\t\n\t\tout.println(ans);\n\t\t\n\t}\n\t\n\t\n}",
"Main",
"public static void main(String []args)throws IOException\n\t{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//long X=Long.parseLong(br.readLine());\n\t\tString []s=br.readLine().split(\" \");\n\t\t/*long X=Long.parseLong(s[0]);\n\t\tlong N=Long.parseLong(s[1]);\n\t\tlong C=Long.parseLong(s[2]);\n\t\tlong K=Long.parseLong(s[3]);*/\n\t\tint X=Integer.parseInt(s[0]);\n\t\tint N=Integer.parseInt(s[1]);\n\t\t\n\t\t\n\t\t\n\t\t/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array\n\t\tint ht[]=new int[N+1];\n\t\tboolean flag=false;*/\n\t\t//String ans=\"\";\n\t\t\n\t\tint ans=0, mindiff=Integer.MAX_VALUE, diff=0;\n\t\t\n\t\tHashSet<Integer> h= new HashSet<Integer>();\n\t\ts=br.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<N;i++)\n\t\t\th.add(Integer.parseInt(s[i]));\n\t\t\t\n\t\tfor(int i=0;i<=101;i++)\n\t\t{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t//ans = flag==true? \"Yes\" : \"No\";\n\t\t\n\t\tout.println(ans);\n\t\t\n\t}",
"main",
"{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//long X=Long.parseLong(br.readLine());\n\t\tString []s=br.readLine().split(\" \");\n\t\t/*long X=Long.parseLong(s[0]);\n\t\tlong N=Long.parseLong(s[1]);\n\t\tlong C=Long.parseLong(s[2]);\n\t\tlong K=Long.parseLong(s[3]);*/\n\t\tint X=Integer.parseInt(s[0]);\n\t\tint N=Integer.parseInt(s[1]);\n\t\t\n\t\t\n\t\t\n\t\t/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array\n\t\tint ht[]=new int[N+1];\n\t\tboolean flag=false;*/\n\t\t//String ans=\"\";\n\t\t\n\t\tint ans=0, mindiff=Integer.MAX_VALUE, diff=0;\n\t\t\n\t\tHashSet<Integer> h= new HashSet<Integer>();\n\t\ts=br.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<N;i++)\n\t\t\th.add(Integer.parseInt(s[i]));\n\t\t\t\n\t\tfor(int i=0;i<=101;i++)\n\t\t{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t//ans = flag==true? \"Yes\" : \"No\";\n\t\t\n\t\tout.println(ans);\n\t\t\n\t}",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String []s=br.readLine().split(\" \");",
"s",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int X=Integer.parseInt(s[0]);",
"X",
"Integer.parseInt(s[0])",
"Integer.parseInt",
"Integer",
"s[0]",
"s",
"0",
"int N=Integer.parseInt(s[1]);",
"N",
"Integer.parseInt(s[1])",
"Integer.parseInt",
"Integer",
"s[1]",
"s",
"1",
"int ans=0",
"ans",
"0",
"mindiff=Integer.MAX_VALUE",
"mindiff",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"diff=0;",
"diff",
"0",
"HashSet<Integer> h= new HashSet<Integer>();",
"h",
"new HashSet<Integer>()",
"s=br.readLine().split(\" \")",
"s",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i=0;i<N;i++)\n\t\t\th.add(Integer.parseInt(s[i]));",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"h.add(Integer.parseInt(s[i]));",
"h.add(Integer.parseInt(s[i]))",
"h.add",
"h",
"Integer.parseInt(s[i])",
"Integer.parseInt",
"Integer",
"s[i]",
"s",
"i",
"for(int i=0;i<=101;i++)\n\t\t{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\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<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"if(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}",
"!h.contains(i)",
"h.contains(i)",
"h.contains",
"h",
"i",
"{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}",
"diff= abs(X-i)",
"diff",
"abs(X-i)",
"abs",
"X-i",
"X",
"i",
"if(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}",
"diff<mindiff",
"diff",
"mindiff",
"{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}",
"mindiff=diff",
"mindiff",
"diff",
"ans=i",
"ans",
"i",
"out.println(ans)",
"out.println",
"out",
"ans",
"String []args",
"args",
"public class Main\n{\t\n\tpublic static void main(String []args)throws IOException\n\t{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//long X=Long.parseLong(br.readLine());\n\t\tString []s=br.readLine().split(\" \");\n\t\t/*long X=Long.parseLong(s[0]);\n\t\tlong N=Long.parseLong(s[1]);\n\t\tlong C=Long.parseLong(s[2]);\n\t\tlong K=Long.parseLong(s[3]);*/\n\t\tint X=Integer.parseInt(s[0]);\n\t\tint N=Integer.parseInt(s[1]);\n\t\t\n\t\t\n\t\t\n\t\t/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array\n\t\tint ht[]=new int[N+1];\n\t\tboolean flag=false;*/\n\t\t//String ans=\"\";\n\t\t\n\t\tint ans=0, mindiff=Integer.MAX_VALUE, diff=0;\n\t\t\n\t\tHashSet<Integer> h= new HashSet<Integer>();\n\t\ts=br.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<N;i++)\n\t\t\th.add(Integer.parseInt(s[i]));\n\t\t\t\n\t\tfor(int i=0;i<=101;i++)\n\t\t{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t//ans = flag==true? \"Yes\" : \"No\";\n\t\t\n\t\tout.println(ans);\n\t\t\n\t}\n\t\n\t\n}",
"public class Main\n{\t\n\tpublic static void main(String []args)throws IOException\n\t{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//long X=Long.parseLong(br.readLine());\n\t\tString []s=br.readLine().split(\" \");\n\t\t/*long X=Long.parseLong(s[0]);\n\t\tlong N=Long.parseLong(s[1]);\n\t\tlong C=Long.parseLong(s[2]);\n\t\tlong K=Long.parseLong(s[3]);*/\n\t\tint X=Integer.parseInt(s[0]);\n\t\tint N=Integer.parseInt(s[1]);\n\t\t\n\t\t\n\t\t\n\t\t/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array\n\t\tint ht[]=new int[N+1];\n\t\tboolean flag=false;*/\n\t\t//String ans=\"\";\n\t\t\n\t\tint ans=0, mindiff=Integer.MAX_VALUE, diff=0;\n\t\t\n\t\tHashSet<Integer> h= new HashSet<Integer>();\n\t\ts=br.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<N;i++)\n\t\t\th.add(Integer.parseInt(s[i]));\n\t\t\t\n\t\tfor(int i=0;i<=101;i++)\n\t\t{\n\t\t\tif(!h.contains(i))\n\t\t\t{\n\t\t\t\tdiff= abs(X-i);\n\t\t\t\tif(diff<mindiff)\n\t\t\t\t{\n\t\t\t\t\tmindiff=diff;\n\t\t\t\t\tans=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t//ans = flag==true? \"Yes\" : \"No\";\n\t\t\n\t\tout.println(ans);\n\t\t\n\t}\n\t\n\t\n}",
"Main"
]
| import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main
{
public static void main(String []args)throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//long X=Long.parseLong(br.readLine());
String []s=br.readLine().split(" ");
/*long X=Long.parseLong(s[0]);
long N=Long.parseLong(s[1]);
long C=Long.parseLong(s[2]);
long K=Long.parseLong(s[3]);*/
int X=Integer.parseInt(s[0]);
int N=Integer.parseInt(s[1]);
/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
int ht[]=new int[N+1];
boolean flag=false;*/
//String ans="";
int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
HashSet<Integer> h= new HashSet<Integer>();
s=br.readLine().split(" ");
for(int i=0;i<N;i++)
h.add(Integer.parseInt(s[i]));
for(int i=0;i<=101;i++)
{
if(!h.contains(i))
{
diff= abs(X-i);
if(diff<mindiff)
{
mindiff=diff;
ans=i;
}
}
}
//ans = flag==true? "Yes" : "No";
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
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,
4,
18,
18,
13,
13,
13,
29,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
116,
5
],
[
116,
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,
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
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
8,
59
],
[
59,
60
],
[
59,
61
],
[
8,
62
],
[
62,
63
],
[
62,
64
],
[
8,
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
],
[
81,
82
],
[
80,
83
],
[
78,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
90,
91
],
[
90,
92
],
[
86,
93
],
[
85,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
103,
104
],
[
103,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
8,
112
],
[
6,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
]
| [
"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\n if(n==0) {\n System.out.print(x);\n return;\n }\n HashSet<Integer> set = new HashSet<>();\n\n for(int i=0; i<n; i++) {\n int num = sc.nextInt();\n set.add(num);\n }\n\n int abs = 101;\n int z = x;\n for(int i=0; i<=101; i++) {\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }\n System.out.print(z);\n return;\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 if(n==0) {\n System.out.print(x);\n return;\n }\n HashSet<Integer> set = new HashSet<>();\n\n for(int i=0; i<n; i++) {\n int num = sc.nextInt();\n set.add(num);\n }\n\n int abs = 101;\n int z = x;\n for(int i=0; i<=101; i++) {\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }\n System.out.print(z);\n return;\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 if(n==0) {\n System.out.print(x);\n return;\n }\n HashSet<Integer> set = new HashSet<>();\n\n for(int i=0; i<n; i++) {\n int num = sc.nextInt();\n set.add(num);\n }\n\n int abs = 101;\n int z = x;\n for(int i=0; i<=101; i++) {\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }\n System.out.print(z);\n return;\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n==0) {\n System.out.print(x);\n return;\n }\n HashSet<Integer> set = new HashSet<>();\n\n for(int i=0; i<n; i++) {\n int num = sc.nextInt();\n set.add(num);\n }\n\n int abs = 101;\n int z = x;\n for(int i=0; i<=101; i++) {\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }\n System.out.print(z);\n return;\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.print(x);\n return;\n }",
"n==0",
"n",
"0",
"{\n System.out.print(x);\n return;\n }",
"System.out.print(x)",
"System.out.print",
"System.out",
"System",
"System.out",
"x",
"return;",
"HashSet<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for(int i=0; i<n; i++) {\n int num = sc.nextInt();\n set.add(num);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int num = sc.nextInt();\n set.add(num);\n }",
"{\n int num = sc.nextInt();\n set.add(num);\n }",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"set.add(num)",
"set.add",
"set",
"num",
"int abs = 101;",
"abs",
"101",
"int z = x;",
"z",
"x",
"for(int i=0; i<=101; i++) {\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }",
"{\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }",
"if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }",
"!set.contains(i)",
"set.contains(i)",
"set.contains",
"set",
"i",
"{\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }",
"if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }",
"Math.abs(x-i) < abs",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"abs",
"{\n abs = Math.abs(x-i);\n z = i;\n }",
"abs = Math.abs(x-i)",
"abs",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"z = i",
"z",
"i",
"System.out.print(z)",
"System.out.print",
"System.out",
"System",
"System.out",
"z",
"return;",
"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 if(n==0) {\n System.out.print(x);\n return;\n }\n HashSet<Integer> set = new HashSet<>();\n\n for(int i=0; i<n; i++) {\n int num = sc.nextInt();\n set.add(num);\n }\n\n int abs = 101;\n int z = x;\n for(int i=0; i<=101; i++) {\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }\n System.out.print(z);\n return;\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 if(n==0) {\n System.out.print(x);\n return;\n }\n HashSet<Integer> set = new HashSet<>();\n\n for(int i=0; i<n; i++) {\n int num = sc.nextInt();\n set.add(num);\n }\n\n int abs = 101;\n int z = x;\n for(int i=0; i<=101; i++) {\n if(!set.contains(i)) {\n if (Math.abs(x-i) < abs) {\n abs = Math.abs(x-i);\n z = i;\n }\n }\n }\n System.out.print(z);\n return;\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.print(x);
return;
}
HashSet<Integer> set = new HashSet<>();
for(int i=0; i<n; i++) {
int num = sc.nextInt();
set.add(num);
}
int abs = 101;
int z = x;
for(int i=0; i<=101; i++) {
if(!set.contains(i)) {
if (Math.abs(x-i) < abs) {
abs = Math.abs(x-i);
z = i;
}
}
}
System.out.print(z);
return;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
13,
4,
18,
13,
13,
29,
41,
13,
20,
2,
17,
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,
42,
17,
30,
41,
13,
2,
13,
13,
14,
2,
2,
17,
13,
2,
13,
17,
30,
14,
40,
18,
13,
13,
30,
4,
18,
13,
4,
18,
13,
13,
29,
41,
13,
2,
13,
13,
14,
2,
2,
17,
13,
2,
13,
17,
30,
14,
40,
18,
13,
13,
30,
4,
18,
13,
4,
18,
13,
13,
29,
14,
2,
13,
17,
30,
4,
18,
13,
4,
18,
13,
13,
29,
14,
2,
17,
13,
30,
4,
18,
13,
4,
18,
13,
13,
29,
40,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
205,
17
],
[
205,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
23,
25
],
[
20,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
28,
30
],
[
20,
31
],
[
31,
32
],
[
31,
33
],
[
20,
34
],
[
34,
35
],
[
34,
36
],
[
20,
37
],
[
37,
38
],
[
37,
39
],
[
20,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
40,
44
],
[
40,
45
],
[
20,
46
],
[
46,
47
],
[
47,
48
],
[
18,
49
],
[
49,
50
],
[
205,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
55,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
70,
78
],
[
55,
79
],
[
79,
80
],
[
79,
81
],
[
82,
83
],
[
82,
84
],
[
55,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
85,
96
],
[
97,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
97,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
55,
108
],
[
108,
109
],
[
108,
110
],
[
55,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
133,
141
],
[
113,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
113,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
152,
154
],
[
147,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
162,
165
],
[
165,
166
],
[
166,
167
],
[
165,
168
],
[
161,
169
],
[
113,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
178,
179
],
[
179,
180
],
[
178,
181
],
[
174,
182
],
[
113,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
183,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
188,
191
],
[
191,
192
],
[
192,
193
],
[
191,
194
],
[
187,
195
],
[
113,
196
],
[
196,
197
],
[
53,
198
],
[
198,
199
],
[
53,
200
],
[
200,
201
],
[
53,
202
],
[
202,
203
],
[
0,
204
],
[
204,
205
],
[
204,
206
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\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 ForbiddenList solver = new ForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ForbiddenList {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n\n if (n == 0) {\n out.append(String.valueOf(x));\n return;\n }\n\n boolean[] p = new boolean[100 + 1];\n for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }\n\n int pos = 0;\n while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\n }\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n ForbiddenList solver = new ForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ForbiddenList {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n\n if (n == 0) {\n out.append(String.valueOf(x));\n return;\n }\n\n boolean[] p = new boolean[100 + 1];\n for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }\n\n int pos = 0;\n while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\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 ForbiddenList solver = new ForbiddenList();\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 ForbiddenList solver = new ForbiddenList();\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)",
"ForbiddenList solver = new ForbiddenList();",
"solver",
"new ForbiddenList()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class ForbiddenList {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n\n if (n == 0) {\n out.append(String.valueOf(x));\n return;\n }\n\n boolean[] p = new boolean[100 + 1];\n for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }\n\n int pos = 0;\n while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\n }\n }\n\n }",
"ForbiddenList",
"public void solve(int testNumber, Scanner in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n\n if (n == 0) {\n out.append(String.valueOf(x));\n return;\n }\n\n boolean[] p = new boolean[100 + 1];\n for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }\n\n int pos = 0;\n while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\n }\n }",
"solve",
"{\n int x = in.nextInt();\n int n = in.nextInt();\n\n if (n == 0) {\n out.append(String.valueOf(x));\n return;\n }\n\n boolean[] p = new boolean[100 + 1];\n for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }\n\n int pos = 0;\n while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\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.append(String.valueOf(x));\n return;\n }",
"n == 0",
"n",
"0",
"{\n out.append(String.valueOf(x));\n return;\n }",
"out.append(String.valueOf(x))",
"out.append",
"out",
"String.valueOf(x)",
"String.valueOf",
"String",
"x",
"return;",
"boolean[] p = new boolean[100 + 1];",
"p",
"new boolean[100 + 1]",
"100 + 1",
"100",
"1",
"for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int a = in.nextInt();\n p[a] = true;\n }",
"{\n int a = in.nextInt();\n p[a] = true;\n }",
"int a = in.nextInt();",
"a",
"in.nextInt()",
"in.nextInt",
"in",
"p[a] = true",
"p[a]",
"p",
"a",
"true",
"int pos = 0;",
"pos",
"0",
"while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\n }",
"true",
"{\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\n }",
"int minus = x - pos;",
"minus",
"x - pos",
"x",
"pos",
"if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }",
"0 <= minus && minus <= 100",
"0 <= minus",
"0",
"minus",
"minus <= 100",
"minus",
"100",
"{\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }",
"if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }",
"!p[minus]",
"p[minus]",
"p",
"minus",
"{\n out.append(String.valueOf(minus));\n return;\n }",
"out.append(String.valueOf(minus))",
"out.append",
"out",
"String.valueOf(minus)",
"String.valueOf",
"String",
"minus",
"return;",
"int plus = x + pos;",
"plus",
"x + pos",
"x",
"pos",
"if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }",
"0 <= plus && plus <= 100",
"0 <= plus",
"0",
"plus",
"plus <= 100",
"plus",
"100",
"{\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }",
"if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }",
"!p[plus]",
"p[plus]",
"p",
"plus",
"{\n out.append(String.valueOf(plus));\n return;\n }",
"out.append(String.valueOf(plus))",
"out.append",
"out",
"String.valueOf(plus)",
"String.valueOf",
"String",
"plus",
"return;",
"if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }",
"minus <= 0",
"minus",
"0",
"{\n out.append(String.valueOf(minus));\n return;\n }",
"out.append(String.valueOf(minus))",
"out.append",
"out",
"String.valueOf(minus)",
"String.valueOf",
"String",
"minus",
"return;",
"if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }",
"100 < plus",
"100",
"plus",
"{\n out.append(String.valueOf(plus));\n return;\n }",
"out.append(String.valueOf(plus))",
"out.append",
"out",
"String.valueOf(plus)",
"String.valueOf",
"String",
"plus",
"return;",
"pos++",
"pos",
"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 ForbiddenList solver = new ForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ForbiddenList {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n\n if (n == 0) {\n out.append(String.valueOf(x));\n return;\n }\n\n boolean[] p = new boolean[100 + 1];\n for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }\n\n int pos = 0;\n while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\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 ForbiddenList solver = new ForbiddenList();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ForbiddenList {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int x = in.nextInt();\n int n = in.nextInt();\n\n if (n == 0) {\n out.append(String.valueOf(x));\n return;\n }\n\n boolean[] p = new boolean[100 + 1];\n for (int i = 0; i < n; i++) {\n int a = in.nextInt();\n p[a] = true;\n }\n\n int pos = 0;\n while (true) {\n int minus = x - pos;\n if (0 <= minus && minus <= 100) {\n if (!p[minus]) {\n out.append(String.valueOf(minus));\n return;\n }\n }\n int plus = x + pos;\n if (0 <= plus && plus <= 100) {\n if (!p[plus]) {\n out.append(String.valueOf(plus));\n return;\n }\n }\n if (minus <= 0) {\n out.append(String.valueOf(minus));\n return;\n }\n\n if (100 < plus) {\n out.append(String.valueOf(plus));\n return;\n }\n pos++;\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.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);
ForbiddenList solver = new ForbiddenList();
solver.solve(1, in, out);
out.close();
}
static class ForbiddenList {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int x = in.nextInt();
int n = in.nextInt();
if (n == 0) {
out.append(String.valueOf(x));
return;
}
boolean[] p = new boolean[100 + 1];
for (int i = 0; i < n; i++) {
int a = in.nextInt();
p[a] = true;
}
int pos = 0;
while (true) {
int minus = x - pos;
if (0 <= minus && minus <= 100) {
if (!p[minus]) {
out.append(String.valueOf(minus));
return;
}
}
int plus = x + pos;
if (0 <= plus && plus <= 100) {
if (!p[plus]) {
out.append(String.valueOf(plus));
return;
}
}
if (minus <= 0) {
out.append(String.valueOf(minus));
return;
}
if (100 < plus) {
out.append(String.valueOf(plus));
return;
}
pos++;
}
}
}
}
|
[
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,
41,
13,
17,
41,
13,
41,
13,
0,
13,
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,
0,
13,
2,
13,
13,
14,
2,
13,
17,
30,
0,
13,
40,
13,
14,
2,
13,
13,
30,
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,
14,
2,
13,
17,
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
],
[
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,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
8,
33
],
[
33,
34
],
[
8,
35
],
[
35,
36
],
[
35,
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
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
70,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
89,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
8,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
6,
133
],
[
133,
134
],
[
0,
135
],
[
135,
136
],
[
135,
137
]
]
| [
"import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\nScanner sc=new Scanner(System.in);\nint x=sc.nextInt();\nint n=sc.nextInt();\nint p[]=new int[n];\nint dif,ans=0,ans_dif,che;\nans_dif=x;\nfor(int i=0;i<n;i++)\n{\n\np[i]=sc.nextInt();\n}\n\nfor(int i=1;i<=101;i++)\n{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}\nSystem.out.println(ans);\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 自動生成されたメソッド・スタブ\nScanner sc=new Scanner(System.in);\nint x=sc.nextInt();\nint n=sc.nextInt();\nint p[]=new int[n];\nint dif,ans=0,ans_dif,che;\nans_dif=x;\nfor(int i=0;i<n;i++)\n{\n\np[i]=sc.nextInt();\n}\n\nfor(int i=1;i<=101;i++)\n{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}\nSystem.out.println(ans);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\nScanner sc=new Scanner(System.in);\nint x=sc.nextInt();\nint n=sc.nextInt();\nint p[]=new int[n];\nint dif,ans=0,ans_dif,che;\nans_dif=x;\nfor(int i=0;i<n;i++)\n{\n\np[i]=sc.nextInt();\n}\n\nfor(int i=1;i<=101;i++)\n{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}\nSystem.out.println(ans);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\nScanner sc=new Scanner(System.in);\nint x=sc.nextInt();\nint n=sc.nextInt();\nint p[]=new int[n];\nint dif,ans=0,ans_dif,che;\nans_dif=x;\nfor(int i=0;i<n;i++)\n{\n\np[i]=sc.nextInt();\n}\n\nfor(int i=1;i<=101;i++)\n{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}\nSystem.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",
"int p[]=new int[n];",
"p",
"new int[n]",
"n",
"int dif",
"dif",
"ans=0",
"ans",
"0",
"ans_dif",
"ans_dif",
"che;",
"che",
"ans_dif=x",
"ans_dif",
"x",
"for(int i=0;i<n;i++)\n{\n\np[i]=sc.nextInt();\n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\np[i]=sc.nextInt();\n}",
"{\n\np[i]=sc.nextInt();\n}",
"p[i]=sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=1;i<=101;i++)\n{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}",
"{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}",
"dif=i-x",
"dif",
"i-x",
"i",
"x",
"if(dif<0)\n\t{dif=-dif;}",
"dif<0",
"dif",
"0",
"{dif=-dif;}",
"dif=-dif",
"dif",
"-dif",
"dif",
"if(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}",
"ans_dif>dif",
"ans_dif",
"dif",
"{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}",
"che=0",
"che",
"0",
"for(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}",
"if(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}",
"i==p[j]",
"i",
"p[j]",
"p",
"j",
"{\n\t\t\t\tche=1;\n\t\t\t}",
"che=1",
"che",
"1",
"if(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}",
"che==0",
"che",
"0",
"{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}",
"ans=i",
"ans",
"i",
"ans_dif=dif",
"ans_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\t// TODO 自動生成されたメソッド・スタブ\nScanner sc=new Scanner(System.in);\nint x=sc.nextInt();\nint n=sc.nextInt();\nint p[]=new int[n];\nint dif,ans=0,ans_dif,che;\nans_dif=x;\nfor(int i=0;i<n;i++)\n{\n\np[i]=sc.nextInt();\n}\n\nfor(int i=1;i<=101;i++)\n{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}\nSystem.out.println(ans);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\nScanner sc=new Scanner(System.in);\nint x=sc.nextInt();\nint n=sc.nextInt();\nint p[]=new int[n];\nint dif,ans=0,ans_dif,che;\nans_dif=x;\nfor(int i=0;i<n;i++)\n{\n\np[i]=sc.nextInt();\n}\n\nfor(int i=1;i<=101;i++)\n{\n\tdif=i-x;\n\tif(dif<0)\n\t{dif=-dif;}\n\tif(ans_dif>dif)\n\t{che=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tif(i==p[j])\n\t\t\t{\n\t\t\t\tche=1;\n\t\t\t}\n\t\t}\n\t\tif(che==0)\n\t\t{\n\t\t\tans=i;\n\t\t\tans_dif=dif;\n\t\t}\n\t}\n}\nSystem.out.println(ans);\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 p[]=new int[n];
int dif,ans=0,ans_dif,che;
ans_dif=x;
for(int i=0;i<n;i++)
{
p[i]=sc.nextInt();
}
for(int i=1;i<=101;i++)
{
dif=i-x;
if(dif<0)
{dif=-dif;}
if(ans_dif>dif)
{che=0;
for(int j=0;j<n;j++)
{
if(i==p[j])
{
che=1;
}
}
if(che==0)
{
ans=i;
ans_dif=dif;
}
}
}
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,
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,
13,
41,
13,
17,
42,
2,
13,
17,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
40,
13,
41,
13,
13,
41,
13,
17,
42,
2,
13,
17,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
40,
13,
14,
2,
4,
18,
13,
13,
4,
18,
13,
13,
30,
14,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
164,
5
],
[
164,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
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
],
[
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
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
73,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
72,
84
],
[
84,
85
],
[
8,
86
],
[
86,
87
],
[
86,
88
],
[
8,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
97,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
96,
108
],
[
108,
109
],
[
8,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
111,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
110,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
110,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
134,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
144,
145
],
[
144,
146
],
[
133,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
133,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
6,
161
],
[
161,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
]
| [
"import java.util.*;\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 res = 0;\n if(n == 0){\n System.out.println(x);\n System.exit(0);\n }\n\n List<Integer> array = new ArrayList<>();\n for(int i = 0; i < n; i++){\n array.add(sc.nextInt());\n }\n\n int A = x;\n int resA = 0;\n while(A > 0){\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }\n\n int B = x;\n int resB = 101;\n while(B <= 100){\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }\n\n if(Math.abs(resA) == Math.abs(resB)){\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }else if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n System.out.println(res);\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 res = 0;\n if(n == 0){\n System.out.println(x);\n System.exit(0);\n }\n\n List<Integer> array = new ArrayList<>();\n for(int i = 0; i < n; i++){\n array.add(sc.nextInt());\n }\n\n int A = x;\n int resA = 0;\n while(A > 0){\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }\n\n int B = x;\n int resB = 101;\n while(B <= 100){\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }\n\n if(Math.abs(resA) == Math.abs(resB)){\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }else if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n System.out.println(res);\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 System.out.println(x);\n System.exit(0);\n }\n\n List<Integer> array = new ArrayList<>();\n for(int i = 0; i < n; i++){\n array.add(sc.nextInt());\n }\n\n int A = x;\n int resA = 0;\n while(A > 0){\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }\n\n int B = x;\n int resB = 101;\n while(B <= 100){\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }\n\n if(Math.abs(resA) == Math.abs(resB)){\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }else if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n System.out.println(res);\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 System.out.println(x);\n System.exit(0);\n }\n\n List<Integer> array = new ArrayList<>();\n for(int i = 0; i < n; i++){\n array.add(sc.nextInt());\n }\n\n int A = x;\n int resA = 0;\n while(A > 0){\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }\n\n int B = x;\n int resB = 101;\n while(B <= 100){\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }\n\n if(Math.abs(resA) == Math.abs(resB)){\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }else if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n System.out.println(res);\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 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",
"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",
"int A = x;",
"A",
"x",
"int resA = 0;",
"resA",
"0",
"while(A > 0){\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }",
"A > 0",
"A",
"0",
"{\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }",
"if(!array.contains(A)){\n resA = A;\n break;\n }",
"!array.contains(A)",
"array.contains(A)",
"array.contains",
"array",
"A",
"{\n resA = A;\n break;\n }",
"resA = A",
"resA",
"A",
"break;",
"A--",
"A",
"int B = x;",
"B",
"x",
"int resB = 101;",
"resB",
"101",
"while(B <= 100){\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }",
"B <= 100",
"B",
"100",
"{\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }",
"if(!array.contains(B)){\n resB = B;\n break;\n }",
"!array.contains(B)",
"array.contains(B)",
"array.contains",
"array",
"B",
"{\n resB = B;\n break;\n }",
"resB = B",
"resB",
"B",
"break;",
"B++",
"B",
"if(Math.abs(resA) == Math.abs(resB)){\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }else if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }",
"Math.abs(resA) == Math.abs(resB)",
"Math.abs(resA)",
"Math.abs",
"Math",
"resA",
"Math.abs(resB)",
"Math.abs",
"Math",
"resB",
"{\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }",
"if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }",
"resA > resB",
"resA",
"resB",
"{\n res = resB;\n }",
"res = resB",
"res",
"resB",
"{\n res = resA;\n }",
"res = resA",
"res",
"resA",
"if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }",
"Math.abs(x - resA) > Math.abs(x - resB)",
"Math.abs(x - resA)",
"Math.abs",
"Math",
"x - resA",
"x",
"resA",
"Math.abs(x - resB)",
"Math.abs",
"Math",
"x - resB",
"x",
"resB",
"{\n res = resB;\n }",
"res = resB",
"res",
"resB",
"{\n res = resA;\n }",
"res = resA",
"res",
"resA",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"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 res = 0;\n if(n == 0){\n System.out.println(x);\n System.exit(0);\n }\n\n List<Integer> array = new ArrayList<>();\n for(int i = 0; i < n; i++){\n array.add(sc.nextInt());\n }\n\n int A = x;\n int resA = 0;\n while(A > 0){\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }\n\n int B = x;\n int resB = 101;\n while(B <= 100){\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }\n\n if(Math.abs(resA) == Math.abs(resB)){\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }else if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n System.out.println(res);\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 res = 0;\n if(n == 0){\n System.out.println(x);\n System.exit(0);\n }\n\n List<Integer> array = new ArrayList<>();\n for(int i = 0; i < n; i++){\n array.add(sc.nextInt());\n }\n\n int A = x;\n int resA = 0;\n while(A > 0){\n if(!array.contains(A)){\n resA = A;\n break;\n }\n A--;\n }\n\n int B = x;\n int resB = 101;\n while(B <= 100){\n if(!array.contains(B)){\n resB = B;\n break;\n }\n B++;\n }\n\n if(Math.abs(resA) == Math.abs(resB)){\n if(resA > resB){\n res = resB;\n }else{\n res = resA;\n }\n }else if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n System.out.println(res);\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){
System.out.println(x);
System.exit(0);
}
List<Integer> array = new ArrayList<>();
for(int i = 0; i < n; i++){
array.add(sc.nextInt());
}
int A = x;
int resA = 0;
while(A > 0){
if(!array.contains(A)){
resA = A;
break;
}
A--;
}
int B = x;
int resB = 101;
while(B <= 100){
if(!array.contains(B)){
resB = B;
break;
}
B++;
}
if(Math.abs(resA) == Math.abs(resB)){
if(resA > resB){
res = resB;
}else{
res = resA;
}
}else if(Math.abs(x - resA) > Math.abs(x - resB)){
res = resB;
}else{
res = resA;
}
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,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
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,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
0,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
17,
0,
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
],
[
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
],
[
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
],
[
57,
58
],
[
58,
59
],
[
54,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
67,
69
],
[
8,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
83,
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
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
89,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
8,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
6,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
]
| [
"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[102];\n\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<=101; i++) {\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }\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[102];\n\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<=101; i++) {\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\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\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[102];\n\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<=101; i++) {\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\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\n if(n == 0) {\n System.out.println(x);\n System.exit(0);\n }\n\n int[] p = new int[102];\n\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<=101; i++) {\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\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",
"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[102];",
"p",
"new int[102]",
"102",
"for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[sc.nextInt()] = 1;\n }",
"{\n p[sc.nextInt()] = 1;\n }",
"p[sc.nextInt()] = 1",
"p[sc.nextInt()]",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"1",
"int diff = 0;",
"diff",
"0",
"int comp = 0;",
"comp",
"0",
"int ans = 0;",
"ans",
"0",
"for(int i=0; i<=101; i++) {\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }\n\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }\n\n }",
"{\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }\n\n }",
"if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }",
"p[i] != 1",
"p[i]",
"p",
"i",
"1",
"{\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }",
"diff = Math.abs(x-i)",
"diff",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"if(i == 0) comp = diff;",
"i == 0",
"i",
"0",
"comp = diff",
"comp",
"diff",
"if(comp > diff) {\n comp = diff;\n ans = i;\n }",
"comp > diff",
"comp",
"diff",
"{\n comp = diff;\n ans = i;\n }",
"comp = diff",
"comp",
"diff",
"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 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[102];\n\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<=101; i++) {\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }\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[102];\n\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n\n int diff = 0;\n int comp = 0;\n int ans = 0;\n for(int i=0; i<=101; i++) {\n if(p[i] != 1) {\n diff = Math.abs(x-i);\n if(i == 0) comp = diff;\n if(comp > diff) {\n comp = diff;\n ans = i;\n }\n }\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[102];
for(int i=0; i<n; i++) {
p[sc.nextInt()] = 1;
}
int diff = 0;
int comp = 0;
int ans = 0;
for(int i=0; i<=101; i++) {
if(p[i] != 1) {
diff = Math.abs(x-i);
if(i == 0) comp = diff;
if(comp > diff) {
comp = diff;
ans = 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,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
13,
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,
40,
17,
41,
13,
17,
41,
13,
17,
14,
2,
13,
17,
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
],
[
140,
5
],
[
140,
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
],
[
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
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
68,
74
],
[
74,
75
],
[
8,
76
],
[
76,
77
],
[
76,
78
],
[
8,
79
],
[
79,
80
],
[
79,
81
],
[
8,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
8,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
102,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
115,
116
],
[
115,
117
],
[
111,
118
],
[
110,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
128,
129
],
[
128,
130
],
[
8,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
6,
137
],
[
137,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n int[] d = new int[102];\n for(int i=0; i<=101; i++){\n d[i]=i;\n }\n \n for(int i = 0; i<n;i++) {\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }\n \n \n \n \n int min = 99999;\n int ans = 0;\n if(n==0) ans = x;\n for(int i=0; i<=101; i++){\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }\n \n \n System.out.print(ans);\n \n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n int[] d = new int[102];\n for(int i=0; i<=101; i++){\n d[i]=i;\n }\n \n for(int i = 0; i<n;i++) {\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }\n \n \n \n \n int min = 99999;\n int ans = 0;\n if(n==0) ans = x;\n for(int i=0; i<=101; i++){\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }\n \n \n System.out.print(ans);\n \n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n int[] d = new int[102];\n for(int i=0; i<=101; i++){\n d[i]=i;\n }\n \n for(int i = 0; i<n;i++) {\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }\n \n \n \n \n int min = 99999;\n int ans = 0;\n if(n==0) ans = x;\n for(int i=0; i<=101; i++){\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }\n \n \n System.out.print(ans);\n \n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n int[] d = new int[102];\n for(int i=0; i<=101; i++){\n d[i]=i;\n }\n \n for(int i = 0; i<n;i++) {\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }\n \n \n \n \n int min = 99999;\n int ans = 0;\n if(n==0) ans = x;\n for(int i=0; i<=101; i++){\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }\n \n \n System.out.print(ans);\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[] p = new int[n];",
"p",
"new int[n]",
"n",
"int[] d = new int[102];",
"d",
"new int[102]",
"102",
"for(int i=0; i<=101; i++){\n d[i]=i;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n d[i]=i;\n }",
"{\n d[i]=i;\n }",
"d[i]=i",
"d[i]",
"d",
"i",
"i",
"for(int i = 0; i<n;i++) {\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }",
"{\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"d[p[i]]=-1",
"d[p[i]]",
"d",
"p[i]",
"p",
"i",
"-1",
"1",
"int min = 99999;",
"min",
"99999",
"int ans = 0;",
"ans",
"0",
"if(n==0) ans = x;",
"n==0",
"n",
"0",
"ans = x",
"ans",
"x",
"for(int i=0; i<=101; i++){\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }",
"{\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }",
"if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }",
"d[i] != -1",
"d[i]",
"d",
"i",
"-1",
"1",
"{\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }",
"if(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}",
"Math.abs(i-x) < min",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"min",
"{\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}",
"ans = i",
"ans",
"i",
"min = Math.abs(i-x)",
"min",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"System.out.print(ans)",
"System.out.print",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n int[] d = new int[102];\n for(int i=0; i<=101; i++){\n d[i]=i;\n }\n \n for(int i = 0; i<n;i++) {\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }\n \n \n \n \n int min = 99999;\n int ans = 0;\n if(n==0) ans = x;\n for(int i=0; i<=101; i++){\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }\n \n \n System.out.print(ans);\n \n\t}\n}",
"public class Main {\n\t\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int[] p = new int[n];\n int[] d = new int[102];\n for(int i=0; i<=101; i++){\n d[i]=i;\n }\n \n for(int i = 0; i<n;i++) {\n \tp[i] = sc.nextInt();\n \td[p[i]]=-1;\n }\n \n \n \n \n int min = 99999;\n int ans = 0;\n if(n==0) ans = x;\n for(int i=0; i<=101; i++){\n if(d[i] != -1) {\n \tif(Math.abs(i-x) < min ) {\n \t\tans = i;\n \t\tmin = Math.abs(i-x);\n \t}\n }\n \n }\n \n \n System.out.print(ans);\n \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[] p = new int[n];
int[] d = new int[102];
for(int i=0; i<=101; i++){
d[i]=i;
}
for(int i = 0; i<n;i++) {
p[i] = sc.nextInt();
d[p[i]]=-1;
}
int min = 99999;
int ans = 0;
if(n==0) ans = x;
for(int i=0; i<=101; i++){
if(d[i] != -1) {
if(Math.abs(i-x) < min ) {
ans = i;
min = Math.abs(i-x);
}
}
}
System.out.print(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,
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,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
18,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
29,
14,
40,
18,
13,
2,
13,
13,
30,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
29,
14,
2,
13,
17,
30,
0,
13,
17,
30,
0,
13,
40,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
137,
5
],
[
137,
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
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
60,
70
],
[
70,
71
],
[
71,
72
],
[
60,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
75,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
82,
94
],
[
74,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
102,
114
],
[
8,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
8,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
6,
134
],
[
134,
135
],
[
0,
136
],
[
136,
137
],
[
136,
138
]
]
| [
"import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n boolean[] q = new boolean[102];\n for(int i=0; i<N; i++){\n p[i]=sc.nextInt();\n q[p[i]] = true;\n }\n\n int res=X;\n for(int i=0; i<X+1; i++){\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }\n if(X>50){\n res=101;\n }else{\n res=-1;\n }\n System.out.println(res);\n \n \n }\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 int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n boolean[] q = new boolean[102];\n for(int i=0; i<N; i++){\n p[i]=sc.nextInt();\n q[p[i]] = true;\n }\n\n int res=X;\n for(int i=0; i<X+1; i++){\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }\n if(X>50){\n res=101;\n }else{\n res=-1;\n }\n System.out.println(res);\n \n \n }\n }",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n boolean[] q = new boolean[102];\n for(int i=0; i<N; i++){\n p[i]=sc.nextInt();\n q[p[i]] = true;\n }\n\n int res=X;\n for(int i=0; i<X+1; i++){\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }\n if(X>50){\n res=101;\n }else{\n res=-1;\n }\n System.out.println(res);\n \n \n }",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n boolean[] q = new boolean[102];\n for(int i=0; i<N; i++){\n p[i]=sc.nextInt();\n q[p[i]] = true;\n }\n\n int res=X;\n for(int i=0; i<X+1; i++){\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }\n if(X>50){\n res=101;\n }else{\n res=-1;\n }\n System.out.println(res);\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",
"boolean[] q = new boolean[102];",
"q",
"new boolean[102]",
"102",
"for(int i=0; i<N; i++){\n p[i]=sc.nextInt();\n q[p[i]] = true;\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]] = true;\n }",
"{\n p[i]=sc.nextInt();\n q[p[i]] = true;\n }",
"p[i]=sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q[p[i]] = true",
"q[p[i]]",
"q",
"p[i]",
"p",
"i",
"true",
"int res=X;",
"res",
"X",
"for(int i=0; i<X+1; i++){\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<X+1",
"i",
"X+1",
"X",
"1",
"i++",
"i++",
"i",
"{\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }",
"{\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }",
"if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }",
"!q[X-i]",
"q[X-i]",
"q",
"X-i",
"X",
"i",
"{\n res=X-i;\n System.out.println(res);\n return;\n }",
"res=X-i",
"res",
"X-i",
"X",
"i",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"return;",
"if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }",
"!q[X+i]",
"q[X+i]",
"q",
"X+i",
"X",
"i",
"{\n res=X+i;\n System.out.println(res);\n return;\n }",
"res=X+i",
"res",
"X+i",
"X",
"i",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"return;",
"if(X>50){\n res=101;\n }else{\n res=-1;\n }",
"X>50",
"X",
"50",
"{\n res=101;\n }",
"res=101",
"res",
"101",
"{\n res=-1;\n }",
"res=-1",
"res",
"-1",
"1",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n boolean[] q = new boolean[102];\n for(int i=0; i<N; i++){\n p[i]=sc.nextInt();\n q[p[i]] = true;\n }\n\n int res=X;\n for(int i=0; i<X+1; i++){\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }\n if(X>50){\n res=101;\n }else{\n res=-1;\n }\n System.out.println(res);\n \n \n }\n }",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n int X = sc.nextInt();\n int N = sc.nextInt();\n int[] p = new int[N];\n boolean[] q = new boolean[102];\n for(int i=0; i<N; i++){\n p[i]=sc.nextInt();\n q[p[i]] = true;\n }\n\n int res=X;\n for(int i=0; i<X+1; i++){\n if(!q[X-i]){\n res=X-i;\n System.out.println(res);\n return;\n }\n if(!q[X+i]){\n res=X+i;\n System.out.println(res);\n return;\n }\n }\n if(X>50){\n res=101;\n }else{\n res=-1;\n }\n System.out.println(res);\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];
boolean[] q = new boolean[102];
for(int i=0; i<N; i++){
p[i]=sc.nextInt();
q[p[i]] = true;
}
int res=X;
for(int i=0; i<X+1; i++){
if(!q[X-i]){
res=X-i;
System.out.println(res);
return;
}
if(!q[X+i]){
res=X+i;
System.out.println(res);
return;
}
}
if(X>50){
res=101;
}else{
res=-1;
}
System.out.println(res);
}
} |
[
7,
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,
13,
18,
13,
17,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
20,
17,
0,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
4,
18,
13,
18,
13,
13,
17,
41,
13,
17,
41,
13,
40,
17,
42,
17,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
13,
14,
2,
18,
13,
13,
17,
30,
0,
13,
13,
3,
14,
2,
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
],
[
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
],
[
19,
20
],
[
20,
21
],
[
17,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
36,
37
],
[
36,
38
],
[
11,
39
],
[
39,
40
],
[
39,
41
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
45,
50
],
[
11,
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
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
64,
73
],
[
11,
74
],
[
74,
75
],
[
74,
76
],
[
11,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
11,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
83,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
83,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
94,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
83,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
83,
116
],
[
116,
117
],
[
11,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
9,
124
],
[
124,
125
],
[
0,
126
],
[
126,
127
],
[
126,
128
]
]
| [
"\nimport java.util.*;\nimport java.io.*;\n\npublic class Main{\n\tpublic static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] cmd=br.readLine().split(\" \");\n\t\tint x=Integer.valueOf(cmd[0]);\n\t\tint n=Integer.valueOf(cmd[1]);\n\t\tint[] arr=new int[200];\n\t\tcmd=br.readLine().split(\" \");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}\n\t\tint len=0;\n\t\tint ans=-1;\n\t\twhile(true)\n\t\t{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n\tpublic static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] cmd=br.readLine().split(\" \");\n\t\tint x=Integer.valueOf(cmd[0]);\n\t\tint n=Integer.valueOf(cmd[1]);\n\t\tint[] arr=new int[200];\n\t\tcmd=br.readLine().split(\" \");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}\n\t\tint len=0;\n\t\tint ans=-1;\n\t\twhile(true)\n\t\t{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] cmd=br.readLine().split(\" \");\n\t\tint x=Integer.valueOf(cmd[0]);\n\t\tint n=Integer.valueOf(cmd[1]);\n\t\tint[] arr=new int[200];\n\t\tcmd=br.readLine().split(\" \");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}\n\t\tint len=0;\n\t\tint ans=-1;\n\t\twhile(true)\n\t\t{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] cmd=br.readLine().split(\" \");\n\t\tint x=Integer.valueOf(cmd[0]);\n\t\tint n=Integer.valueOf(cmd[1]);\n\t\tint[] arr=new int[200];\n\t\tcmd=br.readLine().split(\" \");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}\n\t\tint len=0;\n\t\tint ans=-1;\n\t\twhile(true)\n\t\t{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String[] cmd=br.readLine().split(\" \");",
"cmd",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int x=Integer.valueOf(cmd[0]);",
"x",
"Integer.valueOf(cmd[0])",
"Integer.valueOf",
"Integer",
"cmd[0]",
"cmd",
"0",
"int n=Integer.valueOf(cmd[1]);",
"n",
"Integer.valueOf(cmd[1])",
"Integer.valueOf",
"Integer",
"cmd[1]",
"cmd",
"1",
"int[] arr=new int[200];",
"arr",
"new int[200]",
"200",
"cmd=br.readLine().split(\" \")",
"cmd",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i=0;i<n;i++)\n\t\t{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}",
"{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}",
"arr[Integer.valueOf(cmd[i])]=1",
"arr[Integer.valueOf(cmd[i])]",
"arr",
"Integer.valueOf(cmd[i])",
"Integer.valueOf",
"Integer",
"cmd[i]",
"cmd",
"i",
"1",
"int len=0;",
"len",
"0",
"int ans=-1;",
"ans",
"-1",
"1",
"while(true)\n\t\t{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}",
"true",
"{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}",
"int a=x-len;",
"a",
"x-len",
"x",
"len",
"int b=x+len;",
"b",
"x+len",
"x",
"len",
"if(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}",
"arr[a]==0",
"arr[a]",
"arr",
"a",
"0",
"{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}",
"ans=a",
"ans",
"a",
"break;",
"if(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}",
"arr[b]==0",
"arr[b]",
"arr",
"b",
"0",
"{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}",
"ans=b",
"ans",
"b",
"break;",
"len++",
"len",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] cmd=br.readLine().split(\" \");\n\t\tint x=Integer.valueOf(cmd[0]);\n\t\tint n=Integer.valueOf(cmd[1]);\n\t\tint[] arr=new int[200];\n\t\tcmd=br.readLine().split(\" \");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}\n\t\tint len=0;\n\t\tint ans=-1;\n\t\twhile(true)\n\t\t{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"public class Main{\n\tpublic static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] cmd=br.readLine().split(\" \");\n\t\tint x=Integer.valueOf(cmd[0]);\n\t\tint n=Integer.valueOf(cmd[1]);\n\t\tint[] arr=new int[200];\n\t\tcmd=br.readLine().split(\" \");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tarr[Integer.valueOf(cmd[i])]=1;\n\t\t}\n\t\tint len=0;\n\t\tint ans=-1;\n\t\twhile(true)\n\t\t{\n\t\t\tint a=x-len;\n\t\t\tint b=x+len;\n\t\t\tif(arr[a]==0)\n\t\t\t{\n\t\t\t\tans=a;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(arr[b]==0)\n\t\t\t{\n\t\t\t\tans=b;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main"
]
|
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] cmd=br.readLine().split(" ");
int x=Integer.valueOf(cmd[0]);
int n=Integer.valueOf(cmd[1]);
int[] arr=new int[200];
cmd=br.readLine().split(" ");
for(int i=0;i<n;i++)
{
arr[Integer.valueOf(cmd[i])]=1;
}
int len=0;
int ans=-1;
while(true)
{
int a=x-len;
int b=x+len;
if(arr[a]==0)
{
ans=a;
break;
}
if(arr[b]==0)
{
ans=b;
break;
}
len++;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
20,
41,
13,
18,
13,
13,
41,
13,
17,
28,
13,
13,
30,
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,
12,
13,
30,
41,
13,
4,
18,
13,
13,
41,
13,
20,
42,
2,
2,
13,
17,
17,
30,
4,
18,
13,
17,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
0,
13,
17,
30,
30,
42,
2,
2,
13,
13,
17,
30,
4,
18,
13,
13,
0,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
2,
13,
17,
0,
13,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
9,
41,
13,
13,
41,
13,
2,
13,
13,
4,
18,
13,
13,
14,
2,
13,
13,
30,
9,
4,
18,
13,
2,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
14,
2,
13,
17,
29,
17,
0,
13,
4,
13,
13,
2,
13,
17,
14,
2,
2,
13,
17,
17,
29,
2,
13,
13,
29,
2,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
20,
2,
13,
17,
41,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
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,
29,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
6,
13,
12,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
29,
2,
18,
13,
13,
18,
13,
13,
29,
2,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
13,
6,
13,
41,
13,
41,
13,
41,
13,
20,
6,
13,
41,
13,
2,
17,
17,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
13,
0,
13,
0,
13,
17,
12,
13,
30,
0,
13,
20,
0,
13,
20,
13,
0,
13,
0,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
17,
41,
13,
17,
41,
13,
42,
2,
0,
13,
4,
13,
40,
17,
30,
14,
2,
13,
17,
3,
0,
18,
13,
40,
13,
13,
29,
20,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
2,
13,
17,
30,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
13,
17,
0,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
0,
13,
4,
18,
13,
13,
0,
13,
17,
13,
14,
2,
13,
40,
17,
0,
18,
13,
17,
40,
17,
12,
13,
30,
14,
2,
13,
13,
4,
13,
29,
18,
13,
40,
13,
12,
13,
30,
14,
2,
13,
17,
29,
4,
18,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
818,
11
],
[
818,
12
],
[
12,
13
],
[
12,
14
],
[
818,
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
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
34,
40
],
[
40,
41
],
[
40,
42
],
[
34,
43
],
[
43,
44
],
[
44,
45
],
[
34,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
48,
52
],
[
17,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
71,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
17,
80
],
[
80,
81
],
[
80,
82
],
[
17,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
17,
88
],
[
88,
89
],
[
88,
90
],
[
17,
91
],
[
91,
92
],
[
91,
93
],
[
91,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
97,
104
],
[
96,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
114,
116
],
[
17,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
15,
123
],
[
123,
124
],
[
818,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
127,
134
],
[
134,
135
],
[
134,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
143,
148
],
[
148,
149
],
[
148,
150
],
[
127,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
151,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
151,
163
],
[
164,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
165,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
172,
175
],
[
171,
176
],
[
176,
177
],
[
176,
178
],
[
127,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
183,
186
],
[
127,
187
],
[
187,
188
],
[
125,
189
],
[
189,
190
],
[
818,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
193,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
204,
206
],
[
201,
207
],
[
207,
208
],
[
207,
209
],
[
193,
210
],
[
210,
211
],
[
191,
212
],
[
212,
213
],
[
818,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
216,
223
],
[
223,
224
],
[
223,
225
],
[
216,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
226,
231
],
[
231,
232
],
[
231,
233
],
[
226,
234
],
[
234,
235
],
[
235,
236
],
[
226,
237
],
[
238,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
239,
245
],
[
238,
246
],
[
246,
247
],
[
246,
248
],
[
238,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
251,
253
],
[
238,
254
],
[
254,
255
],
[
255,
256
],
[
254,
257
],
[
238,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
258,
262
],
[
262,
263
],
[
238,
264
],
[
264,
265
],
[
265,
266
],
[
264,
267
],
[
267,
268
],
[
267,
269
],
[
216,
270
],
[
270,
271
],
[
214,
272
],
[
272,
273
],
[
818,
274
],
[
274,
275
],
[
274,
276
],
[
276,
277
],
[
277,
278
],
[
276,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
279,
283
],
[
283,
284
],
[
276,
285
],
[
285,
286
],
[
285,
287
],
[
287,
288
],
[
287,
289
],
[
287,
290
],
[
290,
291
],
[
290,
292
],
[
276,
293
],
[
293,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
293,
299
],
[
299,
300
],
[
300,
301
],
[
300,
302
],
[
293,
303
],
[
303,
304
],
[
305,
305
],
[
305,
306
],
[
305,
307
],
[
305,
308
],
[
274,
309
],
[
309,
310
],
[
274,
311
],
[
311,
312
],
[
818,
313
],
[
313,
314
],
[
313,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
315,
319
],
[
319,
320
],
[
319,
321
],
[
315,
322
],
[
322,
323
],
[
322,
324
],
[
325,
326
],
[
325,
327
],
[
315,
328
],
[
328,
329
],
[
328,
330
],
[
330,
331
],
[
331,
332
],
[
330,
333
],
[
315,
334
],
[
334,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
334,
339
],
[
339,
340
],
[
339,
341
],
[
334,
342
],
[
342,
343
],
[
343,
344
],
[
334,
345
],
[
346,
346
],
[
346,
347
],
[
347,
348
],
[
348,
349
],
[
349,
350
],
[
349,
351
],
[
348,
352
],
[
347,
353
],
[
353,
354
],
[
354,
355
],
[
355,
356
],
[
356,
357
],
[
356,
358
],
[
358,
359
],
[
358,
360
],
[
354,
361
],
[
361,
362
],
[
361,
363
],
[
354,
364
],
[
364,
365
],
[
365,
366
],
[
365,
367
],
[
354,
368
],
[
369,
369
],
[
369,
370
],
[
370,
371
],
[
371,
372
],
[
371,
373
],
[
370,
374
],
[
315,
375
],
[
375,
376
],
[
376,
377
],
[
377,
378
],
[
377,
379
],
[
375,
380
],
[
380,
381
],
[
380,
382
],
[
375,
383
],
[
383,
384
],
[
384,
385
],
[
375,
386
],
[
387,
387
],
[
387,
388
],
[
388,
389
],
[
389,
390
],
[
390,
391
],
[
390,
392
],
[
389,
393
],
[
388,
394
],
[
394,
395
],
[
395,
396
],
[
394,
397
],
[
315,
398
],
[
398,
399
],
[
818,
400
],
[
400,
401
],
[
400,
402
],
[
402,
403
],
[
403,
404
],
[
404,
405
],
[
404,
406
],
[
403,
407
],
[
407,
408
],
[
402,
409
],
[
409,
410
],
[
410,
411
],
[
410,
412
],
[
410,
413
],
[
413,
414
],
[
413,
415
],
[
400,
416
],
[
416,
417
],
[
400,
418
],
[
418,
419
],
[
818,
420
],
[
420,
421
],
[
420,
422
],
[
422,
423
],
[
420,
424
],
[
424,
425
],
[
420,
426
],
[
426,
427
],
[
426,
428
],
[
428,
429
],
[
429,
430
],
[
430,
431
],
[
430,
432
],
[
429,
433
],
[
428,
434
],
[
434,
435
],
[
435,
436
],
[
435,
437
],
[
434,
438
],
[
426,
439
],
[
439,
440
],
[
426,
441
],
[
441,
442
],
[
818,
443
],
[
443,
444
],
[
443,
445
],
[
445,
446
],
[
445,
447
],
[
447,
448
],
[
448,
449
],
[
449,
450
],
[
450,
451
],
[
450,
452
],
[
449,
453
],
[
453,
454
],
[
453,
455
],
[
448,
456
],
[
456,
457
],
[
457,
458
],
[
458,
459
],
[
459,
460
],
[
459,
461
],
[
458,
462
],
[
462,
463
],
[
462,
464
],
[
447,
465
],
[
465,
466
],
[
466,
467
],
[
467,
468
],
[
467,
469
],
[
466,
470
],
[
470,
471
],
[
470,
472
],
[
445,
473
],
[
473,
474
],
[
445,
475
],
[
475,
476
],
[
443,
477
],
[
818,
478
],
[
478,
479
],
[
478,
480
],
[
480,
481
],
[
478,
482
],
[
482,
483
],
[
478,
484
],
[
484,
485
],
[
484,
486
],
[
818,
487
],
[
487,
488
],
[
487,
489
],
[
489,
490
],
[
489,
491
],
[
491,
492
],
[
491,
493
],
[
487,
494
],
[
494,
495
],
[
487,
496
],
[
496,
497
],
[
487,
498
],
[
498,
499
],
[
487,
500
],
[
500,
501
],
[
487,
502
],
[
502,
503
],
[
502,
504
],
[
504,
505
],
[
505,
506
],
[
505,
507
],
[
504,
508
],
[
508,
509
],
[
508,
510
],
[
504,
512
],
[
512,
513
],
[
512,
514
],
[
514,
515
],
[
514,
516
],
[
487,
517
],
[
517,
518
],
[
517,
519
],
[
519,
520
],
[
520,
521
],
[
520,
522
],
[
519,
523
],
[
523,
524
],
[
523,
525
],
[
519,
527
],
[
527,
528
],
[
527,
529
],
[
529,
530
],
[
529,
531
],
[
517,
532
],
[
532,
533
],
[
487,
534
],
[
534,
535
],
[
534,
536
],
[
536,
537
],
[
537,
538
],
[
537,
539
],
[
536,
541
],
[
541,
542
],
[
541,
543
],
[
536,
544
],
[
544,
545
],
[
536,
546
],
[
546,
547
],
[
547,
548
],
[
548,
549
],
[
548,
550
],
[
550,
551
],
[
547,
552
],
[
552,
553
],
[
546,
554
],
[
554,
555
],
[
555,
556
],
[
556,
557
],
[
556,
558
],
[
555,
559
],
[
554,
560
],
[
560,
561
],
[
561,
562
],
[
561,
563
],
[
563,
564
],
[
560,
565
],
[
536,
566
],
[
566,
567
],
[
487,
568
],
[
568,
569
],
[
568,
570
],
[
570,
571
],
[
571,
572
],
[
571,
573
],
[
570,
574
],
[
574,
575
],
[
574,
576
],
[
576,
577
],
[
570,
578
],
[
578,
579
],
[
579,
580
],
[
579,
581
],
[
578,
582
],
[
582,
583
],
[
582,
584
],
[
584,
585
],
[
570,
586
],
[
586,
587
],
[
586,
588
],
[
588,
589
],
[
588,
590
],
[
570,
591
],
[
591,
592
],
[
591,
593
],
[
593,
594
],
[
593,
595
],
[
595,
596
],
[
570,
597
],
[
597,
598
],
[
598,
599
],
[
599,
600
],
[
600,
601
],
[
600,
602
],
[
602,
603
],
[
599,
604
],
[
598,
605
],
[
605,
606
],
[
605,
607
],
[
597,
608
],
[
608,
609
],
[
609,
610
],
[
609,
611
],
[
611,
612
],
[
612,
613
],
[
613,
614
],
[
613,
615
],
[
612,
616
],
[
611,
617
],
[
570,
618
],
[
618,
619
],
[
618,
620
],
[
620,
621
],
[
621,
622
],
[
570,
623
],
[
623,
624
],
[
487,
625
],
[
625,
626
],
[
625,
627
],
[
627,
628
],
[
628,
629
],
[
628,
630
],
[
627,
631
],
[
631,
632
],
[
631,
633
],
[
633,
634
],
[
627,
635
],
[
635,
636
],
[
636,
637
],
[
636,
638
],
[
635,
639
],
[
639,
640
],
[
639,
641
],
[
641,
642
],
[
627,
643
],
[
643,
644
],
[
643,
645
],
[
645,
646
],
[
645,
647
],
[
627,
648
],
[
648,
649
],
[
648,
650
],
[
650,
651
],
[
650,
652
],
[
652,
653
],
[
627,
654
],
[
654,
655
],
[
655,
656
],
[
656,
657
],
[
657,
658
],
[
657,
659
],
[
659,
660
],
[
656,
661
],
[
655,
662
],
[
662,
663
],
[
662,
664
],
[
654,
665
],
[
665,
666
],
[
666,
667
],
[
666,
668
],
[
668,
669
],
[
669,
670
],
[
670,
671
],
[
670,
672
],
[
669,
673
],
[
668,
674
],
[
627,
675
],
[
675,
676
],
[
675,
677
],
[
677,
678
],
[
678,
679
],
[
627,
680
],
[
680,
681
],
[
487,
682
],
[
682,
683
],
[
682,
684
],
[
684,
685
],
[
685,
686
],
[
685,
687
],
[
684,
688
],
[
688,
689
],
[
688,
690
],
[
684,
691
],
[
691,
692
],
[
691,
693
],
[
693,
694
],
[
684,
695
],
[
695,
696
],
[
696,
697
],
[
696,
698
],
[
695,
699
],
[
699,
700
],
[
699,
701
],
[
701,
702
],
[
684,
703
],
[
703,
704
],
[
703,
705
],
[
705,
706
],
[
705,
707
],
[
684,
708
],
[
708,
709
],
[
708,
710
],
[
710,
711
],
[
710,
712
],
[
712,
713
],
[
684,
714
],
[
714,
715
],
[
715,
716
],
[
716,
717
],
[
717,
718
],
[
717,
719
],
[
719,
720
],
[
716,
721
],
[
715,
722
],
[
722,
723
],
[
722,
724
],
[
714,
725
],
[
725,
726
],
[
726,
727
],
[
726,
728
],
[
728,
729
],
[
729,
730
],
[
730,
731
],
[
730,
732
],
[
729,
733
],
[
728,
734
],
[
684,
735
],
[
735,
736
],
[
736,
737
],
[
736,
738
],
[
735,
739
],
[
739,
740
],
[
740,
741
],
[
741,
742
],
[
742,
743
],
[
743,
744
],
[
743,
745
],
[
745,
746
],
[
742,
747
],
[
741,
748
],
[
748,
749
],
[
748,
750
],
[
740,
751
],
[
751,
752
],
[
752,
753
],
[
752,
754
],
[
754,
755
],
[
755,
756
],
[
755,
757
],
[
754,
758
],
[
758,
759
],
[
758,
760
],
[
684,
761
],
[
761,
762
],
[
761,
763
],
[
763,
764
],
[
764,
765
],
[
684,
766
],
[
766,
767
],
[
487,
768
],
[
768,
769
],
[
768,
770
],
[
770,
771
],
[
771,
772
],
[
771,
773
],
[
773,
774
],
[
774,
775
],
[
773,
776
],
[
773,
777
],
[
777,
778
],
[
777,
779
],
[
773,
780
],
[
770,
781
],
[
781,
782
],
[
782,
783
],
[
782,
784
],
[
784,
785
],
[
781,
786
],
[
786,
787
],
[
787,
788
],
[
787,
789
],
[
786,
790
],
[
790,
791
],
[
487,
792
],
[
792,
793
],
[
792,
794
],
[
794,
795
],
[
795,
796
],
[
796,
797
],
[
796,
798
],
[
795,
799
],
[
799,
800
],
[
794,
801
],
[
801,
802
],
[
802,
803
],
[
802,
804
],
[
804,
805
],
[
487,
806
],
[
806,
807
],
[
806,
808
],
[
808,
809
],
[
809,
810
],
[
810,
811
],
[
810,
812
],
[
809,
813
],
[
808,
814
],
[
814,
815
],
[
815,
816
],
[
0,
817
],
[
817,
818
],
[
817,
819
]
]
| [
"import java.util.*;\nimport java.io.*;\nimport java.math.*;\npublic class Main{\n\tpublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\tpublic static void main(String sp[])throws IOException{\n\t\tScanner sc = new Scanner(System.in);\n\t\t//FastReader sc = new FastReader();\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tHashMap<Integer,Integer> hm = new HashMap<>();\n\t\tfor(int i=-1;i<=101;i++){\n\t\t\thm.put(i,0);\n\t\t}\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}\n\t\tArrayList<Integer> al = new ArrayList<>(hm.keySet());\n\t\tint diff = Integer.MAX_VALUE;\n\t\tint min = 0;\n\t\tfor(int val:al){\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> primefactor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}\n\t\n\tpublic static long sum(long val){\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> factor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\tfor(int i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}\n\t\n\tpublic static int power(int x, int y) \n\t{ \n\t\tint temp; \n\t\tif( y == 0) \n\t\t\treturn 1; \n\t\ttemp = power(x, y/2); \n\t\tif (y%2 == 0) \n\t\t\treturn temp*temp; \n\t\telse\n\t\t\treturn x*temp*temp; \n\t} \n\t\n\tpublic static ArrayList<Integer> comp(){\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}\n\t\n\tpublic static class pair{\n\t\tint x;\n\t\tint y;\n\t\tpair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t}\n\t\n\tpublic static class comp implements Comparator<pair>{\n\t\tpublic int compare(pair o1, pair o2){\n\t\t\tif(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}\n\t\t\treturn o2.y-o1.y;\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\tstatic class Node{\n\t\tint node;\n\t\tint d;\n\t\tArrayList<Integer> al = new ArrayList<>();\t\n\t}\n\t\n\n\tstatic long gcd(long a, long b) \n { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }\n\t\n\t\t\n\tstatic class FastReader \n\t{ \n\t\tfinal private int BUFFER_SIZE = 1 << 16; \n\t\tprivate DataInputStream din; \n\t\tprivate byte[] buffer; \n\t\tprivate int bufferPointer, bytesRead; \n \n\t\tpublic FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t} \n \n\t\tpublic int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tprivate void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t} \n \n\t\tprivate byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t} \n \n\t\tpublic void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t} \n\t} \n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main{\n\tpublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\tpublic static void main(String sp[])throws IOException{\n\t\tScanner sc = new Scanner(System.in);\n\t\t//FastReader sc = new FastReader();\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tHashMap<Integer,Integer> hm = new HashMap<>();\n\t\tfor(int i=-1;i<=101;i++){\n\t\t\thm.put(i,0);\n\t\t}\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}\n\t\tArrayList<Integer> al = new ArrayList<>(hm.keySet());\n\t\tint diff = Integer.MAX_VALUE;\n\t\tint min = 0;\n\t\tfor(int val:al){\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> primefactor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}\n\t\n\tpublic static long sum(long val){\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> factor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\tfor(int i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}\n\t\n\tpublic static int power(int x, int y) \n\t{ \n\t\tint temp; \n\t\tif( y == 0) \n\t\t\treturn 1; \n\t\ttemp = power(x, y/2); \n\t\tif (y%2 == 0) \n\t\t\treturn temp*temp; \n\t\telse\n\t\t\treturn x*temp*temp; \n\t} \n\t\n\tpublic static ArrayList<Integer> comp(){\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}\n\t\n\tpublic static class pair{\n\t\tint x;\n\t\tint y;\n\t\tpair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t}\n\t\n\tpublic static class comp implements Comparator<pair>{\n\t\tpublic int compare(pair o1, pair o2){\n\t\t\tif(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}\n\t\t\treturn o2.y-o1.y;\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\tstatic class Node{\n\t\tint node;\n\t\tint d;\n\t\tArrayList<Integer> al = new ArrayList<>();\t\n\t}\n\t\n\n\tstatic long gcd(long a, long b) \n { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }\n\t\n\t\t\n\tstatic class FastReader \n\t{ \n\t\tfinal private int BUFFER_SIZE = 1 << 16; \n\t\tprivate DataInputStream din; \n\t\tprivate byte[] buffer; \n\t\tprivate int bufferPointer, bytesRead; \n \n\t\tpublic FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t} \n \n\t\tpublic int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tprivate void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t} \n \n\t\tprivate byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t} \n \n\t\tpublic void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t} \n\t} \n}",
"Main",
"public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));",
"out",
"new PrintWriter (new BufferedOutputStream(System.out))",
"public static void main(String sp[])throws IOException{\n\t\tScanner sc = new Scanner(System.in);\n\t\t//FastReader sc = new FastReader();\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tHashMap<Integer,Integer> hm = new HashMap<>();\n\t\tfor(int i=-1;i<=101;i++){\n\t\t\thm.put(i,0);\n\t\t}\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}\n\t\tArrayList<Integer> al = new ArrayList<>(hm.keySet());\n\t\tint diff = Integer.MAX_VALUE;\n\t\tint min = 0;\n\t\tfor(int val:al){\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t//FastReader sc = new FastReader();\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tHashMap<Integer,Integer> hm = new HashMap<>();\n\t\tfor(int i=-1;i<=101;i++){\n\t\t\thm.put(i,0);\n\t\t}\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}\n\t\tArrayList<Integer> al = new ArrayList<>(hm.keySet());\n\t\tint diff = Integer.MAX_VALUE;\n\t\tint min = 0;\n\t\tfor(int val:al){\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\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",
"HashMap<Integer,Integer> hm = new HashMap<>();",
"hm",
"new HashMap<>()",
"for(int i=-1;i<=101;i++){\n\t\t\thm.put(i,0);\n\t\t}",
"int i=-1;",
"int i=-1;",
"i",
"-1",
"1",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\thm.put(i,0);\n\t\t}",
"{\n\t\t\thm.put(i,0);\n\t\t}",
"hm.put(i,0)",
"hm.put",
"hm",
"i",
"0",
"for(int i=1;i<=n;i++){\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<=n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}",
"{\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}",
"int val = sc.nextInt();",
"val",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(hm.containsKey(val))\n\t\t\t\thm.remove(val);",
"hm.containsKey(val)",
"hm.containsKey",
"hm",
"val",
"hm.remove(val)",
"hm.remove",
"hm",
"val",
"ArrayList<Integer> al = new ArrayList<>(hm.keySet());",
"al",
"new ArrayList<>(hm.keySet())",
"int diff = Integer.MAX_VALUE;",
"diff",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int min = 0;",
"min",
"0",
"for(int val:al){\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}",
"int val",
"al",
"{\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}",
"if(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}",
"Math.abs(x-val)<diff",
"Math.abs(x-val)",
"Math.abs",
"Math",
"x-val",
"x",
"val",
"diff",
"{\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}",
"min = val",
"min",
"val",
"diff = Math.abs(x-val)",
"diff",
"Math.abs(x-val)",
"Math.abs",
"Math",
"x-val",
"x",
"val",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"String sp[]",
"sp",
"public static ArrayList<Integer> primefactor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}",
"primefactor",
"{\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}",
"int sqrt = (int)Math.sqrt(n);",
"sqrt",
"(int)Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"ArrayList<Integer> al = new ArrayList<>();",
"al",
"new ArrayList<>()",
"while(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}",
"n%2==0",
"n%2",
"n",
"2",
"0",
"{\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}",
"al.add(2)",
"al.add",
"al",
"2",
"n/=2",
"n",
"2",
"for(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}",
"int i=3;",
"int i=3;",
"i",
"3",
"i<=sqrt",
"i",
"sqrt",
"i+=2",
"i+=2",
"i",
"2",
"{\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}",
"{\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}",
"while(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}",
"n%i==0",
"n%i",
"n",
"i",
"0",
"{\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}",
"al.add(i)",
"al.add",
"al",
"i",
"n/=i",
"n",
"i",
"if(n>2)\n\t\t\tal.add(n);",
"n>2",
"n",
"2",
"al.add(n)",
"al.add",
"al",
"n",
"return al;",
"al",
"int n",
"n",
"public static long sum(long val){\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}",
"sum",
"{\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}",
"long fg =0 ;",
"fg",
"0",
"while(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}",
"val!=0",
"val",
"0",
"{\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}",
"fg+=val%10",
"fg",
"val%10",
"val",
"10",
"val/=10",
"val",
"10",
"return fg;",
"fg",
"long val",
"val",
"public static ArrayList<Integer> factor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\tfor(int i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}",
"factor",
"{\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\tfor(int i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}",
"int sqrt = (int)Math.sqrt(n);",
"sqrt",
"(int)Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"ArrayList<Integer> al = new ArrayList<>();",
"al",
"new ArrayList<>()",
"for(int i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<=sqrt",
"i",
"sqrt",
"i++",
"i++",
"i",
"{\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}",
"{\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}",
"if(n%i!=0)\n\t\t\t\tcontinue;",
"n%i!=0",
"n%i",
"n",
"i",
"0",
"continue;",
"int first = i;",
"first",
"i",
"int second = n/i;",
"second",
"n/i",
"n",
"i",
"al.add(i)",
"al.add",
"al",
"i",
"if(first==second){\n\t\t\t\tcontinue;\n\t\t\t}",
"first==second",
"first",
"second",
"{\n\t\t\t\tcontinue;\n\t\t\t}",
"continue;",
"al.add(n/i)",
"al.add",
"al",
"n/i",
"n",
"i",
"return al;",
"al",
"int n",
"n",
"public static int power(int x, int y) \n\t{ \n\t\tint temp; \n\t\tif( y == 0) \n\t\t\treturn 1; \n\t\ttemp = power(x, y/2); \n\t\tif (y%2 == 0) \n\t\t\treturn temp*temp; \n\t\telse\n\t\t\treturn x*temp*temp; \n\t}",
"power",
"{ \n\t\tint temp; \n\t\tif( y == 0) \n\t\t\treturn 1; \n\t\ttemp = power(x, y/2); \n\t\tif (y%2 == 0) \n\t\t\treturn temp*temp; \n\t\telse\n\t\t\treturn x*temp*temp; \n\t}",
"int temp;",
"temp",
"if( y == 0) \n\t\t\treturn 1;",
"y == 0",
"y",
"0",
"return 1;",
"1",
"temp = power(x, y/2)",
"temp",
"power(x, y/2)",
"power",
"x",
"y/2",
"y",
"2",
"if (y%2 == 0) \n\t\t\treturn temp*temp; \n\t\telse\n\t\t\treturn x*temp*temp;",
"y%2 == 0",
"y%2",
"y",
"2",
"0",
"return temp*temp;",
"temp*temp",
"temp",
"temp",
"return x*temp*temp;",
"x*temp*temp",
"x*temp*temp",
"x",
"temp",
"temp",
"int x",
"x",
"int y",
"y",
"public static ArrayList<Integer> comp(){\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}",
"comp",
"{\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}",
"ArrayList<Integer> al = new ArrayList<>();",
"al",
"new ArrayList<>()",
"int n = (int)2e5;",
"n",
"(int)2e5",
"boolean arr[] = new boolean[n+1];",
"arr",
"new boolean[n+1]",
"n+1",
"n",
"1",
"int sqrt = (int)Math.sqrt(n);",
"sqrt",
"(int)Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"for(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"int i=2;",
"int i=2;",
"i",
"2",
"i<=sqrt",
"i",
"sqrt",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"if(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}",
"arr[i]==false",
"arr[i]",
"arr",
"i",
"false",
"{\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}",
"for(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}",
"int j=i*i;",
"int j=i*i;",
"j",
"i*i",
"i",
"i",
"j<=n",
"j",
"n",
"j+=i",
"j+=i",
"j",
"i",
"{\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}",
"{\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}",
"arr[j]=true",
"arr[j]",
"arr",
"j",
"true",
"for(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}",
"int i=2;",
"int i=2;",
"i",
"2",
"i<=n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}",
"{\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}",
"if(arr[i]==false)\n\t\t\t\t\tal.add(i);",
"arr[i]==false",
"arr[i]",
"arr",
"i",
"false",
"al.add(i)",
"al.add",
"al",
"i",
"return al;",
"al",
"static long gcd(long a, long b) \n { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }",
"gcd",
"{ \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }",
"if (b == 0) \n return a;",
"b == 0",
"b",
"0",
"return a;",
"a",
"return gcd(b, a % b);",
"gcd(b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"long a",
"a",
"long b",
"b",
"public static class pair{\n\t\tint x;\n\t\tint y;\n\t\tpair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t}",
"pair",
"int x;",
"x",
"int y;",
"y",
"pair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}",
"pair",
"{\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}",
"this.x=x",
"this.x",
"this",
"this.x",
"x",
"this.y=y",
"this.y",
"this",
"this.y",
"y",
"int x",
"x",
"int y",
"y",
"public static class comp implements Comparator<pair>{\n\t\tpublic int compare(pair o1, pair o2){\n\t\t\tif(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}\n\t\t\treturn o2.y-o1.y;\n\t\t}\n\t}",
"comp",
"public int compare(pair o1, pair o2){\n\t\t\tif(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}\n\t\t\treturn o2.y-o1.y;\n\t\t}",
"compare",
"{\n\t\t\tif(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}\n\t\t\treturn o2.y-o1.y;\n\t\t}",
"if(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}",
"o1.y==o2.y",
"o1.y",
"o1",
"o1.y",
"o2.y",
"o2",
"o2.y",
"{\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}",
"return o2.x-o1.x;",
"o2.x-o1.x",
"o2.x",
"o2",
"o2.x",
"o1.x",
"o1",
"o1.x",
"return o2.y-o1.y;",
"o2.y-o1.y",
"o2.y",
"o2",
"o2.y",
"o1.y",
"o1",
"o1.y",
"pair o1",
"o1",
"pair o2",
"o2",
"Comparator",
"static class Node{\n\t\tint node;\n\t\tint d;\n\t\tArrayList<Integer> al = new ArrayList<>();\t\n\t}",
"Node",
"int node;",
"node",
"int d;",
"d",
"ArrayList<Integer> al = new ArrayList<>();",
"al",
"new ArrayList<>()",
"static class FastReader \n\t{ \n\t\tfinal private int BUFFER_SIZE = 1 << 16; \n\t\tprivate DataInputStream din; \n\t\tprivate byte[] buffer; \n\t\tprivate int bufferPointer, bytesRead; \n \n\t\tpublic FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t} \n \n\t\tpublic int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tprivate void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t} \n \n\t\tprivate byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t} \n \n\t\tpublic void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t} \n\t}",
"FastReader",
"final private int BUFFER_SIZE = 1 << 16;",
"BUFFER_SIZE",
"1 << 16",
"1",
"16",
"private DataInputStream din;",
"din",
"private byte[] buffer;",
"buffer",
"private int bufferPointer",
"bufferPointer",
"bytesRead;",
"bytesRead",
"public FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t}",
"FastReader",
"{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t}",
"din = new DataInputStream(System.in)",
"din",
"new DataInputStream(System.in)",
"buffer = new byte[BUFFER_SIZE]",
"buffer",
"new byte[BUFFER_SIZE]",
"BUFFER_SIZE",
"bufferPointer = bytesRead = 0",
"bufferPointer",
"bytesRead = 0",
"bytesRead",
"0",
"public FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t}",
"FastReader",
"{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t}",
"din = new DataInputStream(new FileInputStream(file_name))",
"din",
"new DataInputStream(new FileInputStream(file_name))",
"buffer = new byte[BUFFER_SIZE]",
"buffer",
"new byte[BUFFER_SIZE]",
"BUFFER_SIZE",
"bufferPointer = bytesRead = 0",
"bufferPointer",
"bytesRead = 0",
"bytesRead",
"0",
"String file_name",
"file_name",
"public String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t}",
"readLine",
"{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t}",
"byte[] buf = new byte[64];",
"buf",
"new byte[64]",
"64",
"int cnt = 0",
"cnt",
"0",
"c;",
"c",
"while ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t}",
"(c = read()) != -1",
"(c = read())",
"c",
"read()",
"read",
"-1",
"1",
"{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t}",
"if (c == '\\n') \n\t\t\t\t\tbreak;",
"c == '\\n'",
"c",
"'\\n'",
"break;",
"buf[cnt++] = (byte) c",
"buf[cnt++]",
"buf",
"cnt++",
"cnt",
"(byte) c",
"return new String(buf, 0, cnt);",
"new String(buf, 0, cnt)",
"public int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t}",
"nextInt",
"{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t}",
"int ret = 0;",
"ret",
"0",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ') \n\t\t\t\tc = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg) \n\t\t\t\tc = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t}",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (neg) \n\t\t\t\treturn -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"public long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t}",
"nextLong",
"{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t}",
"long ret = 0;",
"ret",
"0",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ') \n\t\t\t\tc = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg) \n\t\t\t\tc = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t}",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (neg) \n\t\t\t\treturn -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"public double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t}",
"nextDouble",
"{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t}",
"double ret = 0",
"ret",
"0",
"div = 1;",
"div",
"1",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ') \n\t\t\t\tc = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg) \n\t\t\t\tc = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t}",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t}",
"c == '.'",
"c",
"'.'",
"{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t}",
"while ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t}",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t}",
"ret += (c - '0') / (div *= 10)",
"ret",
"(c - '0') / (div *= 10)",
"(c - '0')",
"c",
"'0'",
"(div *= 10)",
"div",
"10",
"if (neg) \n\t\t\t\treturn -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"private void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t}",
"fillBuffer",
"{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t}",
"bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE)",
"bytesRead",
"din.read(buffer, bufferPointer = 0, BUFFER_SIZE)",
"din.read",
"din",
"buffer",
"bufferPointer = 0",
"bufferPointer",
"0",
"BUFFER_SIZE",
"if (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1;",
"bytesRead == -1",
"bytesRead",
"-1",
"1",
"buffer[0] = -1",
"buffer[0]",
"buffer",
"0",
"-1",
"1",
"private byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t}",
"read",
"{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t}",
"if (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer();",
"bufferPointer == bytesRead",
"bufferPointer",
"bytesRead",
"fillBuffer()",
"fillBuffer",
"return buffer[bufferPointer++];",
"buffer[bufferPointer++]",
"buffer",
"bufferPointer++",
"bufferPointer",
"public void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t}",
"close",
"{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t}",
"if (din == null) \n\t\t\t\treturn;",
"din == null",
"din",
"null",
"return;",
"din.close()",
"din.close",
"din",
"public class Main{\n\tpublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\tpublic static void main(String sp[])throws IOException{\n\t\tScanner sc = new Scanner(System.in);\n\t\t//FastReader sc = new FastReader();\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tHashMap<Integer,Integer> hm = new HashMap<>();\n\t\tfor(int i=-1;i<=101;i++){\n\t\t\thm.put(i,0);\n\t\t}\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}\n\t\tArrayList<Integer> al = new ArrayList<>(hm.keySet());\n\t\tint diff = Integer.MAX_VALUE;\n\t\tint min = 0;\n\t\tfor(int val:al){\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> primefactor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}\n\t\n\tpublic static long sum(long val){\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> factor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\tfor(int i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}\n\t\n\tpublic static int power(int x, int y) \n\t{ \n\t\tint temp; \n\t\tif( y == 0) \n\t\t\treturn 1; \n\t\ttemp = power(x, y/2); \n\t\tif (y%2 == 0) \n\t\t\treturn temp*temp; \n\t\telse\n\t\t\treturn x*temp*temp; \n\t} \n\t\n\tpublic static ArrayList<Integer> comp(){\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}\n\t\n\tpublic static class pair{\n\t\tint x;\n\t\tint y;\n\t\tpair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t}\n\t\n\tpublic static class comp implements Comparator<pair>{\n\t\tpublic int compare(pair o1, pair o2){\n\t\t\tif(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}\n\t\t\treturn o2.y-o1.y;\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\tstatic class Node{\n\t\tint node;\n\t\tint d;\n\t\tArrayList<Integer> al = new ArrayList<>();\t\n\t}\n\t\n\n\tstatic long gcd(long a, long b) \n { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }\n\t\n\t\t\n\tstatic class FastReader \n\t{ \n\t\tfinal private int BUFFER_SIZE = 1 << 16; \n\t\tprivate DataInputStream din; \n\t\tprivate byte[] buffer; \n\t\tprivate int bufferPointer, bytesRead; \n \n\t\tpublic FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t} \n \n\t\tpublic int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tprivate void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t} \n \n\t\tprivate byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t} \n \n\t\tpublic void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t} \n\t} \n}",
"public class Main{\n\tpublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\tpublic static void main(String sp[])throws IOException{\n\t\tScanner sc = new Scanner(System.in);\n\t\t//FastReader sc = new FastReader();\t\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tHashMap<Integer,Integer> hm = new HashMap<>();\n\t\tfor(int i=-1;i<=101;i++){\n\t\t\thm.put(i,0);\n\t\t}\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tint val = sc.nextInt();\n\t\t\tif(hm.containsKey(val))\n\t\t\t\thm.remove(val);\n\t\t}\n\t\tArrayList<Integer> al = new ArrayList<>(hm.keySet());\n\t\tint diff = Integer.MAX_VALUE;\n\t\tint min = 0;\n\t\tfor(int val:al){\n\t\t\tif(Math.abs(x-val)<diff){\n\t\t\t\tmin = val;\n\t\t\t\tdiff = Math.abs(x-val);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> primefactor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}\n\t\n\tpublic static long sum(long val){\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList<Integer> factor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\tfor(int i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tint first = i;\n\t\t\tint second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}\n\t\n\tpublic static int power(int x, int y) \n\t{ \n\t\tint temp; \n\t\tif( y == 0) \n\t\t\treturn 1; \n\t\ttemp = power(x, y/2); \n\t\tif (y%2 == 0) \n\t\t\treturn temp*temp; \n\t\telse\n\t\t\treturn x*temp*temp; \n\t} \n\t\n\tpublic static ArrayList<Integer> comp(){\n\t\tArrayList<Integer> al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}\n\t\n\tpublic static class pair{\n\t\tint x;\n\t\tint y;\n\t\tpair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t}\n\t\n\tpublic static class comp implements Comparator<pair>{\n\t\tpublic int compare(pair o1, pair o2){\n\t\t\tif(o1.y==o2.y){\n\t\t\t\treturn o2.x-o1.x;\n\t\t\t}\n\t\t\treturn o2.y-o1.y;\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\tstatic class Node{\n\t\tint node;\n\t\tint d;\n\t\tArrayList<Integer> al = new ArrayList<>();\t\n\t}\n\t\n\n\tstatic long gcd(long a, long b) \n { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }\n\t\n\t\t\n\tstatic class FastReader \n\t{ \n\t\tfinal private int BUFFER_SIZE = 1 << 16; \n\t\tprivate DataInputStream din; \n\t\tprivate byte[] buffer; \n\t\tprivate int bufferPointer, bytesRead; \n \n\t\tpublic FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t} \n \n\t\tpublic int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tprivate void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t} \n \n\t\tprivate byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t} \n \n\t\tpublic void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t} \n\t} \n}",
"Main"
]
| import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String sp[])throws IOException{
Scanner sc = new Scanner(System.in);
//FastReader sc = new FastReader();
int x = sc.nextInt();
int n = sc.nextInt();
HashMap<Integer,Integer> hm = new HashMap<>();
for(int i=-1;i<=101;i++){
hm.put(i,0);
}
for(int i=1;i<=n;i++){
int val = sc.nextInt();
if(hm.containsKey(val))
hm.remove(val);
}
ArrayList<Integer> al = new ArrayList<>(hm.keySet());
int diff = Integer.MAX_VALUE;
int min = 0;
for(int val:al){
if(Math.abs(x-val)<diff){
min = val;
diff = Math.abs(x-val);
}
}
System.out.println(min);
}
public static ArrayList<Integer> primefactor(int n){
int sqrt = (int)Math.sqrt(n);
ArrayList<Integer> al = new ArrayList<>();
while(n%2==0){
al.add(2);
n/=2;
}
for(int i=3;i<=sqrt;i+=2){
while(n%i==0){
al.add(i);
n/=i;
}
}
if(n>2)
al.add(n);
return al;
}
public static long sum(long val){
long fg =0 ;
while(val!=0){
fg+=val%10;
val/=10;
}
return fg;
}
public static ArrayList<Integer> factor(int n){
int sqrt = (int)Math.sqrt(n);
ArrayList<Integer> al = new ArrayList<>();
for(int i=1;i<=sqrt;i++){
if(n%i!=0)
continue;
int first = i;
int second = n/i;
al.add(i);
if(first==second){
continue;
}
al.add(n/i);
}
return al;
}
public static int power(int x, int y)
{
int temp;
if( y == 0)
return 1;
temp = power(x, y/2);
if (y%2 == 0)
return temp*temp;
else
return x*temp*temp;
}
public static ArrayList<Integer> comp(){
ArrayList<Integer> al = new ArrayList<>();
int n = (int)2e5;
boolean arr[] = new boolean[n+1];
int sqrt = (int)Math.sqrt(n);
for(int i=2;i<=sqrt;i++){
if(arr[i]==false){
for(int j=i*i;j<=n;j+=i){
arr[j]=true;
}
}
}
for(int i=2;i<=n;i++){
if(arr[i]==false)
al.add(i);
}
return al;
}
public static class pair{
int x;
int y;
pair(int x, int y){
this.x=x;
this.y=y;
}
}
public static class comp implements Comparator<pair>{
public int compare(pair o1, pair o2){
if(o1.y==o2.y){
return o2.x-o1.x;
}
return o2.y-o1.y;
}
}
static class Node{
int node;
int d;
ArrayList<Integer> al = new ArrayList<>();
}
static long gcd(long a, long b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
static class FastReader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public FastReader()
{
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public FastReader(String file_name) throws IOException
{
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException
{
byte[] buf = new byte[64]; // line length
int cnt = 0, c;
while ((c = read()) != -1)
{
if (c == '\n')
break;
buf[cnt++] = (byte) c;
}
return new String(buf, 0, cnt);
}
public int nextInt() throws IOException
{
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do
{
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long nextLong() throws IOException
{
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public double nextDouble() throws IOException
{
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (c == '.')
{
while ((c = read()) >= '0' && c <= '9')
{
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
private void fillBuffer() throws IOException
{
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException
{
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException
{
if (din == null)
return;
din.close();
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
4,
18,
13,
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,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
28,
13,
13,
30,
30,
41,
13,
4,
18,
13,
2,
13,
13,
0,
13,
4,
18,
13,
13,
13,
41,
13,
20,
28,
13,
13,
30,
30,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
2,
13,
17,
41,
13,
4,
18,
13,
13,
13,
14,
2,
2,
13,
13,
2,
13,
13,
30,
14,
2,
13,
13,
4,
18,
18,
13,
13,
17,
29,
14,
2,
2,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
14,
2,
4,
18,
13,
17,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
29,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
0,
13,
2,
2,
4,
13,
13,
13,
13,
4,
13,
13,
13,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
17,
29,
13,
41,
13,
20,
42,
2,
13,
17,
30,
4,
18,
13,
2,
13,
17,
0,
13,
17,
0,
13,
4,
18,
13,
41,
13,
20,
41,
13,
4,
18,
13,
42,
2,
13,
17,
30,
4,
18,
13,
17,
40,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
40,
17,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
30,
29,
13,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
30,
29,
13,
29,
40,
13,
23,
13,
23,
13,
6,
13,
41,
13,
2,
17,
17,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
13,
0,
13,
0,
13,
17,
12,
13,
30,
0,
13,
20,
0,
13,
20,
13,
0,
13,
0,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
17,
41,
13,
17,
41,
13,
42,
2,
0,
13,
4,
13,
40,
17,
30,
14,
2,
13,
17,
3,
0,
18,
13,
40,
13,
13,
29,
20,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
42,
2,
13,
17,
0,
13,
4,
13,
41,
13,
2,
13,
17,
14,
13,
0,
13,
4,
13,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
2,
13,
17,
13,
17,
14,
2,
13,
17,
30,
42,
2,
2,
0,
13,
4,
13,
17,
2,
13,
17,
30,
0,
13,
2,
2,
13,
17,
0,
13,
17,
14,
13,
29,
40,
13,
29,
13,
12,
13,
30,
0,
13,
4,
18,
13,
13,
0,
13,
17,
13,
14,
2,
13,
40,
17,
0,
18,
13,
17,
40,
17,
12,
13,
30,
14,
2,
13,
13,
4,
13,
29,
18,
13,
40,
13,
12,
13,
30,
14,
2,
13,
17,
29,
4,
18,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
845,
11
],
[
845,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
14,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
21,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
26,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
37,
38
],
[
37,
39
],
[
26,
41
],
[
41,
42
],
[
41,
43
],
[
26,
44
],
[
44,
45
],
[
44,
46
],
[
26,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
26,
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
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
26,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
26,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
26,
99
],
[
99,
100
],
[
99,
101
],
[
99,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
109,
110
],
[
109,
111
],
[
103,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
114,
118
],
[
26,
119
],
[
119,
120
],
[
119,
121
],
[
26,
122
],
[
122,
123
],
[
122,
124
],
[
122,
125
],
[
126,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
132,
133
],
[
132,
134
],
[
126,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
26,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
26,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
151,
154
],
[
154,
155
],
[
154,
156
],
[
26,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
159,
163
],
[
26,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
169,
171
],
[
164,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
177,
182
],
[
172,
183
],
[
26,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
185,
189
],
[
189,
190
],
[
189,
191
],
[
184,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
193,
198
],
[
192,
199
],
[
26,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
201,
205
],
[
200,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
209,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
209,
216
],
[
216,
217
],
[
217,
218
],
[
216,
219
],
[
219,
220
],
[
219,
221
],
[
206,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
222,
227
],
[
206,
228
],
[
26,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
231,
233
],
[
229,
234
],
[
234,
235
],
[
235,
236
],
[
12,
237
],
[
237,
238
],
[
845,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
241,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
249,
252
],
[
249,
253
],
[
248,
254
],
[
254,
255
],
[
254,
256
],
[
254,
257
],
[
254,
258
],
[
247,
259
],
[
241,
260
],
[
260,
261
],
[
239,
262
],
[
262,
263
],
[
239,
264
],
[
264,
265
],
[
239,
266
],
[
266,
267
],
[
239,
268
],
[
268,
269
],
[
845,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
273,
274
],
[
273,
275
],
[
272,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
278,
280
],
[
272,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
281,
285
],
[
285,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
288,
292
],
[
285,
293
],
[
293,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
293,
299
],
[
299,
300
],
[
299,
301
],
[
301,
302
],
[
301,
303
],
[
293,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
306,
308
],
[
272,
309
],
[
309,
310
],
[
270,
311
],
[
311,
312
],
[
270,
313
],
[
313,
314
],
[
270,
315
],
[
315,
316
],
[
845,
317
],
[
317,
318
],
[
317,
319
],
[
319,
320
],
[
320,
321
],
[
320,
322
],
[
319,
323
],
[
323,
324
],
[
323,
325
],
[
325,
326
],
[
325,
327
],
[
319,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
328,
332
],
[
332,
333
],
[
333,
334
],
[
333,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
335,
339
],
[
332,
340
],
[
340,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
341,
345
],
[
340,
346
],
[
346,
347
],
[
346,
348
],
[
348,
349
],
[
348,
350
],
[
340,
351
],
[
351,
352
],
[
351,
353
],
[
353,
354
],
[
353,
355
],
[
319,
356
],
[
356,
357
],
[
317,
358
],
[
358,
359
],
[
317,
360
],
[
360,
361
],
[
317,
362
],
[
362,
363
],
[
845,
364
],
[
364,
365
],
[
364,
366
],
[
366,
367
],
[
367,
368
],
[
368,
369
],
[
368,
370
],
[
367,
371
],
[
371,
372
],
[
372,
373
],
[
372,
374
],
[
371,
375
],
[
375,
376
],
[
376,
377
],
[
377,
378
],
[
377,
379
],
[
375,
380
],
[
380,
381
],
[
380,
382
],
[
375,
383
],
[
383,
384
],
[
384,
385
],
[
375,
386
],
[
387,
387
],
[
387,
388
],
[
388,
389
],
[
389,
390
],
[
388,
391
],
[
371,
392
],
[
392,
393
],
[
366,
394
],
[
394,
395
],
[
394,
396
],
[
366,
397
],
[
397,
398
],
[
398,
399
],
[
398,
400
],
[
397,
401
],
[
401,
402
],
[
402,
403
],
[
403,
404
],
[
402,
405
],
[
405,
406
],
[
405,
407
],
[
401,
408
],
[
408,
409
],
[
408,
410
],
[
366,
411
],
[
411,
412
],
[
411,
413
],
[
413,
414
],
[
414,
415
],
[
366,
416
],
[
416,
417
],
[
416,
418
],
[
366,
419
],
[
419,
420
],
[
419,
421
],
[
421,
422
],
[
422,
423
],
[
366,
424
],
[
424,
425
],
[
425,
426
],
[
425,
427
],
[
424,
428
],
[
428,
429
],
[
429,
430
],
[
430,
431
],
[
429,
432
],
[
428,
433
],
[
433,
434
],
[
366,
435
],
[
435,
436
],
[
436,
437
],
[
435,
438
],
[
366,
439
],
[
439,
440
],
[
364,
441
],
[
441,
442
],
[
845,
443
],
[
443,
444
],
[
443,
445
],
[
445,
446
],
[
446,
447
],
[
446,
448
],
[
448,
449
],
[
448,
450
],
[
445,
451
],
[
451,
452
],
[
451,
453
],
[
453,
454
],
[
445,
455
],
[
455,
456
],
[
455,
457
],
[
445,
458
],
[
458,
459
],
[
458,
460
],
[
445,
461
],
[
461,
462
],
[
462,
463
],
[
462,
464
],
[
461,
465
],
[
465,
466
],
[
466,
467
],
[
466,
468
],
[
468,
469
],
[
469,
470
],
[
469,
471
],
[
468,
472
],
[
465,
473
],
[
473,
474
],
[
474,
475
],
[
474,
476
],
[
473,
477
],
[
477,
478
],
[
478,
479
],
[
465,
480
],
[
480,
481
],
[
481,
482
],
[
481,
483
],
[
483,
484
],
[
483,
485
],
[
480,
486
],
[
486,
487
],
[
487,
488
],
[
487,
489
],
[
489,
490
],
[
489,
491
],
[
480,
492
],
[
492,
493
],
[
493,
494
],
[
493,
495
],
[
495,
496
],
[
495,
497
],
[
492,
498
],
[
498,
499
],
[
499,
500
],
[
499,
501
],
[
501,
502
],
[
501,
503
],
[
492,
504
],
[
504,
505
],
[
505,
506
],
[
445,
507
],
[
507,
508
],
[
508,
509
],
[
443,
510
],
[
510,
511
],
[
443,
512
],
[
512,
513
],
[
845,
514
],
[
514,
515
],
[
514,
516
],
[
516,
517
],
[
516,
518
],
[
518,
519
],
[
518,
520
],
[
514,
521
],
[
521,
522
],
[
514,
523
],
[
523,
524
],
[
514,
525
],
[
525,
526
],
[
514,
527
],
[
527,
528
],
[
514,
529
],
[
529,
530
],
[
529,
531
],
[
531,
532
],
[
532,
533
],
[
532,
534
],
[
531,
535
],
[
535,
536
],
[
535,
537
],
[
531,
539
],
[
539,
540
],
[
539,
541
],
[
541,
542
],
[
541,
543
],
[
514,
544
],
[
544,
545
],
[
544,
546
],
[
546,
547
],
[
547,
548
],
[
547,
549
],
[
546,
550
],
[
550,
551
],
[
550,
552
],
[
546,
554
],
[
554,
555
],
[
554,
556
],
[
556,
557
],
[
556,
558
],
[
544,
559
],
[
559,
560
],
[
514,
561
],
[
561,
562
],
[
561,
563
],
[
563,
564
],
[
564,
565
],
[
564,
566
],
[
563,
568
],
[
568,
569
],
[
568,
570
],
[
563,
571
],
[
571,
572
],
[
563,
573
],
[
573,
574
],
[
574,
575
],
[
575,
576
],
[
575,
577
],
[
577,
578
],
[
574,
579
],
[
579,
580
],
[
573,
581
],
[
581,
582
],
[
582,
583
],
[
583,
584
],
[
583,
585
],
[
582,
586
],
[
581,
587
],
[
587,
588
],
[
588,
589
],
[
588,
590
],
[
590,
591
],
[
587,
592
],
[
563,
593
],
[
593,
594
],
[
514,
595
],
[
595,
596
],
[
595,
597
],
[
597,
598
],
[
598,
599
],
[
598,
600
],
[
597,
601
],
[
601,
602
],
[
601,
603
],
[
603,
604
],
[
597,
605
],
[
605,
606
],
[
606,
607
],
[
606,
608
],
[
605,
609
],
[
609,
610
],
[
609,
611
],
[
611,
612
],
[
597,
613
],
[
613,
614
],
[
613,
615
],
[
615,
616
],
[
615,
617
],
[
597,
618
],
[
618,
619
],
[
618,
620
],
[
620,
621
],
[
620,
622
],
[
622,
623
],
[
597,
624
],
[
624,
625
],
[
625,
626
],
[
626,
627
],
[
627,
628
],
[
627,
629
],
[
629,
630
],
[
626,
631
],
[
625,
632
],
[
632,
633
],
[
632,
634
],
[
624,
635
],
[
635,
636
],
[
636,
637
],
[
636,
638
],
[
638,
639
],
[
639,
640
],
[
640,
641
],
[
640,
642
],
[
639,
643
],
[
638,
644
],
[
597,
645
],
[
645,
646
],
[
645,
647
],
[
647,
648
],
[
648,
649
],
[
597,
650
],
[
650,
651
],
[
514,
652
],
[
652,
653
],
[
652,
654
],
[
654,
655
],
[
655,
656
],
[
655,
657
],
[
654,
658
],
[
658,
659
],
[
658,
660
],
[
660,
661
],
[
654,
662
],
[
662,
663
],
[
663,
664
],
[
663,
665
],
[
662,
666
],
[
666,
667
],
[
666,
668
],
[
668,
669
],
[
654,
670
],
[
670,
671
],
[
670,
672
],
[
672,
673
],
[
672,
674
],
[
654,
675
],
[
675,
676
],
[
675,
677
],
[
677,
678
],
[
677,
679
],
[
679,
680
],
[
654,
681
],
[
681,
682
],
[
682,
683
],
[
683,
684
],
[
684,
685
],
[
684,
686
],
[
686,
687
],
[
683,
688
],
[
682,
689
],
[
689,
690
],
[
689,
691
],
[
681,
692
],
[
692,
693
],
[
693,
694
],
[
693,
695
],
[
695,
696
],
[
696,
697
],
[
697,
698
],
[
697,
699
],
[
696,
700
],
[
695,
701
],
[
654,
702
],
[
702,
703
],
[
702,
704
],
[
704,
705
],
[
705,
706
],
[
654,
707
],
[
707,
708
],
[
514,
709
],
[
709,
710
],
[
709,
711
],
[
711,
712
],
[
712,
713
],
[
712,
714
],
[
711,
715
],
[
715,
716
],
[
715,
717
],
[
711,
718
],
[
718,
719
],
[
718,
720
],
[
720,
721
],
[
711,
722
],
[
722,
723
],
[
723,
724
],
[
723,
725
],
[
722,
726
],
[
726,
727
],
[
726,
728
],
[
728,
729
],
[
711,
730
],
[
730,
731
],
[
730,
732
],
[
732,
733
],
[
732,
734
],
[
711,
735
],
[
735,
736
],
[
735,
737
],
[
737,
738
],
[
737,
739
],
[
739,
740
],
[
711,
741
],
[
741,
742
],
[
742,
743
],
[
743,
744
],
[
744,
745
],
[
744,
746
],
[
746,
747
],
[
743,
748
],
[
742,
749
],
[
749,
750
],
[
749,
751
],
[
741,
752
],
[
752,
753
],
[
753,
754
],
[
753,
755
],
[
755,
756
],
[
756,
757
],
[
757,
758
],
[
757,
759
],
[
756,
760
],
[
755,
761
],
[
711,
762
],
[
762,
763
],
[
763,
764
],
[
763,
765
],
[
762,
766
],
[
766,
767
],
[
767,
768
],
[
768,
769
],
[
769,
770
],
[
770,
771
],
[
770,
772
],
[
772,
773
],
[
769,
774
],
[
768,
775
],
[
775,
776
],
[
775,
777
],
[
767,
778
],
[
778,
779
],
[
779,
780
],
[
779,
781
],
[
781,
782
],
[
782,
783
],
[
782,
784
],
[
781,
785
],
[
785,
786
],
[
785,
787
],
[
711,
788
],
[
788,
789
],
[
788,
790
],
[
790,
791
],
[
791,
792
],
[
711,
793
],
[
793,
794
],
[
514,
795
],
[
795,
796
],
[
795,
797
],
[
797,
798
],
[
798,
799
],
[
798,
800
],
[
800,
801
],
[
801,
802
],
[
800,
803
],
[
800,
804
],
[
804,
805
],
[
804,
806
],
[
800,
807
],
[
797,
808
],
[
808,
809
],
[
809,
810
],
[
809,
811
],
[
811,
812
],
[
808,
813
],
[
813,
814
],
[
814,
815
],
[
814,
816
],
[
813,
817
],
[
817,
818
],
[
514,
819
],
[
819,
820
],
[
819,
821
],
[
821,
822
],
[
822,
823
],
[
823,
824
],
[
823,
825
],
[
822,
826
],
[
826,
827
],
[
821,
828
],
[
828,
829
],
[
829,
830
],
[
829,
831
],
[
831,
832
],
[
514,
833
],
[
833,
834
],
[
833,
835
],
[
835,
836
],
[
836,
837
],
[
837,
838
],
[
837,
839
],
[
836,
840
],
[
835,
841
],
[
841,
842
],
[
842,
843
],
[
0,
844
],
[
844,
845
],
[
844,
846
]
]
| [
"\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Main { \n \n public static void main(String[] args) throws java.lang.Exception { \n Reader pm =new Reader(); \n //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int t = 1;\n while(t-- > 0){\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }\n //end of tests\n \n }\n //end of main class\n\n static int countInRange(int arr[], int n, int x, int y) { \n // initialize result \n int count = 0; \n count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1; \n return count; \n } \n \n \n static int lowerIndex(int arr[], int n, int x) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n } \n return l; \n } \n \n // function to find last index <= y \n static int upperIndex(int arr[], int n, int y) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n } \n return h; \n }\n \n public static StringBuilder dec_to_bin(long n) {\n // decimal to binary upto 30 binaries\n if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }\n StringBuilder str=new StringBuilder(\"\");\n while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }\n str=str.reverse();\n StringBuilder tmp_str=new StringBuilder(\"\");\n int len=str.length();\n while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }\n tmp_str.append(str);\n return tmp_str;\n }\n \n private static int binarySearchPM(int[] arr, int key){\n int n = arr.length;\n int mid = -1;\n int begin = 0,end=n;\n while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }\n //System.out.println(begin+\" \"+end);\n return -begin; //expected Index\n }\n \n static class Reader { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n} ",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main { \n \n public static void main(String[] args) throws java.lang.Exception { \n Reader pm =new Reader(); \n //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int t = 1;\n while(t-- > 0){\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }\n //end of tests\n \n }\n //end of main class\n\n static int countInRange(int arr[], int n, int x, int y) { \n // initialize result \n int count = 0; \n count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1; \n return count; \n } \n \n \n static int lowerIndex(int arr[], int n, int x) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n } \n return l; \n } \n \n // function to find last index <= y \n static int upperIndex(int arr[], int n, int y) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n } \n return h; \n }\n \n public static StringBuilder dec_to_bin(long n) {\n // decimal to binary upto 30 binaries\n if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }\n StringBuilder str=new StringBuilder(\"\");\n while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }\n str=str.reverse();\n StringBuilder tmp_str=new StringBuilder(\"\");\n int len=str.length();\n while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }\n tmp_str.append(str);\n return tmp_str;\n }\n \n private static int binarySearchPM(int[] arr, int key){\n int n = arr.length;\n int mid = -1;\n int begin = 0,end=n;\n while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }\n //System.out.println(begin+\" \"+end);\n return -begin; //expected Index\n }\n \n static class Reader { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n}",
"Main",
"public static void main(String[] args) throws java.lang.Exception { \n Reader pm =new Reader(); \n //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int t = 1;\n while(t-- > 0){\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }\n //end of tests\n \n }",
"main",
"{ \n Reader pm =new Reader(); \n //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int t = 1;\n while(t-- > 0){\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }\n //end of tests\n \n }",
"Reader pm =new Reader();",
"pm",
"new Reader()",
"int t = 1;",
"t",
"1",
"while(t-- > 0){\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }",
"t-- > 0",
"t--",
"t",
"0",
"{\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }",
"int x = pm.nextInt();",
"x",
"pm.nextInt()",
"pm.nextInt",
"pm",
"int n = pm.nextInt();",
"n",
"pm.nextInt()",
"pm.nextInt",
"pm",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"ArrayList<Integer> al = new ArrayList();",
"al",
"new ArrayList()",
"HashSet<Integer> hs = new HashSet<>();",
"hs",
"new HashSet<>()",
"for(int i=1;i<=100;i++)\n hs.add(i);",
"int i=1;",
"int i=1;",
"i",
"1",
"i<=100",
"i",
"100",
"i++",
"i++",
"i",
"hs.add(i);",
"hs.add(i)",
"hs.add",
"hs",
"i",
"for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }",
"{\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }",
"a[i] = pm.nextInt()",
"a[i]",
"a",
"i",
"pm.nextInt()",
"pm.nextInt",
"pm",
"hs.remove((Integer)a[i])",
"hs.remove",
"hs",
"(Integer)a[i]",
"a",
"i",
"int ans = Integer.MAX_VALUE;",
"ans",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int dif = Integer.MAX_VALUE;",
"dif",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }",
"int i",
"hs",
"{\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }",
"{\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }",
"int df = Math.abs(i-x);",
"df",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"dif = Math.min(dif,df)",
"dif",
"Math.min(dif,df)",
"Math.min",
"Math",
"dif",
"df",
"TreeSet<Integer> ts = new TreeSet<>();",
"ts",
"new TreeSet<>()",
"for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }",
"int i",
"hs",
"{\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }",
"{\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }",
"int df = Math.abs(i-x);",
"df",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"if(df == dif) \n ts.add(i);",
"df == dif",
"df",
"dif",
"ts.add(i)",
"ts.add",
"ts",
"i",
"int on = Math.abs(x);",
"on",
"Math.abs(x)",
"Math.abs",
"Math",
"x",
"int off = Math.abs(x-101);",
"off",
"Math.abs(x-101)",
"Math.abs",
"Math",
"x-101",
"x",
"101",
"int mh = Math.min(on, off);",
"mh",
"Math.min(on, off)",
"Math.min",
"Math",
"on",
"off",
"if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n }",
"mh <= dif && mh == on",
"mh <= dif",
"mh",
"dif",
"mh == on",
"mh",
"on",
"{\n if(mh == on)\n System.out.println(0);\n return;\n }",
"if(mh == on)\n System.out.println(0);",
"mh == on",
"mh",
"on",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }",
"mh < dif && mh == off",
"mh < dif",
"mh",
"dif",
"mh == off",
"mh",
"off",
"{\n System.out.println(101);\n return;\n }",
"System.out.println(101)",
"System.out.println",
"System.out",
"System",
"System.out",
"101",
"return;",
"if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }",
"hs.size() == 0",
"hs.size()",
"hs.size",
"hs",
"0",
"{\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }",
"int min = Math.min(Math.abs(x), Math.abs(x-101));",
"min",
"Math.min(Math.abs(x), Math.abs(x-101))",
"Math.min",
"Math",
"Math.abs(x)",
"Math.abs",
"Math",
"x",
"Math.abs(x-101)",
"Math.abs",
"Math",
"x-101",
"x",
"101",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"return;",
"System.out.println(ts.first())",
"System.out.println",
"System.out",
"System",
"System.out",
"ts.first()",
"ts.first",
"ts",
"String[] args",
"args",
"static int countInRange(int arr[], int n, int x, int y) { \n // initialize result \n int count = 0; \n count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1; \n return count; \n }",
"countInRange",
"{ \n // initialize result \n int count = 0; \n count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1; \n return count; \n }",
"int count = 0;",
"count",
"0",
"count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1",
"count",
"upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1",
"upperIndex(arr, n, y) - \n lowerIndex(arr, n, x)",
"upperIndex(arr, n, y)",
"upperIndex",
"arr",
"n",
"y",
"lowerIndex(arr, n, x)",
"lowerIndex",
"arr",
"n",
"x",
"1",
"return count;",
"count",
"int arr[]",
"arr",
"int n",
"n",
"int x",
"x",
"int y",
"y",
"static int lowerIndex(int arr[], int n, int x) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n } \n return l; \n }",
"lowerIndex",
"{ \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n } \n return l; \n }",
"int l = 0",
"l",
"0",
"h = n - 1;",
"h",
"n - 1",
"n",
"1",
"while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n }",
"l <= h",
"l",
"h",
"{ \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n }",
"int mid = (l + h) / 2;",
"mid",
"(l + h) / 2",
"(l + h)",
"l",
"h",
"2",
"if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1;",
"arr[mid] >= x",
"arr[mid]",
"arr",
"mid",
"x",
"h = mid - 1",
"h",
"mid - 1",
"mid",
"1",
"l = mid + 1",
"l",
"mid + 1",
"mid",
"1",
"return l;",
"l",
"int arr[]",
"arr",
"int n",
"n",
"int x",
"x",
"// function to find last index <= y \n static int upperIndex(int arr[], int n, int y) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n } \n return h; \n }",
"upperIndex",
"{ \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n } \n return h; \n }",
"int l = 0",
"l",
"0",
"h = n - 1;",
"h",
"n - 1",
"n",
"1",
"while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n }",
"l <= h",
"l",
"h",
"{ \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n }",
"int mid = (l + h) / 2;",
"mid",
"(l + h) / 2",
"(l + h)",
"l",
"h",
"2",
"if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1;",
"arr[mid] <= y",
"arr[mid]",
"arr",
"mid",
"y",
"l = mid + 1",
"l",
"mid + 1",
"mid",
"1",
"h = mid - 1",
"h",
"mid - 1",
"mid",
"1",
"return h;",
"h",
"int arr[]",
"arr",
"int n",
"n",
"int y",
"y",
"public static StringBuilder dec_to_bin(long n) {\n // decimal to binary upto 30 binaries\n if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }\n StringBuilder str=new StringBuilder(\"\");\n while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }\n str=str.reverse();\n StringBuilder tmp_str=new StringBuilder(\"\");\n int len=str.length();\n while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }\n tmp_str.append(str);\n return tmp_str;\n }",
"dec_to_bin",
"{\n // decimal to binary upto 30 binaries\n if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }\n StringBuilder str=new StringBuilder(\"\");\n while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }\n str=str.reverse();\n StringBuilder tmp_str=new StringBuilder(\"\");\n int len=str.length();\n while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }\n tmp_str.append(str);\n return tmp_str;\n }",
"if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }",
"n==0",
"n",
"0",
"{\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }",
"StringBuilder str=new StringBuilder(\"\");",
"str",
"new StringBuilder(\"\")",
"for(int i=0;i<30;i++) {\n str.append(\"0\");\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<30",
"i",
"30",
"i++",
"i++",
"i",
"{\n str.append(\"0\");\n }",
"{\n str.append(\"0\");\n }",
"str.append(\"0\")",
"str.append",
"str",
"\"0\"",
"return str;",
"str",
"StringBuilder str=new StringBuilder(\"\");",
"str",
"new StringBuilder(\"\")",
"while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }",
"n!=0",
"n",
"0",
"{\n str.append(n%2L);\n n/=2L;\n }",
"str.append(n%2L)",
"str.append",
"str",
"n%2L",
"n",
"2L",
"n/=2L",
"n",
"2L",
"str=str.reverse()",
"str",
"str.reverse()",
"str.reverse",
"str",
"StringBuilder tmp_str=new StringBuilder(\"\");",
"tmp_str",
"new StringBuilder(\"\")",
"int len=str.length();",
"len",
"str.length()",
"str.length",
"str",
"while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }",
"len!=30",
"len",
"30",
"{\n tmp_str.append(\"0\");\n len++;\n }",
"tmp_str.append(\"0\")",
"tmp_str.append",
"tmp_str",
"\"0\"",
"len++",
"len",
"tmp_str.append(str)",
"tmp_str.append",
"tmp_str",
"str",
"return tmp_str;",
"tmp_str",
"long n",
"n",
"private static int binarySearchPM(int[] arr, int key){\n int n = arr.length;\n int mid = -1;\n int begin = 0,end=n;\n while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }\n //System.out.println(begin+\" \"+end);\n return -begin; //expected Index\n }",
"binarySearchPM",
"{\n int n = arr.length;\n int mid = -1;\n int begin = 0,end=n;\n while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }\n //System.out.println(begin+\" \"+end);\n return -begin; //expected Index\n }",
"int n = arr.length;",
"n",
"arr.length",
"arr",
"arr.length",
"int mid = -1;",
"mid",
"-1",
"1",
"int begin = 0",
"begin",
"0",
"end=n;",
"end",
"n",
"while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }",
"begin <= end",
"begin",
"end",
"{\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }",
"mid = (begin+end) / 2",
"mid",
"(begin+end) / 2",
"(begin+end)",
"begin",
"end",
"2",
"if(mid == n){\n return n;\n }",
"mid == n",
"mid",
"n",
"{\n return n;\n }",
"return n;",
"n",
"if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }",
"key < arr[mid]",
"key",
"arr[mid]",
"arr",
"mid",
"{\n end = mid-1;\n }",
"end = mid-1",
"end",
"mid-1",
"mid",
"1",
"if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }",
"key > arr[mid]",
"key",
"arr[mid]",
"arr",
"mid",
"{\n begin = mid+1;\n }",
"begin = mid+1",
"begin",
"mid+1",
"mid",
"1",
"{\n return mid;\n }",
"return mid;",
"mid",
"return -begin; //expected Index",
"-begin",
"begin",
"int[] arr",
"arr",
"int key",
"key",
"static class Reader { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }",
"Reader",
"final private int BUFFER_SIZE = 1 << 16;",
"BUFFER_SIZE",
"1 << 16",
"1",
"16",
"private DataInputStream din;",
"din",
"private byte[] buffer;",
"buffer",
"private int bufferPointer",
"bufferPointer",
"bytesRead;",
"bytesRead",
"public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n }",
"Reader",
"{ \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n }",
"din = new DataInputStream(System.in)",
"din",
"new DataInputStream(System.in)",
"buffer = new byte[BUFFER_SIZE]",
"buffer",
"new byte[BUFFER_SIZE]",
"BUFFER_SIZE",
"bufferPointer = bytesRead = 0",
"bufferPointer",
"bytesRead = 0",
"bytesRead",
"0",
"public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n }",
"Reader",
"{ \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n }",
"din = new DataInputStream(new FileInputStream(file_name))",
"din",
"new DataInputStream(new FileInputStream(file_name))",
"buffer = new byte[BUFFER_SIZE]",
"buffer",
"new byte[BUFFER_SIZE]",
"BUFFER_SIZE",
"bufferPointer = bytesRead = 0",
"bufferPointer",
"bytesRead = 0",
"bytesRead",
"0",
"String file_name",
"file_name",
"public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n }",
"readLine",
"{ \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n }",
"byte[] buf = new byte[64];",
"buf",
"new byte[64]",
"64",
"int cnt = 0",
"cnt",
"0",
"c;",
"c",
"while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n }",
"(c = read()) != -1",
"(c = read())",
"c",
"read()",
"read",
"-1",
"1",
"{ \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n }",
"if (c == '\\n') \n break;",
"c == '\\n'",
"c",
"'\\n'",
"break;",
"buf[cnt++] = (byte) c",
"buf[cnt++]",
"buf",
"cnt++",
"cnt",
"(byte) c",
"return new String(buf, 0, cnt);",
"new String(buf, 0, cnt)",
"public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n }",
"nextInt",
"{ \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n }",
"int ret = 0;",
"ret",
"0",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ') \n c = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg) \n c = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n ret = ret * 10 + c - '0'; \n }",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (neg) \n return -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n }",
"nextLong",
"{ \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n }",
"long ret = 0;",
"ret",
"0",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ') \n c = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg) \n c = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n ret = ret * 10 + c - '0'; \n }",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (neg) \n return -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n }",
"nextDouble",
"{ \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n }",
"double ret = 0",
"ret",
"0",
"div = 1;",
"div",
"1",
"byte c = read();",
"c",
"read()",
"read",
"while (c <= ' ') \n c = read();",
"c <= ' '",
"c",
"' '",
"c = read()",
"c",
"read()",
"read",
"boolean neg = (c == '-');",
"neg",
"(c == '-')",
"c",
"'-'",
"if (neg) \n c = read();",
"neg",
"c = read()",
"c",
"read()",
"read",
"do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9');",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n ret = ret * 10 + c - '0'; \n }",
"ret = ret * 10 + c - '0'",
"ret",
"ret * 10 + c - '0'",
"ret * 10 + c",
"ret * 10",
"ret",
"10",
"c",
"'0'",
"if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n }",
"c == '.'",
"c",
"'.'",
"{ \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n }",
"while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n }",
"(c = read()) >= '0' && c <= '9'",
"(c = read()) >= '0'",
"(c = read())",
"c",
"read()",
"read",
"'0'",
"c <= '9'",
"c",
"'9'",
"{ \n ret += (c - '0') / (div *= 10); \n }",
"ret += (c - '0') / (div *= 10)",
"ret",
"(c - '0') / (div *= 10)",
"(c - '0')",
"c",
"'0'",
"(div *= 10)",
"div",
"10",
"if (neg) \n return -ret;",
"neg",
"return -ret;",
"-ret",
"ret",
"return ret;",
"ret",
"private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n }",
"fillBuffer",
"{ \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n }",
"bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE)",
"bytesRead",
"din.read(buffer, bufferPointer = 0, BUFFER_SIZE)",
"din.read",
"din",
"buffer",
"bufferPointer = 0",
"bufferPointer",
"0",
"BUFFER_SIZE",
"if (bytesRead == -1) \n buffer[0] = -1;",
"bytesRead == -1",
"bytesRead",
"-1",
"1",
"buffer[0] = -1",
"buffer[0]",
"buffer",
"0",
"-1",
"1",
"private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n }",
"read",
"{ \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n }",
"if (bufferPointer == bytesRead) \n fillBuffer();",
"bufferPointer == bytesRead",
"bufferPointer",
"bytesRead",
"fillBuffer()",
"fillBuffer",
"return buffer[bufferPointer++];",
"buffer[bufferPointer++]",
"buffer",
"bufferPointer++",
"bufferPointer",
"public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n }",
"close",
"{ \n if (din == null) \n return; \n din.close(); \n }",
"if (din == null) \n return;",
"din == null",
"din",
"null",
"return;",
"din.close()",
"din.close",
"din",
"public class Main { \n \n public static void main(String[] args) throws java.lang.Exception { \n Reader pm =new Reader(); \n //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int t = 1;\n while(t-- > 0){\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }\n //end of tests\n \n }\n //end of main class\n\n static int countInRange(int arr[], int n, int x, int y) { \n // initialize result \n int count = 0; \n count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1; \n return count; \n } \n \n \n static int lowerIndex(int arr[], int n, int x) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n } \n return l; \n } \n \n // function to find last index <= y \n static int upperIndex(int arr[], int n, int y) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n } \n return h; \n }\n \n public static StringBuilder dec_to_bin(long n) {\n // decimal to binary upto 30 binaries\n if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }\n StringBuilder str=new StringBuilder(\"\");\n while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }\n str=str.reverse();\n StringBuilder tmp_str=new StringBuilder(\"\");\n int len=str.length();\n while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }\n tmp_str.append(str);\n return tmp_str;\n }\n \n private static int binarySearchPM(int[] arr, int key){\n int n = arr.length;\n int mid = -1;\n int begin = 0,end=n;\n while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }\n //System.out.println(begin+\" \"+end);\n return -begin; //expected Index\n }\n \n static class Reader { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n}",
"public class Main { \n \n public static void main(String[] args) throws java.lang.Exception { \n Reader pm =new Reader(); \n //Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int t = 1;\n while(t-- > 0){\n int x = pm.nextInt();\n int n = pm.nextInt();\n int[] a = new int[n];\n ArrayList<Integer> al = new ArrayList();\n HashSet<Integer> hs = new HashSet<>();\n for(int i=1;i<=100;i++)\n hs.add(i);\n for(int i=0;i<n;i++){\n a[i] = pm.nextInt();\n hs.remove((Integer)a[i]);\n }\n //System.out.println(hs);\n int ans = Integer.MAX_VALUE;\n int dif = Integer.MAX_VALUE;\n for(int i:hs) {\n\n int df = Math.abs(i-x);\n dif = Math.min(dif,df);\n }\n TreeSet<Integer> ts = new TreeSet<>();\n for(int i : hs) {\n int df = Math.abs(i-x);\n if(df == dif) \n ts.add(i);\n }\n int on = Math.abs(x);\n int off = Math.abs(x-101);\n int mh = Math.min(on, off);\n\n if(mh <= dif && mh == on) {\n if(mh == on)\n System.out.println(0);\n return;\n } \n if(mh < dif && mh == off) {\n System.out.println(101);\n return;\n }\n if(hs.size() == 0) {\n int min = Math.min(Math.abs(x), Math.abs(x-101));\n System.out.println(min);\n return;\n }\n System.out.println(ts.first());\n }\n //end of tests\n \n }\n //end of main class\n\n static int countInRange(int arr[], int n, int x, int y) { \n // initialize result \n int count = 0; \n count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1; \n return count; \n } \n \n \n static int lowerIndex(int arr[], int n, int x) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n } \n return l; \n } \n \n // function to find last index <= y \n static int upperIndex(int arr[], int n, int y) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n } \n return h; \n }\n \n public static StringBuilder dec_to_bin(long n) {\n // decimal to binary upto 30 binaries\n if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }\n StringBuilder str=new StringBuilder(\"\");\n while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }\n str=str.reverse();\n StringBuilder tmp_str=new StringBuilder(\"\");\n int len=str.length();\n while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }\n tmp_str.append(str);\n return tmp_str;\n }\n \n private static int binarySearchPM(int[] arr, int key){\n int n = arr.length;\n int mid = -1;\n int begin = 0,end=n;\n while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }\n //System.out.println(begin+\" \"+end);\n return -begin; //expected Index\n }\n \n static class Reader { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; // line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') / (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n}",
"Main"
]
|
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws java.lang.Exception {
Reader pm =new Reader();
//Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int t = 1;
while(t-- > 0){
int x = pm.nextInt();
int n = pm.nextInt();
int[] a = new int[n];
ArrayList<Integer> al = new ArrayList();
HashSet<Integer> hs = new HashSet<>();
for(int i=1;i<=100;i++)
hs.add(i);
for(int i=0;i<n;i++){
a[i] = pm.nextInt();
hs.remove((Integer)a[i]);
}
//System.out.println(hs);
int ans = Integer.MAX_VALUE;
int dif = Integer.MAX_VALUE;
for(int i:hs) {
int df = Math.abs(i-x);
dif = Math.min(dif,df);
}
TreeSet<Integer> ts = new TreeSet<>();
for(int i : hs) {
int df = Math.abs(i-x);
if(df == dif)
ts.add(i);
}
int on = Math.abs(x);
int off = Math.abs(x-101);
int mh = Math.min(on, off);
if(mh <= dif && mh == on) {
if(mh == on)
System.out.println(0);
return;
}
if(mh < dif && mh == off) {
System.out.println(101);
return;
}
if(hs.size() == 0) {
int min = Math.min(Math.abs(x), Math.abs(x-101));
System.out.println(min);
return;
}
System.out.println(ts.first());
}
//end of tests
}
//end of main class
static int countInRange(int arr[], int n, int x, int y) {
// initialize result
int count = 0;
count = upperIndex(arr, n, y) -
lowerIndex(arr, n, x) + 1;
return count;
}
static int lowerIndex(int arr[], int n, int x) {
int l = 0, h = n - 1;
while (l <= h)
{
int mid = (l + h) / 2;
if (arr[mid] >= x)
h = mid - 1;
else
l = mid + 1;
}
return l;
}
// function to find last index <= y
static int upperIndex(int arr[], int n, int y) {
int l = 0, h = n - 1;
while (l <= h)
{
int mid = (l + h) / 2;
if (arr[mid] <= y)
l = mid + 1;
else
h = mid - 1;
}
return h;
}
public static StringBuilder dec_to_bin(long n) {
// decimal to binary upto 30 binaries
if(n==0) {
StringBuilder str=new StringBuilder("");
for(int i=0;i<30;i++) {
str.append("0");
}
return str;
}
StringBuilder str=new StringBuilder("");
while(n!=0) {
str.append(n%2L);
n/=2L;
}
str=str.reverse();
StringBuilder tmp_str=new StringBuilder("");
int len=str.length();
while(len!=30) {
tmp_str.append("0");
len++;
}
tmp_str.append(str);
return tmp_str;
}
private static int binarySearchPM(int[] arr, int key){
int n = arr.length;
int mid = -1;
int begin = 0,end=n;
while(begin <= end){
mid = (begin+end) / 2;
if(mid == n){
return n;
}
if(key < arr[mid]){
end = mid-1;
} else if(key > arr[mid]){
begin = mid+1;
} else {
return mid;
}
}
//System.out.println(begin+" "+end);
return -begin; //expected Index
}
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public Reader(String file_name) throws IOException
{
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException
{
byte[] buf = new byte[64]; // line length
int cnt = 0, c;
while ((c = read()) != -1)
{
if (c == '\n')
break;
buf[cnt++] = (byte) c;
}
return new String(buf, 0, cnt);
}
public int nextInt() throws IOException
{
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do
{
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long nextLong() throws IOException
{
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public double nextDouble() throws IOException
{
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (c == '.')
{
while ((c = read()) >= '0' && c <= '9')
{
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
private void fillBuffer() throws IOException
{
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException
{
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException
{
if (din == null)
return;
din.close();
}
}
} |
[
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,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
14,
2,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
4,
18,
13,
2,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
13,
30,
4,
18,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
13,
13,
30,
4,
18,
13,
4,
18,
13,
13,
30,
40,
13,
4,
18,
13,
2,
4,
18,
13,
2,
13,
17,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
4,
18,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
4,
18,
13,
2,
4,
18,
13,
13,
30,
40,
13,
0,
13,
2,
13,
13,
3,
14,
2,
13,
17,
30,
0,
13,
2,
4,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
2,
4,
18,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
4,
18,
13,
2,
13,
17,
30,
40,
13,
0,
13,
2,
13,
13,
3,
14,
2,
13,
17,
30,
0,
13,
2,
4,
18,
13,
2,
4,
18,
13,
17,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
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,
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
],
[
14,
21
],
[
21,
22
],
[
21,
23
],
[
14,
24
],
[
24,
25
],
[
24,
26
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
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
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
49,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
14,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
14,
63
],
[
63,
64
],
[
63,
65
],
[
14,
66
],
[
66,
67
],
[
66,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
14,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
78,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
14,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
92,
97
],
[
14,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
98,
109
],
[
110,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
112,
117
],
[
111,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
111,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
127,
132
],
[
126,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
126,
141
],
[
141,
142
],
[
142,
143
],
[
14,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
148,
151
],
[
151,
152
],
[
151,
153
],
[
147,
154
],
[
14,
155
],
[
155,
156
],
[
155,
157
],
[
14,
158
],
[
158,
159
],
[
158,
160
],
[
14,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
168,
172
],
[
161,
173
],
[
173,
174
],
[
174,
175
],
[
161,
176
],
[
177,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
183,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
186,
190
],
[
178,
191
],
[
191,
192
],
[
192,
193
],
[
191,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
196,
198
],
[
191,
199
],
[
14,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
208,
211
],
[
207,
212
],
[
14,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
220,
224
],
[
213,
225
],
[
225,
226
],
[
226,
227
],
[
213,
228
],
[
229,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
231,
235
],
[
235,
236
],
[
236,
237
],
[
235,
238
],
[
238,
239
],
[
238,
240
],
[
230,
241
],
[
241,
242
],
[
242,
243
],
[
241,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
246,
248
],
[
241,
249
],
[
14,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
250,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
258,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
261,
265
],
[
257,
266
],
[
14,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
267,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
274,
275
],
[
274,
276
],
[
272,
277
],
[
267,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
279,
283
],
[
283,
284
],
[
283,
285
],
[
278,
286
],
[
286,
287
],
[
287,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
287,
292
],
[
278,
293
],
[
293,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
298,
299
],
[
298,
300
],
[
293,
301
],
[
301,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
302,
307
],
[
293,
308
],
[
308,
309
],
[
309,
310
],
[
310,
311
],
[
311,
312
],
[
311,
313
],
[
309,
314
],
[
12,
315
],
[
315,
316
]
]
| [
"import java.util.Scanner;\nimport java.util.ArrayList;\nimport java.util.Collections;\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n ArrayList <Integer> li = new ArrayList <Integer>();\n ArrayList <Integer> liu = new ArrayList <Integer>();\n ArrayList <Integer> lir = new ArrayList <Integer>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0;i<n;i++){\n int a = sc.nextInt();\n li.add(a);\n }\n Collections.sort(li);\n int l=0;\n int k=0;\n int m=0;\n if(li.size() == 0){\n System.out.println(x);\n System.exit(0);\n }\n liu.add(li.get(0) - 2);\n for(int i=0;i<n;i++){\n if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }\n }\n lir.add(li.get(n-1) + 2);\n int under = 0;\n int upper = 0;\n for(int i=1;i<liu.size()+1;i++){\n if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }\n }\n if(k==0){\n under=liu.get(0)-1;\n }\n for(int i=1;i<lir.size()+1;i++){\n if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }\n }\n if(m==0){\n upper=liu.get(liu.size()-1)+1;\n }\n if(l==0){\n System.out.println(x);\n }else if(x-under<upper-x){\n System.out.println(under);\n }else if(x-under>upper-x){\n System.out.println(upper);\n }else{\n System.out.println(under);\n }\n \n }\n}\n ",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n ArrayList <Integer> li = new ArrayList <Integer>();\n ArrayList <Integer> liu = new ArrayList <Integer>();\n ArrayList <Integer> lir = new ArrayList <Integer>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0;i<n;i++){\n int a = sc.nextInt();\n li.add(a);\n }\n Collections.sort(li);\n int l=0;\n int k=0;\n int m=0;\n if(li.size() == 0){\n System.out.println(x);\n System.exit(0);\n }\n liu.add(li.get(0) - 2);\n for(int i=0;i<n;i++){\n if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }\n }\n lir.add(li.get(n-1) + 2);\n int under = 0;\n int upper = 0;\n for(int i=1;i<liu.size()+1;i++){\n if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }\n }\n if(k==0){\n under=liu.get(0)-1;\n }\n for(int i=1;i<lir.size()+1;i++){\n if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }\n }\n if(m==0){\n upper=liu.get(liu.size()-1)+1;\n }\n if(l==0){\n System.out.println(x);\n }else if(x-under<upper-x){\n System.out.println(under);\n }else if(x-under>upper-x){\n System.out.println(upper);\n }else{\n System.out.println(under);\n }\n \n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n ArrayList <Integer> li = new ArrayList <Integer>();\n ArrayList <Integer> liu = new ArrayList <Integer>();\n ArrayList <Integer> lir = new ArrayList <Integer>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0;i<n;i++){\n int a = sc.nextInt();\n li.add(a);\n }\n Collections.sort(li);\n int l=0;\n int k=0;\n int m=0;\n if(li.size() == 0){\n System.out.println(x);\n System.exit(0);\n }\n liu.add(li.get(0) - 2);\n for(int i=0;i<n;i++){\n if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }\n }\n lir.add(li.get(n-1) + 2);\n int under = 0;\n int upper = 0;\n for(int i=1;i<liu.size()+1;i++){\n if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }\n }\n if(k==0){\n under=liu.get(0)-1;\n }\n for(int i=1;i<lir.size()+1;i++){\n if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }\n }\n if(m==0){\n upper=liu.get(liu.size()-1)+1;\n }\n if(l==0){\n System.out.println(x);\n }else if(x-under<upper-x){\n System.out.println(under);\n }else if(x-under>upper-x){\n System.out.println(upper);\n }else{\n System.out.println(under);\n }\n \n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n ArrayList <Integer> li = new ArrayList <Integer>();\n ArrayList <Integer> liu = new ArrayList <Integer>();\n ArrayList <Integer> lir = new ArrayList <Integer>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0;i<n;i++){\n int a = sc.nextInt();\n li.add(a);\n }\n Collections.sort(li);\n int l=0;\n int k=0;\n int m=0;\n if(li.size() == 0){\n System.out.println(x);\n System.exit(0);\n }\n liu.add(li.get(0) - 2);\n for(int i=0;i<n;i++){\n if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }\n }\n lir.add(li.get(n-1) + 2);\n int under = 0;\n int upper = 0;\n for(int i=1;i<liu.size()+1;i++){\n if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }\n }\n if(k==0){\n under=liu.get(0)-1;\n }\n for(int i=1;i<lir.size()+1;i++){\n if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }\n }\n if(m==0){\n upper=liu.get(liu.size()-1)+1;\n }\n if(l==0){\n System.out.println(x);\n }else if(x-under<upper-x){\n System.out.println(under);\n }else if(x-under>upper-x){\n System.out.println(upper);\n }else{\n System.out.println(under);\n }\n \n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"ArrayList <Integer> li = new ArrayList <Integer>();",
"li",
"new ArrayList <Integer>()",
"ArrayList <Integer> liu = new ArrayList <Integer>();",
"liu",
"new ArrayList <Integer>()",
"ArrayList <Integer> lir = new ArrayList <Integer>();",
"lir",
"new ArrayList <Integer>()",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<n;i++){\n int a = sc.nextInt();\n li.add(a);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int a = sc.nextInt();\n li.add(a);\n }",
"{\n int a = sc.nextInt();\n li.add(a);\n }",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"li.add(a)",
"li.add",
"li",
"a",
"Collections.sort(li)",
"Collections.sort",
"Collections",
"li",
"int l=0;",
"l",
"0",
"int k=0;",
"k",
"0",
"int m=0;",
"m",
"0",
"if(li.size() == 0){\n System.out.println(x);\n System.exit(0);\n }",
"li.size() == 0",
"li.size()",
"li.size",
"li",
"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",
"liu.add(li.get(0) - 2)",
"liu.add",
"liu",
"li.get(0) - 2",
"li.get(0)",
"li.get",
"li",
"0",
"2",
"for(int i=0;i<n;i++){\n if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }\n }",
"{\n if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }\n }",
"if(li.get(i)<x){\n liu.add(li.get(i));\n }else if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }",
"li.get(i)<x",
"li.get(i)",
"li.get",
"li",
"i",
"x",
"{\n liu.add(li.get(i));\n }",
"liu.add(li.get(i))",
"liu.add",
"liu",
"li.get(i)",
"li.get",
"li",
"i",
"if(li.get(i)>x){\n lir.add(li.get(i));\n }else{\n l++;\n }",
"li.get(i)>x",
"li.get(i)",
"li.get",
"li",
"i",
"x",
"{\n lir.add(li.get(i));\n }",
"lir.add(li.get(i))",
"lir.add",
"lir",
"li.get(i)",
"li.get",
"li",
"i",
"{\n l++;\n }",
"l++",
"l",
"lir.add(li.get(n-1) + 2)",
"lir.add",
"lir",
"li.get(n-1) + 2",
"li.get(n-1)",
"li.get",
"li",
"n-1",
"n",
"1",
"2",
"int under = 0;",
"under",
"0",
"int upper = 0;",
"upper",
"0",
"for(int i=1;i<liu.size()+1;i++){\n if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<liu.size()+1",
"i",
"liu.size()+1",
"liu.size()",
"liu.size",
"liu",
"1",
"i++",
"i++",
"i",
"{\n if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }\n }",
"{\n if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }\n }",
"if(x-i>liu.get(liu.size()-i)){\n k++;\n under=x-i;\n break;\n }",
"x-i>liu.get(liu.size()-i)",
"x-i",
"x",
"i",
"liu.get(liu.size()-i)",
"liu.get",
"liu",
"liu.size()-i",
"liu.size()",
"liu.size",
"liu",
"i",
"{\n k++;\n under=x-i;\n break;\n }",
"k++",
"k",
"under=x-i",
"under",
"x-i",
"x",
"i",
"break;",
"if(k==0){\n under=liu.get(0)-1;\n }",
"k==0",
"k",
"0",
"{\n under=liu.get(0)-1;\n }",
"under=liu.get(0)-1",
"under",
"liu.get(0)-1",
"liu.get(0)",
"liu.get",
"liu",
"0",
"1",
"for(int i=1;i<lir.size()+1;i++){\n if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lir.size()+1",
"i",
"lir.size()+1",
"lir.size()",
"lir.size",
"lir",
"1",
"i++",
"i++",
"i",
"{\n if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }\n }",
"{\n if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }\n }",
"if(x+i<lir.get(i-1)){\n m++;\n upper=x+i;\n break;\n }",
"x+i<lir.get(i-1)",
"x+i",
"x",
"i",
"lir.get(i-1)",
"lir.get",
"lir",
"i-1",
"i",
"1",
"{\n m++;\n upper=x+i;\n break;\n }",
"m++",
"m",
"upper=x+i",
"upper",
"x+i",
"x",
"i",
"break;",
"if(m==0){\n upper=liu.get(liu.size()-1)+1;\n }",
"m==0",
"m",
"0",
"{\n upper=liu.get(liu.size()-1)+1;\n }",
"upper=liu.get(liu.size()-1)+1",
"upper",
"liu.get(liu.size()-1)+1",
"liu.get(liu.size()-1)",
"liu.get",
"liu",
"liu.size()-1",
"liu.size()",
"liu.size",
"liu",
"1",
"1",
"if(l==0){\n System.out.println(x);\n }else if(x-under<upper-x){\n System.out.println(under);\n }else if(x-under>upper-x){\n System.out.println(upper);\n }else{\n System.out.println(under);\n }",
"l==0",
"l",
"0",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"if(x-under<upper-x){\n System.out.println(under);\n }else if(x-under>upper-x){\n System.out.println(upper);\n }else{\n System.out.println(under);\n }",
"x-under<upper-x",
"x-under",
"x",
"under",
"upper-x",
"upper",
"x",
"{\n System.out.println(under);\n }",
"System.out.println(under)",
"System.out.println",
"System.out",
"System",
"System.out",
"under",
"if(x-under>upper-x){\n System.out.println(upper);\n }else{\n System.out.println(under);\n }",
"x-under>upper-x",
"x-under",
"x",
"under",
"upper-x",
"upper",
"x",
"{\n System.out.println(upper);\n }",
"System.out.println(upper)",
"System.out.println",
"System.out",
"System",
"System.out",
"upper",
"{\n System.out.println(under);\n }",
"System.out.println(under)",
"System.out.println",
"System.out",
"System",
"System.out",
"under",
"String[] args",
"args"
]
| import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
ArrayList <Integer> li = new ArrayList <Integer>();
ArrayList <Integer> liu = new ArrayList <Integer>();
ArrayList <Integer> lir = new ArrayList <Integer>();
int x = sc.nextInt();
int n = sc.nextInt();
for(int i=0;i<n;i++){
int a = sc.nextInt();
li.add(a);
}
Collections.sort(li);
int l=0;
int k=0;
int m=0;
if(li.size() == 0){
System.out.println(x);
System.exit(0);
}
liu.add(li.get(0) - 2);
for(int i=0;i<n;i++){
if(li.get(i)<x){
liu.add(li.get(i));
}else if(li.get(i)>x){
lir.add(li.get(i));
}else{
l++;
}
}
lir.add(li.get(n-1) + 2);
int under = 0;
int upper = 0;
for(int i=1;i<liu.size()+1;i++){
if(x-i>liu.get(liu.size()-i)){
k++;
under=x-i;
break;
}
}
if(k==0){
under=liu.get(0)-1;
}
for(int i=1;i<lir.size()+1;i++){
if(x+i<lir.get(i-1)){
m++;
upper=x+i;
break;
}
}
if(m==0){
upper=liu.get(liu.size()-1)+1;
}
if(l==0){
System.out.println(x);
}else if(x-under<upper-x){
System.out.println(under);
}else if(x-under>upper-x){
System.out.println(upper);
}else{
System.out.println(under);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
0,
13,
17,
42,
17,
30,
14,
2,
4,
18,
13,
13,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
3,
14,
2,
4,
18,
13,
13,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
3,
30,
40,
13,
9,
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
],
[
114,
8
],
[
114,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
11,
19
],
[
19,
20
],
[
11,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
11,
33
],
[
33,
34
],
[
33,
35
],
[
11,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
11,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
11,
61
],
[
61,
62
],
[
61,
63
],
[
11,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
67,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
77,
83
],
[
67,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
84,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
11,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
9,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
]
| [
"\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x,y,n,j;\n\t\tx = scan.nextInt();\n\t\tn = scan.nextInt();\n\t\t\n\t\tint[] ary = new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(ary);\n\t\tj = 0;\n\t\t\n\t\twhile(true) {\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(y);\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x,y,n,j;\n\t\tx = scan.nextInt();\n\t\tn = scan.nextInt();\n\t\t\n\t\tint[] ary = new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(ary);\n\t\tj = 0;\n\t\t\n\t\twhile(true) {\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(y);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x,y,n,j;\n\t\tx = scan.nextInt();\n\t\tn = scan.nextInt();\n\t\t\n\t\tint[] ary = new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(ary);\n\t\tj = 0;\n\t\t\n\t\twhile(true) {\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(y);\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x,y,n,j;\n\t\tx = scan.nextInt();\n\t\tn = scan.nextInt();\n\t\t\n\t\tint[] ary = new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(ary);\n\t\tj = 0;\n\t\t\n\t\twhile(true) {\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(y);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int x",
"x",
"y",
"y",
"n",
"n",
"j;",
"j",
"x = scan.nextInt()",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] ary = new int[n];",
"ary",
"new int[n]",
"n",
"for(int i=0;i<n;i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tary[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tary[i] = scan.nextInt();\n\t\t}",
"ary[i] = scan.nextInt()",
"ary[i]",
"ary",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"Arrays.sort(ary)",
"Arrays.sort",
"Arrays",
"ary",
"j = 0",
"j",
"0",
"while(true) {\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}",
"true",
"{\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}",
"if(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}",
"Arrays.binarySearch(ary, x-j) < 0",
"Arrays.binarySearch(ary, x-j)",
"Arrays.binarySearch",
"Arrays",
"ary",
"x-j",
"x",
"j",
"0",
"{\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}",
"y = x-j",
"y",
"x-j",
"x",
"j",
"break;",
"if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}",
"Arrays.binarySearch(ary, x+j) < 0",
"Arrays.binarySearch(ary, x+j)",
"Arrays.binarySearch",
"Arrays",
"ary",
"x+j",
"x",
"j",
"0",
"{\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}",
"y = x+j",
"y",
"x+j",
"x",
"j",
"break;",
"{\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}",
"j++",
"j",
"continue;",
"System.out.println(y)",
"System.out.println",
"System.out",
"System",
"System.out",
"y",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x,y,n,j;\n\t\tx = scan.nextInt();\n\t\tn = scan.nextInt();\n\t\t\n\t\tint[] ary = new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(ary);\n\t\tj = 0;\n\t\t\n\t\twhile(true) {\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(y);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x,y,n,j;\n\t\tx = scan.nextInt();\n\t\tn = scan.nextInt();\n\t\t\n\t\tint[] ary = new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(ary);\n\t\tj = 0;\n\t\t\n\t\twhile(true) {\n\t\t\tif(Arrays.binarySearch(ary, x-j) < 0) {\n\t\t\t\ty = x-j;\n\t\t\t\tbreak;\n\t\t\t}else if(Arrays.binarySearch(ary, x+j) < 0) {\n\t\t\t\ty = x+j;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tj++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(y);\n\t}\n\n}",
"Main"
]
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int x,y,n,j;
x = scan.nextInt();
n = scan.nextInt();
int[] ary = new int[n];
for(int i=0;i<n;i++) {
ary[i] = scan.nextInt();
}
Arrays.sort(ary);
j = 0;
while(true) {
if(Arrays.binarySearch(ary, x-j) < 0) {
y = x-j;
break;
}else if(Arrays.binarySearch(ary, x+j) < 0) {
y = x+j;
break;
}else {
j++;
continue;
}
}
System.out.println(y);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
17,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
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,
30,
4,
18,
18,
13,
13,
4,
13,
17,
23,
13,
12,
13,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
29,
2,
13,
13,
14,
40,
4,
18,
13,
2,
13,
13,
30,
29,
2,
13,
13,
29,
4,
13,
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
],
[
114,
11
],
[
114,
12
],
[
12,
13
],
[
12,
14
],
[
114,
15
],
[
15,
16
],
[
15,
17
],
[
114,
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
],
[
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
],
[
20,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
53,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
53,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
18,
75
],
[
75,
76
],
[
114,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
80,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
79,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
77,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n static List<Integer> list = new ArrayList<Integer>();\n static int x = 0;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n x = sc.nextInt();\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if (!(list.contains(x))) {\n System.out.println(x);\n } else {\n System.out.println(dfs(1));\n }\n }\n\n private static int dfs(int n) {\n if (!(list.contains(x - n))) {\n return x - n;\n } else if (!(list.contains(x + n))) {\n return x + n;\n }\n return dfs(++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 static List<Integer> list = new ArrayList<Integer>();\n static int x = 0;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n x = sc.nextInt();\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if (!(list.contains(x))) {\n System.out.println(x);\n } else {\n System.out.println(dfs(1));\n }\n }\n\n private static int dfs(int n) {\n if (!(list.contains(x - n))) {\n return x - n;\n } else if (!(list.contains(x + n))) {\n return x + n;\n }\n return dfs(++n);\n }\n}",
"Main",
"static List<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"static int x = 0;",
"x",
"0",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n x = sc.nextInt();\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if (!(list.contains(x))) {\n System.out.println(x);\n } else {\n System.out.println(dfs(1));\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n x = sc.nextInt();\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if (!(list.contains(x))) {\n System.out.println(x);\n } else {\n System.out.println(dfs(1));\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"x = sc.nextInt()",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"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",
"if (!(list.contains(x))) {\n System.out.println(x);\n } else {\n System.out.println(dfs(1));\n }",
"!(list.contains(x))",
"(list.contains(x))",
"list.contains",
"list",
"x",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n System.out.println(dfs(1));\n }",
"System.out.println(dfs(1))",
"System.out.println",
"System.out",
"System",
"System.out",
"dfs(1)",
"dfs",
"1",
"String[] args",
"args",
"private static int dfs(int n) {\n if (!(list.contains(x - n))) {\n return x - n;\n } else if (!(list.contains(x + n))) {\n return x + n;\n }\n return dfs(++n);\n }",
"dfs",
"{\n if (!(list.contains(x - n))) {\n return x - n;\n } else if (!(list.contains(x + n))) {\n return x + n;\n }\n return dfs(++n);\n }",
"if (!(list.contains(x - n))) {\n return x - n;\n } else if (!(list.contains(x + n))) {\n return x + n;\n }",
"!(list.contains(x - n))",
"(list.contains(x - n))",
"list.contains",
"list",
"x - n",
"x",
"n",
"{\n return x - n;\n }",
"return x - n;",
"x - n",
"x",
"n",
"if (!(list.contains(x + n))) {\n return x + n;\n }",
"!(list.contains(x + n))",
"(list.contains(x + n))",
"list.contains",
"list",
"x + n",
"x",
"n",
"{\n return x + n;\n }",
"return x + n;",
"x + n",
"x",
"n",
"return dfs(++n);",
"dfs(++n)",
"dfs",
"++n",
"n",
"int n",
"n",
"public class Main {\n static List<Integer> list = new ArrayList<Integer>();\n static int x = 0;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n x = sc.nextInt();\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if (!(list.contains(x))) {\n System.out.println(x);\n } else {\n System.out.println(dfs(1));\n }\n }\n\n private static int dfs(int n) {\n if (!(list.contains(x - n))) {\n return x - n;\n } else if (!(list.contains(x + n))) {\n return x + n;\n }\n return dfs(++n);\n }\n}",
"public class Main {\n static List<Integer> list = new ArrayList<Integer>();\n static int x = 0;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n x = sc.nextInt();\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n list.add(sc.nextInt());\n }\n if (!(list.contains(x))) {\n System.out.println(x);\n } else {\n System.out.println(dfs(1));\n }\n }\n\n private static int dfs(int n) {\n if (!(list.contains(x - n))) {\n return x - n;\n } else if (!(list.contains(x + n))) {\n return x + n;\n }\n return dfs(++n);\n }\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
static List<Integer> list = new ArrayList<Integer>();
static int x = 0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
x = sc.nextInt();
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
if (!(list.contains(x))) {
System.out.println(x);
} else {
System.out.println(dfs(1));
}
}
private static int dfs(int n) {
if (!(list.contains(x - n))) {
return x - n;
} else if (!(list.contains(x + n))) {
return x + n;
}
return dfs(++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,
17,
42,
17,
30,
14,
2,
4,
18,
4,
18,
13,
13,
2,
13,
13,
4,
18,
4,
18,
13,
13,
2,
13,
13,
30,
40,
13,
9,
30,
3,
14,
4,
18,
4,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
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
],
[
112,
8
],
[
112,
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
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
57,
63
],
[
63,
64
],
[
63,
65
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
66,
72
],
[
72,
73
],
[
72,
74
],
[
55,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
55,
79
],
[
79,
80
],
[
11,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
82,
88
],
[
88,
89
],
[
88,
90
],
[
81,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
81,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
106,
108
],
[
9,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint x = in.nextInt();\n\t\tint n = in.nextInt();\n\t\tInteger a[] = new Integer[n];\n\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\n\t\tint c = 0;\n\n\n\t\twhile(true) {\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(Arrays.asList(a).contains(x-c)) {\n\t\t\tSystem.out.println(x+c);\n\t\t}else {\n\t\t\tSystem.out.println(x-c);\n\t\t}\n\n\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint x = in.nextInt();\n\t\tint n = in.nextInt();\n\t\tInteger a[] = new Integer[n];\n\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\n\t\tint c = 0;\n\n\n\t\twhile(true) {\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(Arrays.asList(a).contains(x-c)) {\n\t\t\tSystem.out.println(x+c);\n\t\t}else {\n\t\t\tSystem.out.println(x-c);\n\t\t}\n\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint x = in.nextInt();\n\t\tint n = in.nextInt();\n\t\tInteger a[] = new Integer[n];\n\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\n\t\tint c = 0;\n\n\n\t\twhile(true) {\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(Arrays.asList(a).contains(x-c)) {\n\t\t\tSystem.out.println(x+c);\n\t\t}else {\n\t\t\tSystem.out.println(x-c);\n\t\t}\n\n\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint x = in.nextInt();\n\t\tint n = in.nextInt();\n\t\tInteger a[] = new Integer[n];\n\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\n\t\tint c = 0;\n\n\n\t\twhile(true) {\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(Arrays.asList(a).contains(x-c)) {\n\t\t\tSystem.out.println(x+c);\n\t\t}else {\n\t\t\tSystem.out.println(x-c);\n\t\t}\n\n\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int x = in.nextInt();",
"x",
"in.nextInt()",
"in.nextInt",
"in",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"Integer a[] = new Integer[n];",
"a",
"new Integer[n]",
"n",
"for(int i=0;i<n;i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"a[i] = in.nextInt()",
"a[i]",
"a",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int c = 0;",
"c",
"0",
"while(true) {\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"true",
"{\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}",
"Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)",
"Arrays.asList(a).contains(x-c)",
"Arrays.asList(a).contains",
"Arrays.asList(a)",
"Arrays.asList",
"Arrays",
"a",
"x-c",
"x",
"c",
"Arrays.asList(a).contains(x+c)",
"Arrays.asList(a).contains",
"Arrays.asList(a)",
"Arrays.asList",
"Arrays",
"a",
"x+c",
"x",
"c",
"{\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}",
"c++",
"c",
"continue;",
"{\n\t\t\t\tbreak;\n\t\t\t}",
"break;",
"if(Arrays.asList(a).contains(x-c)) {\n\t\t\tSystem.out.println(x+c);\n\t\t}else {\n\t\t\tSystem.out.println(x-c);\n\t\t}",
"Arrays.asList(a).contains(x-c)",
"Arrays.asList(a).contains",
"Arrays.asList(a)",
"Arrays.asList",
"Arrays",
"a",
"x-c",
"x",
"c",
"{\n\t\t\tSystem.out.println(x+c);\n\t\t}",
"System.out.println(x+c)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+c",
"x",
"c",
"{\n\t\t\tSystem.out.println(x-c);\n\t\t}",
"System.out.println(x-c)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-c",
"x",
"c",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint x = in.nextInt();\n\t\tint n = in.nextInt();\n\t\tInteger a[] = new Integer[n];\n\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\n\t\tint c = 0;\n\n\n\t\twhile(true) {\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(Arrays.asList(a).contains(x-c)) {\n\t\t\tSystem.out.println(x+c);\n\t\t}else {\n\t\t\tSystem.out.println(x-c);\n\t\t}\n\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint x = in.nextInt();\n\t\tint n = in.nextInt();\n\t\tInteger a[] = new Integer[n];\n\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\n\t\tint c = 0;\n\n\n\t\twhile(true) {\n\t\t\tif(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {\n\t\t\t\tc++;\n\t\t\t\tcontinue;\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(Arrays.asList(a).contains(x-c)) {\n\t\t\tSystem.out.println(x+c);\n\t\t}else {\n\t\t\tSystem.out.println(x-c);\n\t\t}\n\n\n\t}\n\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int n = in.nextInt();
Integer a[] = new Integer[n];
for(int i=0;i<n;i++) {
a[i] = in.nextInt();
}
int c = 0;
while(true) {
if(Arrays.asList(a).contains(x-c)&&Arrays.asList(a).contains(x+c)) {
c++;
continue;
}else {
break;
}
}
if(Arrays.asList(a).contains(x-c)) {
System.out.println(x+c);
}else {
System.out.println(x-c);
}
}
}
|
[
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,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
40,
17,
14,
4,
18,
13,
30,
0,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
40,
4,
18,
13,
13,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
120,
11
],
[
120,
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
],
[
48,
49
],
[
47,
50
],
[
50,
51
],
[
51,
52
],
[
14,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
14,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
90,
91
],
[
90,
92
],
[
86,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
79,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
14,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
14,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
14,
114
],
[
114,
115
],
[
115,
116
],
[
12,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
]
| [
"\nimport java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\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 max = 105;\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(sc.nextInt());\n }\n\n int ans = -1;\n if (set.isEmpty()) {\n ans = x;\n } else {\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }\n System.out.println(ans);\n System.out.flush();\n sc.close();\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 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 max = 105;\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(sc.nextInt());\n }\n\n int ans = -1;\n if (set.isEmpty()) {\n ans = x;\n } else {\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }\n System.out.println(ans);\n System.out.flush();\n sc.close();\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 max = 105;\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(sc.nextInt());\n }\n\n int ans = -1;\n if (set.isEmpty()) {\n ans = x;\n } else {\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }\n System.out.println(ans);\n System.out.flush();\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int max = 105;\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(sc.nextInt());\n }\n\n int ans = -1;\n if (set.isEmpty()) {\n ans = x;\n } else {\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }\n System.out.println(ans);\n System.out.flush();\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",
"int max = 105;",
"max",
"105",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"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 = -1;",
"ans",
"-1",
"1",
"if (set.isEmpty()) {\n ans = x;\n } else {\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }",
"set.isEmpty()",
"set.isEmpty",
"set",
"{\n ans = x;\n }",
"ans = x",
"ans",
"x",
"{\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }",
"for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= max",
"i",
"max",
"i++",
"i++",
"i",
"{\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }",
"{\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }",
"if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }",
"!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)",
"!set.contains(i)",
"set.contains(i)",
"set.contains",
"set",
"i",
"Math.abs(ans - x) > Math.abs(i - x)",
"Math.abs(ans - x)",
"Math.abs",
"Math",
"ans - x",
"ans",
"x",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"{\n ans = i;\n }",
"ans = i",
"ans",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"System.out.flush()",
"System.out.flush",
"System.out",
"System",
"System.out",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n int max = 105;\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(sc.nextInt());\n }\n\n int ans = -1;\n if (set.isEmpty()) {\n ans = x;\n } else {\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }\n System.out.println(ans);\n System.out.flush();\n sc.close();\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 max = 105;\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(sc.nextInt());\n }\n\n int ans = -1;\n if (set.isEmpty()) {\n ans = x;\n } else {\n for (int i = 0; i <= max; i++) {\n if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {\n ans = i;\n }\n }\n }\n System.out.println(ans);\n System.out.flush();\n sc.close();\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();
int max = 105;
Set<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
set.add(sc.nextInt());
}
int ans = -1;
if (set.isEmpty()) {
ans = x;
} else {
for (int i = 0; i <= max; i++) {
if (!set.contains(i) && Math.abs(ans - x) > Math.abs(i - x)) {
ans = i;
}
}
}
System.out.println(ans);
System.out.flush();
sc.close();
}
}
|
[
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,
0,
18,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
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,
3,
14,
2,
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
],
[
101,
8
],
[
101,
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
],
[
45,
46
],
[
46,
47
],
[
42,
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
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
63,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
70,
79
],
[
61,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
88,
97
],
[
9,
98
],
[
98,
99
],
[
0,
100
],
[
100,
101
],
[
100,
102
]
]
| [
"import java.util.*;\nimport java.lang.*;\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 boolean p[]=new boolean[102];\n for(int i=0; i<N; i++){\n p[sc.nextInt()]=true;\n }\n \n for(int i=0; i<51; i++){\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\n }\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"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 boolean p[]=new boolean[102];\n for(int i=0; i<N; i++){\n p[sc.nextInt()]=true;\n }\n \n for(int i=0; i<51; i++){\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\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 boolean p[]=new boolean[102];\n for(int i=0; i<N; i++){\n p[sc.nextInt()]=true;\n }\n \n for(int i=0; i<51; i++){\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\n }\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int X=sc.nextInt();\n int N=sc.nextInt();\n boolean p[]=new boolean[102];\n for(int i=0; i<N; i++){\n p[sc.nextInt()]=true;\n }\n \n for(int i=0; i<51; i++){\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\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",
"boolean p[]=new boolean[102];",
"p",
"new boolean[102]",
"102",
"for(int i=0; i<N; i++){\n p[sc.nextInt()]=true;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n p[sc.nextInt()]=true;\n }",
"{\n p[sc.nextInt()]=true;\n }",
"p[sc.nextInt()]=true",
"p[sc.nextInt()]",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"true",
"for(int i=0; i<51; i++){\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<51",
"i",
"51",
"i++",
"i++",
"i",
"{\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\n }\n }",
"{\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\n }\n }",
"if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }",
"p[X-i]==false",
"p[X-i]",
"p",
"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(p[X+i]==false){\n System.out.println(X+i);\n break;\n }",
"p[X+i]==false",
"p[X+i]",
"p",
"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 N=sc.nextInt();\n boolean p[]=new boolean[102];\n for(int i=0; i<N; i++){\n p[sc.nextInt()]=true;\n }\n \n for(int i=0; i<51; i++){\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\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 boolean p[]=new boolean[102];\n for(int i=0; i<N; i++){\n p[sc.nextInt()]=true;\n }\n \n for(int i=0; i<51; i++){\n if(p[X-i]==false){\n System.out.println(X-i);\n break;\n }\n if(p[X+i]==false){\n System.out.println(X+i);\n break;\n }\n }\n }\n}",
"Main"
]
| import java.util.*;
import java.lang.*;
public class Main{
public static void main(String[]args){
Scanner sc = new Scanner(System.in);
int X=sc.nextInt();
int N=sc.nextInt();
boolean p[]=new boolean[102];
for(int i=0; i<N; i++){
p[sc.nextInt()]=true;
}
for(int i=0; i<51; i++){
if(p[X-i]==false){
System.out.println(X-i);
break;
}
if(p[X+i]==false){
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,
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,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
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,
29,
14,
40,
4,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
125,
11
],
[
125,
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
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
65,
72
],
[
14,
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
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
85,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
112,
121
],
[
12,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
]
| [
"import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\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[] p = new int[n];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n set.add(p[i]);\n }\n if (n == 0) {\n System.out.println(x);\n return;\n }\n for (int i = 0; i <= 100; i++) {\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\n }\n }\n }\n\n}",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n 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 Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n set.add(p[i]);\n }\n if (n == 0) {\n System.out.println(x);\n return;\n }\n for (int i = 0; i <= 100; i++) {\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\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 n = sc.nextInt();\n int[] p = new int[n];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n set.add(p[i]);\n }\n if (n == 0) {\n System.out.println(x);\n return;\n }\n for (int i = 0; i <= 100; i++) {\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\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 Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n set.add(p[i]);\n }\n if (n == 0) {\n System.out.println(x);\n return;\n }\n for (int i = 0; i <= 100; i++) {\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\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",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n set.add(p[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i] = sc.nextInt();\n set.add(p[i]);\n }",
"{\n p[i] = sc.nextInt();\n set.add(p[i]);\n }",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"set.add(p[i])",
"set.add",
"set",
"p[i]",
"p",
"i",
"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 <= 100; i++) {\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\n }\n }",
"{\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\n }\n }",
"if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }",
"!set.contains(x - i)",
"set.contains(x - i)",
"set.contains",
"set",
"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 (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\n }",
"!set.contains(x + i)",
"set.contains(x + i)",
"set.contains",
"set",
"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\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 Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n set.add(p[i]);\n }\n if (n == 0) {\n System.out.println(x);\n return;\n }\n for (int i = 0; i <= 100; i++) {\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\n }\n }\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[] p = new int[n];\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n p[i] = sc.nextInt();\n set.add(p[i]);\n }\n if (n == 0) {\n System.out.println(x);\n return;\n }\n for (int i = 0; i <= 100; i++) {\n if (!set.contains(x - i)) {\n System.out.println(x - i);\n return;\n }\n if (!set.contains(x + i)) {\n System.out.println(x + i);\n return;\n }\n }\n }\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();
int[] p = new int[n];
Set<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
p[i] = sc.nextInt();
set.add(p[i]);
}
if (n == 0) {
System.out.println(x);
return;
}
for (int i = 0; i <= 100; i++) {
if (!set.contains(x - i)) {
System.out.println(x - i);
return;
}
if (!set.contains(x + i)) {
System.out.println(x + i);
return;
}
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
41,
13,
41,
13,
17,
41,
13,
39,
17,
40,
17,
17,
17,
41,
13,
39,
17,
17,
40,
17,
17,
41,
13,
41,
13,
39,
40,
17,
17,
40,
17,
17,
41,
13,
39,
17,
17,
40,
17,
40,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
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,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
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,
4,
18,
13,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
14,
2,
2,
2,
2,
13,
17,
2,
13,
13,
2,
13,
17,
2,
13,
13,
30,
29,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
2,
18,
13,
13,
13,
41,
13,
2,
18,
13,
13,
13,
14,
2,
4,
13,
13,
13,
40,
18,
18,
13,
13,
13,
30,
40,
13,
0,
18,
18,
13,
13,
13,
17,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
2,
13,
17,
17,
23,
13,
12,
13,
30,
41,
13,
13,
0,
13,
13,
0,
13,
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
],
[
362,
11
],
[
362,
12
],
[
12,
13
],
[
12,
14
],
[
362,
15
],
[
15,
16
],
[
15,
17
],
[
362,
18
],
[
18,
19
],
[
362,
20
],
[
20,
21
],
[
20,
22
],
[
362,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
25,
29
],
[
25,
30
],
[
362,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
33,
35
],
[
33,
36
],
[
36,
37
],
[
33,
38
],
[
362,
39
],
[
39,
40
],
[
362,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
43,
47
],
[
47,
48
],
[
43,
49
],
[
362,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
52,
55
],
[
55,
56
],
[
52,
57
],
[
57,
58
],
[
362,
59
],
[
59,
60
],
[
362,
61
],
[
61,
62
],
[
362,
63
],
[
63,
64
],
[
362,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
67,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
78,
79
],
[
78,
80
],
[
67,
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
],
[
94,
97
],
[
97,
98
],
[
98,
99
],
[
94,
100
],
[
67,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
67,
106
],
[
106,
107
],
[
106,
108
],
[
67,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
109,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
123,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
133,
134
],
[
133,
135
],
[
129,
136
],
[
122,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
143,
144
],
[
143,
145
],
[
137,
146
],
[
146,
147
],
[
146,
148
],
[
67,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
67,
153
],
[
153,
154
],
[
154,
155
],
[
65,
156
],
[
156,
157
],
[
362,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
164,
163
],
[
171,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
168,
170
],
[
171,
171
],
[
171,
172
],
[
171,
173
],
[
164,
174
],
[
174,
175
],
[
174,
176
],
[
161,
177
],
[
177,
178
],
[
178,
179
],
[
160,
180
],
[
180,
181
],
[
158,
182
],
[
182,
183
],
[
158,
184
],
[
184,
185
],
[
362,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
189,
194
],
[
194,
195
],
[
194,
196
],
[
189,
197
],
[
197,
198
],
[
198,
199
],
[
189,
200
],
[
201,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
204,
208
],
[
201,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
211,
215
],
[
201,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
218,
221
],
[
217,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
223,
227
],
[
216,
228
],
[
228,
229
],
[
229,
230
],
[
228,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
231,
237
],
[
228,
238
],
[
238,
239
],
[
238,
240
],
[
238,
241
],
[
186,
242
],
[
242,
243
],
[
186,
244
],
[
244,
245
],
[
362,
246
],
[
246,
247
],
[
246,
248
],
[
248,
249
],
[
249,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
250,
254
],
[
246,
255
],
[
255,
256
],
[
362,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
259,
263
],
[
263,
264
],
[
263,
265
],
[
259,
266
],
[
266,
267
],
[
266,
268
],
[
257,
269
],
[
269,
270
],
[
257,
271
],
[
271,
272
],
[
362,
273
],
[
273,
274
],
[
273,
275
],
[
275,
276
],
[
273,
277
],
[
277,
278
],
[
273,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
273,
285
],
[
285,
286
],
[
285,
287
],
[
287,
288
],
[
288,
289
],
[
289,
290
],
[
290,
291
],
[
290,
292
],
[
289,
293
],
[
293,
294
],
[
294,
295
],
[
295,
296
],
[
288,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
299,
301
],
[
301,
302
],
[
302,
303
],
[
303,
304
],
[
298,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
287,
309
],
[
309,
310
],
[
310,
311
],
[
311,
312
],
[
273,
313
],
[
313,
314
],
[
313,
315
],
[
315,
316
],
[
316,
317
],
[
317,
318
],
[
318,
319
],
[
317,
320
],
[
320,
321
],
[
273,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
325,
326
],
[
326,
327
],
[
327,
328
],
[
326,
329
],
[
329,
330
],
[
273,
331
],
[
331,
332
],
[
331,
333
],
[
333,
334
],
[
334,
335
],
[
335,
336
],
[
336,
337
],
[
335,
338
],
[
338,
339
],
[
273,
340
],
[
340,
341
],
[
340,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
342,
346
],
[
346,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
350,
351
],
[
351,
352
],
[
346,
353
],
[
353,
354
],
[
354,
355
],
[
354,
356
],
[
356,
357
],
[
357,
358
],
[
342,
359
],
[
359,
360
],
[
0,
361
],
[
361,
362
],
[
361,
363
]
]
| [
"import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n\n\n\n\npublic class Main {\n\n static MyScanner in = new MyScanner();\n static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n int N;\n static int max = 200001;\n static int [] dr = {1,-1,0,0};\n static int [] dc={0,0,-1,1};\n static boolean [][] grid;\n static int [] bishopr = {-1,1,-1,1};\n static int [] bishopc = {1,1,-1,-1};\n static long H,W,cnt;\n public static void main(String args[]) throws IOException {\n int X = in.nextInt();\n int N = in.nextInt();\n BitSet bs = new BitSet();\n for(int i=0;i<N;i++){\n bs.set(in.nextInt(),true);\n }\n int min = Integer.MAX_VALUE;\n int index =0;\n for(int i=0;i<=200;i++){\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }\n out.println(index);\n\n out.flush();\n }\n static boolean isValid (int r, int c){\n if(r>=0&&r<H&&c>=0&&c<W){\n return true;\n }\n return false;\n }\n private static void dfs(int r, int c) {\n for(int i=0;i<4;i++){\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }\n }\n\n static boolean isEven(long a) {\n return (a&1)==0;\n }\n static void swap (int a, int b){\n\n int temmp = b;\n b=a;\n a = temmp;\n }\n \n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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 \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.math.*;",
"math.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n static MyScanner in = new MyScanner();\n static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n int N;\n static int max = 200001;\n static int [] dr = {1,-1,0,0};\n static int [] dc={0,0,-1,1};\n static boolean [][] grid;\n static int [] bishopr = {-1,1,-1,1};\n static int [] bishopc = {1,1,-1,-1};\n static long H,W,cnt;\n public static void main(String args[]) throws IOException {\n int X = in.nextInt();\n int N = in.nextInt();\n BitSet bs = new BitSet();\n for(int i=0;i<N;i++){\n bs.set(in.nextInt(),true);\n }\n int min = Integer.MAX_VALUE;\n int index =0;\n for(int i=0;i<=200;i++){\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }\n out.println(index);\n\n out.flush();\n }\n static boolean isValid (int r, int c){\n if(r>=0&&r<H&&c>=0&&c<W){\n return true;\n }\n return false;\n }\n private static void dfs(int r, int c) {\n for(int i=0;i<4;i++){\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }\n }\n\n static boolean isEven(long a) {\n return (a&1)==0;\n }\n static void swap (int a, int b){\n\n int temmp = b;\n b=a;\n a = temmp;\n }\n \n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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 \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"Main",
"static MyScanner in = new MyScanner();",
"in",
"new MyScanner()",
"static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));",
"out",
"new PrintWriter(new OutputStreamWriter(System.out))",
"int N;",
"N",
"static int max = 200001;",
"max",
"200001",
"static int [] dr = {1,-1,0,0};",
"dr",
"{1,-1,0,0}",
"1",
"-1",
"1",
"0",
"0",
"static int [] dc={0,0,-1,1};",
"dc",
"{0,0,-1,1}",
"0",
"0",
"-1",
"1",
"1",
"static boolean [][] grid;",
"grid",
"static int [] bishopr = {-1,1,-1,1};",
"bishopr",
"{-1,1,-1,1}",
"-1",
"1",
"1",
"-1",
"1",
"1",
"static int [] bishopc = {1,1,-1,-1};",
"bishopc",
"{1,1,-1,-1}",
"1",
"1",
"-1",
"1",
"-1",
"1",
"static long H",
"H",
"W",
"W",
"cnt;",
"cnt",
"public static void main(String args[]) throws IOException {\n int X = in.nextInt();\n int N = in.nextInt();\n BitSet bs = new BitSet();\n for(int i=0;i<N;i++){\n bs.set(in.nextInt(),true);\n }\n int min = Integer.MAX_VALUE;\n int index =0;\n for(int i=0;i<=200;i++){\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }\n out.println(index);\n\n out.flush();\n }",
"main",
"{\n int X = in.nextInt();\n int N = in.nextInt();\n BitSet bs = new BitSet();\n for(int i=0;i<N;i++){\n bs.set(in.nextInt(),true);\n }\n int min = Integer.MAX_VALUE;\n int index =0;\n for(int i=0;i<=200;i++){\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }\n out.println(index);\n\n out.flush();\n }",
"int X = in.nextInt();",
"X",
"in.nextInt()",
"in.nextInt",
"in",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"BitSet bs = new BitSet();",
"bs",
"new BitSet()",
"for(int i=0;i<N;i++){\n bs.set(in.nextInt(),true);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n bs.set(in.nextInt(),true);\n }",
"{\n bs.set(in.nextInt(),true);\n }",
"bs.set(in.nextInt(),true)",
"bs.set",
"bs",
"in.nextInt()",
"in.nextInt",
"in",
"true",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int index =0;",
"index",
"0",
"for(int i=0;i<=200;i++){\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }",
"{\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }",
"if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }",
"!bs.get(i)&&Math.abs(X-i)<min",
"!bs.get(i)",
"bs.get(i)",
"bs.get",
"bs",
"i",
"Math.abs(X-i)<min",
"Math.abs(X-i)",
"Math.abs",
"Math",
"X-i",
"X",
"i",
"min",
"{\n min = Math.abs(X-i);\n index = i;\n }",
"min = Math.abs(X-i)",
"min",
"Math.abs(X-i)",
"Math.abs",
"Math",
"X-i",
"X",
"i",
"index = i",
"index",
"i",
"out.println(index)",
"out.println",
"out",
"index",
"out.flush()",
"out.flush",
"out",
"String args[]",
"args",
"static boolean isValid (int r, int c){\n if(r>=0&&r<H&&c>=0&&c<W){\n return true;\n }\n return false;\n }",
"isValid",
"{\n if(r>=0&&r<H&&c>=0&&c<W){\n return true;\n }\n return false;\n }",
"if(r>=0&&r<H&&c>=0&&c<W){\n return true;\n }",
"r>=0&&r<H&&c>=0&&c<W",
"c>=0",
"r>=0&&r<H&&c>=0&&c<W",
"r>=0",
"r",
"0",
"r<H",
"r",
"H",
"c>=0",
"c",
"0",
"c<W",
"c",
"W",
"{\n return true;\n }",
"return true;",
"true",
"return false;",
"false",
"int r",
"r",
"int c",
"c",
"private static void dfs(int r, int c) {\n for(int i=0;i<4;i++){\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }\n }",
"dfs",
"{\n for(int i=0;i<4;i++){\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }\n }",
"for(int i=0;i<4;i++){\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<4",
"i",
"4",
"i++",
"i++",
"i",
"{\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }",
"{\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }",
"int nr = bishopr[i] +r;",
"nr",
"bishopr[i] +r",
"bishopr[i]",
"bishopr",
"i",
"r",
"int nc = bishopc[i]+c;",
"nc",
"bishopc[i]+c",
"bishopc[i]",
"bishopc",
"i",
"c",
"if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }",
"isValid(nr, nc)&&!grid[nr][nc]",
"isValid(nr, nc)",
"isValid",
"nr",
"nc",
"!grid[nr][nc]",
"grid[nr][nc]",
"grid[nr]",
"grid",
"nr",
"nc",
"{\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }",
"cnt++",
"cnt",
"grid[nr][nc] = true",
"grid[nr][nc]",
"grid[nr]",
"grid",
"nr",
"nc",
"true",
"dfs(nr, nc)",
"dfs",
"nr",
"nc",
"int r",
"r",
"int c",
"c",
"static boolean isEven(long a) {\n return (a&1)==0;\n }",
"isEven",
"{\n return (a&1)==0;\n }",
"return (a&1)==0;",
"(a&1)==0",
"(a&1)",
"a",
"1",
"0",
"long a",
"a",
"static void swap (int a, int b){\n\n int temmp = b;\n b=a;\n a = temmp;\n }",
"swap",
"{\n\n int temmp = b;\n b=a;\n a = temmp;\n }",
"int temmp = b;",
"temmp",
"b",
"b=a",
"b",
"a",
"a = temmp",
"a",
"temmp",
"int a",
"a",
"int b",
"b",
"public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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 \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }",
"MyScanner",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }",
"MyScanner",
"{\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 } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"nextLine",
"{\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"String str = \"\";",
"str",
"\"\"",
"try {\n str = 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 str = br.readLine();\n }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main {\n\n static MyScanner in = new MyScanner();\n static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n int N;\n static int max = 200001;\n static int [] dr = {1,-1,0,0};\n static int [] dc={0,0,-1,1};\n static boolean [][] grid;\n static int [] bishopr = {-1,1,-1,1};\n static int [] bishopc = {1,1,-1,-1};\n static long H,W,cnt;\n public static void main(String args[]) throws IOException {\n int X = in.nextInt();\n int N = in.nextInt();\n BitSet bs = new BitSet();\n for(int i=0;i<N;i++){\n bs.set(in.nextInt(),true);\n }\n int min = Integer.MAX_VALUE;\n int index =0;\n for(int i=0;i<=200;i++){\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }\n out.println(index);\n\n out.flush();\n }\n static boolean isValid (int r, int c){\n if(r>=0&&r<H&&c>=0&&c<W){\n return true;\n }\n return false;\n }\n private static void dfs(int r, int c) {\n for(int i=0;i<4;i++){\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }\n }\n\n static boolean isEven(long a) {\n return (a&1)==0;\n }\n static void swap (int a, int b){\n\n int temmp = b;\n b=a;\n a = temmp;\n }\n \n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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 \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"public class Main {\n\n static MyScanner in = new MyScanner();\n static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n int N;\n static int max = 200001;\n static int [] dr = {1,-1,0,0};\n static int [] dc={0,0,-1,1};\n static boolean [][] grid;\n static int [] bishopr = {-1,1,-1,1};\n static int [] bishopc = {1,1,-1,-1};\n static long H,W,cnt;\n public static void main(String args[]) throws IOException {\n int X = in.nextInt();\n int N = in.nextInt();\n BitSet bs = new BitSet();\n for(int i=0;i<N;i++){\n bs.set(in.nextInt(),true);\n }\n int min = Integer.MAX_VALUE;\n int index =0;\n for(int i=0;i<=200;i++){\n if(!bs.get(i)&&Math.abs(X-i)<min){\n min = Math.abs(X-i);\n index = i;\n }\n }\n out.println(index);\n\n out.flush();\n }\n static boolean isValid (int r, int c){\n if(r>=0&&r<H&&c>=0&&c<W){\n return true;\n }\n return false;\n }\n private static void dfs(int r, int c) {\n for(int i=0;i<4;i++){\n int nr = bishopr[i] +r;\n int nc = bishopc[i]+c;\n if(isValid(nr, nc)&&!grid[nr][nc]){\n cnt++;\n grid[nr][nc] = true;\n dfs(nr, nc);\n }\n }\n }\n\n static boolean isEven(long a) {\n return (a&1)==0;\n }\n static void swap (int a, int b){\n\n int temmp = b;\n b=a;\n a = temmp;\n }\n \n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\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 \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n }\n}",
"Main"
]
| import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
static MyScanner in = new MyScanner();
static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
int N;
static int max = 200001;
static int [] dr = {1,-1,0,0};
static int [] dc={0,0,-1,1};
static boolean [][] grid;
static int [] bishopr = {-1,1,-1,1};
static int [] bishopc = {1,1,-1,-1};
static long H,W,cnt;
public static void main(String args[]) throws IOException {
int X = in.nextInt();
int N = in.nextInt();
BitSet bs = new BitSet();
for(int i=0;i<N;i++){
bs.set(in.nextInt(),true);
}
int min = Integer.MAX_VALUE;
int index =0;
for(int i=0;i<=200;i++){
if(!bs.get(i)&&Math.abs(X-i)<min){
min = Math.abs(X-i);
index = i;
}
}
out.println(index);
out.flush();
}
static boolean isValid (int r, int c){
if(r>=0&&r<H&&c>=0&&c<W){
return true;
}
return false;
}
private static void dfs(int r, int c) {
for(int i=0;i<4;i++){
int nr = bishopr[i] +r;
int nc = bishopc[i]+c;
if(isValid(nr, nc)&&!grid[nr][nc]){
cnt++;
grid[nr][nc] = true;
dfs(nr, nc);
}
}
}
static boolean isEven(long a) {
return (a&1)==0;
}
static void swap (int a, int b){
int temmp = b;
b=a;
a = temmp;
}
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
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,
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,
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
]
| [
[
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
],
[
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
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
58,
67
],
[
49,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
76,
85
],
[
49,
86
],
[
86,
87
],
[
6,
88
],
[
88,
89
]
]
| [
"\nimport java.util.*;\n\nclass Main {\n\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\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\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\t\t\n\t\t\n\t}\n\n}\n\n",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\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\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\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\t\t\n\t\t\n\t}\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\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\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\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\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\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\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",
"ArrayList<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"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",
"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"
]
|
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();
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i=0; i<N; i++) {
list.add(sc.nextInt());
}
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,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
42,
2,
40,
13,
17,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
42,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
40,
13,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
14,
40,
4,
18,
13,
2,
13,
13,
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
],
[
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
],
[
29,
32
],
[
28,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
37,
38
],
[
38,
39
],
[
11,
40
],
[
40,
41
],
[
40,
42
],
[
11,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
48,
49
],
[
48,
50
],
[
44,
51
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
54,
55
],
[
54,
56
],
[
43,
57
],
[
57,
58
],
[
58,
59
],
[
11,
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
],
[
60,
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
],
[
9,
94
],
[
94,
95
],
[
0,
96
],
[
96,
97
],
[
96,
98
]
]
| [
"import java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Main {\n\t\n\n\t\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner s = new Scanner(System.in);\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\t\t\n\t\tHashSet<Integer> h = new HashSet<>();\n\t\twhile(n--!=0) {\n\t\t\th.add(s.nextInt());\n\t\t}\n\t\t\n\t\tint t=0;\n\t\twhile(h.contains(x-t) && h.contains(x+t)) {\n\t\t\tt++;\n\t\t}\n\t\t\n\t\tif(!h.contains(x-t)) {\n\t\t\tSystem.out.println(x-t);\n\t\t}\n\t\telse if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+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\t\n\n\t\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner s = new Scanner(System.in);\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\t\t\n\t\tHashSet<Integer> h = new HashSet<>();\n\t\twhile(n--!=0) {\n\t\t\th.add(s.nextInt());\n\t\t}\n\t\t\n\t\tint t=0;\n\t\twhile(h.contains(x-t) && h.contains(x+t)) {\n\t\t\tt++;\n\t\t}\n\t\t\n\t\tif(!h.contains(x-t)) {\n\t\t\tSystem.out.println(x-t);\n\t\t}\n\t\telse if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+t);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t\n\t\tScanner s = new Scanner(System.in);\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\t\t\n\t\tHashSet<Integer> h = new HashSet<>();\n\t\twhile(n--!=0) {\n\t\t\th.add(s.nextInt());\n\t\t}\n\t\t\n\t\tint t=0;\n\t\twhile(h.contains(x-t) && h.contains(x+t)) {\n\t\t\tt++;\n\t\t}\n\t\t\n\t\tif(!h.contains(x-t)) {\n\t\t\tSystem.out.println(x-t);\n\t\t}\n\t\telse if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+t);\n\t\t}\n\t}",
"main",
"{\n\t\t\n\t\tScanner s = new Scanner(System.in);\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\t\t\n\t\tHashSet<Integer> h = new HashSet<>();\n\t\twhile(n--!=0) {\n\t\t\th.add(s.nextInt());\n\t\t}\n\t\t\n\t\tint t=0;\n\t\twhile(h.contains(x-t) && h.contains(x+t)) {\n\t\t\tt++;\n\t\t}\n\t\t\n\t\tif(!h.contains(x-t)) {\n\t\t\tSystem.out.println(x-t);\n\t\t}\n\t\telse if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+t);\n\t\t}\n\t}",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int x = s.nextInt();",
"x",
"s.nextInt()",
"s.nextInt",
"s",
"int n = s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"HashSet<Integer> h = new HashSet<>();",
"h",
"new HashSet<>()",
"while(n--!=0) {\n\t\t\th.add(s.nextInt());\n\t\t}",
"n--!=0",
"n--",
"n",
"0",
"{\n\t\t\th.add(s.nextInt());\n\t\t}",
"h.add(s.nextInt())",
"h.add",
"h",
"s.nextInt()",
"s.nextInt",
"s",
"int t=0;",
"t",
"0",
"while(h.contains(x-t) && h.contains(x+t)) {\n\t\t\tt++;\n\t\t}",
"h.contains(x-t) && h.contains(x+t)",
"h.contains(x-t)",
"h.contains",
"h",
"x-t",
"x",
"t",
"h.contains(x+t)",
"h.contains",
"h",
"x+t",
"x",
"t",
"{\n\t\t\tt++;\n\t\t}",
"t++",
"t",
"if(!h.contains(x-t)) {\n\t\t\tSystem.out.println(x-t);\n\t\t}\n\t\telse if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+t);\n\t\t}",
"!h.contains(x-t)",
"h.contains(x-t)",
"h.contains",
"h",
"x-t",
"x",
"t",
"{\n\t\t\tSystem.out.println(x-t);\n\t\t}",
"System.out.println(x-t)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-t",
"x",
"t",
"if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+t);\n\t\t}",
"!h.contains(x+t)",
"h.contains(x+t)",
"h.contains",
"h",
"x+t",
"x",
"t",
"{\n\t\t\tSystem.out.println(x+t);\n\t\t}",
"System.out.println(x+t)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+t",
"x",
"t",
"String[] args",
"args",
"public class Main {\n\t\n\n\t\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner s = new Scanner(System.in);\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\t\t\n\t\tHashSet<Integer> h = new HashSet<>();\n\t\twhile(n--!=0) {\n\t\t\th.add(s.nextInt());\n\t\t}\n\t\t\n\t\tint t=0;\n\t\twhile(h.contains(x-t) && h.contains(x+t)) {\n\t\t\tt++;\n\t\t}\n\t\t\n\t\tif(!h.contains(x-t)) {\n\t\t\tSystem.out.println(x-t);\n\t\t}\n\t\telse if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+t);\n\t\t}\n\t}\n}",
"public class Main {\n\t\n\n\t\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner s = new Scanner(System.in);\n\t\tint x = s.nextInt();\n\t\tint n = s.nextInt();\n\t\t\n\t\tHashSet<Integer> h = new HashSet<>();\n\t\twhile(n--!=0) {\n\t\t\th.add(s.nextInt());\n\t\t}\n\t\t\n\t\tint t=0;\n\t\twhile(h.contains(x-t) && h.contains(x+t)) {\n\t\t\tt++;\n\t\t}\n\t\t\n\t\tif(!h.contains(x-t)) {\n\t\t\tSystem.out.println(x-t);\n\t\t}\n\t\telse if(!h.contains(x+t)) {\n\t\t\tSystem.out.println(x+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 s = new Scanner(System.in);
int x = s.nextInt();
int n = s.nextInt();
HashSet<Integer> h = new HashSet<>();
while(n--!=0) {
h.add(s.nextInt());
}
int t=0;
while(h.contains(x-t) && h.contains(x+t)) {
t++;
}
if(!h.contains(x-t)) {
System.out.println(x-t);
}
else if(!h.contains(x+t)) {
System.out.println(x+t);
}
}
} |
[
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,
4,
18,
13,
11,
1,
41,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
4,
18,
13,
13,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
14,
40,
4,
18,
4,
18,
13,
13,
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
],
[
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
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
55,
56
],
[
49,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
59,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
73,
82
],
[
58,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
85,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
94,
96
],
[
83,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
97,
106
],
[
6,
107
],
[
107,
108
],
[
0,
109
],
[
109,
110
],
[
109,
111
]
]
| [
"import java.util.*;\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\tString[] nums = new String[n];\n\t\tfor (int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.next();\n\t\t}\n\t\tsc.close();\n\t\tfor(int count = 0;;count++){\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\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\tString[] nums = new String[n];\n\t\tfor (int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.next();\n\t\t}\n\t\tsc.close();\n\t\tfor(int count = 0;;count++){\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\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 x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tString[] nums = new String[n];\n\t\tfor (int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.next();\n\t\t}\n\t\tsc.close();\n\t\tfor(int count = 0;;count++){\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\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\tString[] nums = new String[n];\n\t\tfor (int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.next();\n\t\t}\n\t\tsc.close();\n\t\tfor(int count = 0;;count++){\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\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",
"String[] nums = new String[n];",
"nums",
"new String[n]",
"n",
"for (int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.next();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = sc.next();\n\t\t}",
"{\n\t\t\tnums[i] = sc.next();\n\t\t}",
"nums[i] = sc.next()",
"nums[i]",
"nums",
"i",
"sc.next()",
"sc.next",
"sc",
"sc.close()",
"sc.close",
"sc",
"for(int count = 0;;count++){\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int count = 0;",
"int count = 0;",
"count",
"0",
"count++",
"count++",
"count",
"{\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}",
"!(Arrays.asList(nums).contains(String.valueOf(x-count)))",
"(Arrays.asList(nums).contains(String.valueOf(x-count)))",
"Arrays.asList(nums).contains",
"Arrays.asList(nums)",
"Arrays.asList",
"Arrays",
"nums",
"String.valueOf(x-count)",
"String.valueOf",
"String",
"x-count",
"x",
"count",
"{\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x-count)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-count",
"x",
"count",
"break;",
"if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}",
"!(Arrays.asList(nums).contains(String.valueOf(x+count)))",
"(Arrays.asList(nums).contains(String.valueOf(x+count)))",
"Arrays.asList(nums).contains",
"Arrays.asList(nums)",
"Arrays.asList",
"Arrays",
"nums",
"String.valueOf(x+count)",
"String.valueOf",
"String",
"x+count",
"x",
"count",
"{\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}",
"System.out.println(x+count)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+count",
"x",
"count",
"break;",
"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\tString[] nums = new String[n];\n\t\tfor (int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.next();\n\t\t}\n\t\tsc.close();\n\t\tfor(int count = 0;;count++){\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}\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\tString[] nums = new String[n];\n\t\tfor (int i = 0; i < n; i++){\n\t\t\tnums[i] = sc.next();\n\t\t}\n\t\tsc.close();\n\t\tfor(int count = 0;;count++){\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){\n\t\t\t\tSystem.out.println(x-count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){\n\t\t\t\tSystem.out.println(x+count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\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();
String[] nums = new String[n];
for (int i = 0; i < n; i++){
nums[i] = sc.next();
}
sc.close();
for(int count = 0;;count++){
if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
System.out.println(x-count);
break;
}
if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
System.out.println(x+count);
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,
41,
13,
17,
41,
13,
17,
42,
17,
30,
14,
40,
4,
18,
4,
18,
13,
13,
2,
13,
13,
30,
0,
13,
40,
13,
3,
14,
40,
4,
18,
4,
18,
13,
13,
2,
13,
13,
30,
0,
13,
13,
3,
40,
13,
4,
18,
18,
13,
13,
2,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
101,
5
],
[
101,
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
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
57,
63
],
[
63,
64
],
[
63,
65
],
[
55,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
66,
71
],
[
55,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
74,
80
],
[
80,
81
],
[
80,
82
],
[
72,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
54,
88
],
[
88,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
6,
98
],
[
98,
99
],
[
0,
100
],
[
100,
101
],
[
100,
102
]
]
| [
"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 Integer[] p = new Integer[N];\n for(int i=0;i<N;i++){\n p[i] = sc.nextInt();\n }\n int i=0;\n int abs = 0;\n while(true){\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }\n System.out.println(X+abs);\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 int i=0;\n int abs = 0;\n while(true){\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }\n System.out.println(X+abs);\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 int i=0;\n int abs = 0;\n while(true){\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }\n System.out.println(X+abs);\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 int i=0;\n int abs = 0;\n while(true){\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }\n System.out.println(X+abs);\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",
"int i=0;",
"i",
"0",
"int abs = 0;",
"abs",
"0",
"while(true){\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }",
"true",
"{\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }",
"if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }",
"!(Arrays.asList(p).contains(X-i))",
"(Arrays.asList(p).contains(X-i))",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"X-i",
"X",
"i",
"{\n abs = -i;\n break;\n }",
"abs = -i",
"abs",
"-i",
"i",
"break;",
"if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }",
"!(Arrays.asList(p).contains(X+i))",
"(Arrays.asList(p).contains(X+i))",
"Arrays.asList(p).contains",
"Arrays.asList(p)",
"Arrays.asList",
"Arrays",
"p",
"X+i",
"X",
"i",
"{\n abs = i;\n break;\n }",
"abs = i",
"abs",
"i",
"break;",
"i++",
"i",
"System.out.println(X+abs)",
"System.out.println",
"System.out",
"System",
"System.out",
"X+abs",
"X",
"abs",
"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 Integer[] p = new Integer[N];\n for(int i=0;i<N;i++){\n p[i] = sc.nextInt();\n }\n int i=0;\n int abs = 0;\n while(true){\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }\n System.out.println(X+abs);\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 int i=0;\n int abs = 0;\n while(true){\n if(!(Arrays.asList(p).contains(X-i))){\n abs = -i;\n break;\n }else if(!(Arrays.asList(p).contains(X+i))){\n abs = i;\n break;\n }\n i++;\n }\n System.out.println(X+abs);\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();
}
int i=0;
int abs = 0;
while(true){
if(!(Arrays.asList(p).contains(X-i))){
abs = -i;
break;
}else if(!(Arrays.asList(p).contains(X+i))){
abs = i;
break;
}
i++;
}
System.out.println(X+abs);
}
} |
[
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,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
17,
4,
18,
13,
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,
0,
18,
13,
18,
13,
13,
17,
41,
13,
18,
13,
13,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
18,
13,
13,
30,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
18,
13,
13,
30,
41,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
40,
17,
35,
13,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
34,
17,
1,
0,
13,
17,
3,
29,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
40,
13,
29,
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,
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
],
[
424,
29
],
[
424,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
32,
36
],
[
36,
37
],
[
36,
38
],
[
32,
39
],
[
39,
40
],
[
39,
41
],
[
32,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
42,
46
],
[
42,
47
],
[
32,
48
],
[
48,
49
],
[
49,
50
],
[
32,
51
],
[
51,
52
],
[
52,
53
],
[
30,
54
],
[
54,
55
],
[
0,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
56,
60
],
[
60,
61
],
[
56,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
64,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
62,
75
],
[
75,
76
],
[
62,
77
],
[
77,
78
],
[
0,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
83,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
83,
94
],
[
94,
95
],
[
94,
96
],
[
83,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
98,
102
],
[
83,
103
],
[
103,
104
],
[
103,
105
],
[
83,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
125,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
127,
133
],
[
83,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
83,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
83,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
148,
149
],
[
148,
150
],
[
143,
151
],
[
151,
152
],
[
152,
153
],
[
143,
154
],
[
155,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
166,
167
],
[
166,
168
],
[
160,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
177,
178
],
[
177,
179
],
[
83,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
180,
187
],
[
187,
188
],
[
187,
189
],
[
180,
190
],
[
190,
191
],
[
191,
192
],
[
180,
193
],
[
194,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
195,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
203,
204
],
[
202,
205
],
[
205,
206
],
[
205,
207
],
[
199,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
212,
216
],
[
216,
217
],
[
216,
218
],
[
83,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
81,
223
],
[
223,
224
],
[
81,
225
],
[
225,
226
],
[
81,
227
],
[
227,
228
],
[
79,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
231,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
239,
242
],
[
242,
243
],
[
242,
244
],
[
229,
245
],
[
245,
246
],
[
229,
247
],
[
247,
248
],
[
79,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
251,
256
],
[
256,
257
],
[
256,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
260,
264
],
[
256,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
267,
271
],
[
256,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
274,
278
],
[
256,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
281,
285
],
[
256,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
289,
290
],
[
289,
291
],
[
288,
292
],
[
256,
293
],
[
293,
294
],
[
293,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
295,
299
],
[
256,
300
],
[
300,
301
],
[
300,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
302,
306
],
[
256,
307
],
[
307,
308
],
[
307,
309
],
[
309,
310
],
[
310,
311
],
[
310,
312
],
[
309,
313
],
[
256,
314
],
[
314,
315
],
[
314,
316
],
[
316,
317
],
[
317,
318
],
[
317,
319
],
[
316,
320
],
[
256,
321
],
[
321,
322
],
[
321,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
323,
327
],
[
251,
328
],
[
328,
329
],
[
249,
330
],
[
330,
331
],
[
79,
332
],
[
332,
333
],
[
332,
334
],
[
334,
335
],
[
335,
336
],
[
335,
337
],
[
334,
338
],
[
338,
339
],
[
339,
340
],
[
339,
341
],
[
338,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
342,
346
],
[
346,
347
],
[
334,
348
],
[
348,
349
],
[
332,
350
],
[
350,
351
],
[
0,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
352,
356
],
[
356,
357
],
[
352,
358
],
[
358,
359
],
[
358,
360
],
[
360,
361
],
[
361,
362
],
[
361,
363
],
[
360,
364
],
[
364,
365
],
[
364,
366
],
[
358,
367
],
[
367,
368
],
[
352,
369
],
[
369,
370
],
[
369,
371
],
[
371,
372
],
[
372,
373
],
[
373,
374
],
[
374,
375
],
[
374,
376
],
[
373,
377
],
[
377,
378
],
[
378,
379
],
[
379,
380
],
[
372,
381
],
[
381,
382
],
[
382,
383
],
[
383,
384
],
[
383,
385
],
[
385,
386
],
[
386,
387
],
[
382,
388
],
[
388,
389
],
[
389,
390
],
[
389,
391
],
[
371,
392
],
[
392,
393
],
[
393,
394
],
[
394,
395
],
[
352,
396
],
[
396,
397
],
[
396,
398
],
[
398,
399
],
[
399,
400
],
[
400,
401
],
[
401,
402
],
[
400,
403
],
[
403,
404
],
[
352,
405
],
[
405,
406
],
[
405,
407
],
[
407,
408
],
[
408,
409
],
[
409,
410
],
[
410,
411
],
[
409,
412
],
[
412,
413
],
[
352,
414
],
[
414,
415
],
[
414,
416
],
[
416,
417
],
[
417,
418
],
[
418,
419
],
[
419,
420
],
[
418,
421
],
[
421,
422
],
[
0,
423
],
[
423,
424
],
[
423,
425
]
]
| [
"import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\n/**\n * Built using CHelper plug-in Actual solution is at the top\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}\n}\n\nclass Pair {\n\tint first;\n\tint second;\n\n\tPair(int first, int second) {\n\t\tthis.first = first;\n\t\tthis.second = second;\n\t}\n}\n\nclass TaskB {\n\n\tpublic void solve(int testNumber, InputReader in, PrintWriter pw) {\n\t\tint X = in.nextInt();\n\t\tint N = in.nextInt();\n\t\tboolean arr[] = new boolean[102];\n\t\tArrays.fill(arr, true);\n//\t\tArrayList<Integer> ans=new ArrayList<Integer>();\n\t\tint num[] = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnum[i] = in.nextInt();\n\t\t\tarr[num[i]] = false;\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint index = -1;\n\t\tfor (int i = 0; i <= X; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tfor (int i = X + 1; i <= 101; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tpw.println(index);\n\n\t}\n\n\tlong __gcd(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn __gcd(b, a % b);\n\n\t}\n\n\tpublic int getInt(int num) {\n\t\tint ret = -1;\n\t\tswitch (num) {\n\t\tcase 0:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tret = 2;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tret = 4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tret = 3;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tret = 7;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\t}\n\t\treturn ret;\n\t}\n\n\tpublic int isPow(long num) {\n\t\tint count = 0;\n\t\twhile (num > 0) {\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n}\n\nclass InputReader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\n\tpublic InputReader(InputStream in) {\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}\n\n\tpublic String next() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.BufferedWriter;",
"BufferedWriter",
"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.OutputStreamWriter;",
"OutputStreamWriter",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}",
"main",
"{\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}",
"InputReader in = new InputReader(System.in);",
"in",
"new InputReader(System.in)",
"PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);",
"out",
"new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true)",
"TaskB solver = new TaskB();",
"solver",
"new TaskB()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.flush()",
"out.flush",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"class Pair {\n\tint first;\n\tint second;\n\n\tPair(int first, int second) {\n\t\tthis.first = first;\n\t\tthis.second = second;\n\t}\n}",
"Pair",
"int first;",
"first",
"int second;",
"second",
"Pair(int first, int second) {\n\t\tthis.first = first;\n\t\tthis.second = second;\n\t}",
"Pair",
"{\n\t\tthis.first = first;\n\t\tthis.second = second;\n\t}",
"this.first = first",
"this.first",
"this",
"this.first",
"first",
"this.second = second",
"this.second",
"this",
"this.second",
"second",
"int first",
"first",
"int second",
"second",
"class TaskB {\n\n\tpublic void solve(int testNumber, InputReader in, PrintWriter pw) {\n\t\tint X = in.nextInt();\n\t\tint N = in.nextInt();\n\t\tboolean arr[] = new boolean[102];\n\t\tArrays.fill(arr, true);\n//\t\tArrayList<Integer> ans=new ArrayList<Integer>();\n\t\tint num[] = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnum[i] = in.nextInt();\n\t\t\tarr[num[i]] = false;\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint index = -1;\n\t\tfor (int i = 0; i <= X; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tfor (int i = X + 1; i <= 101; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tpw.println(index);\n\n\t}\n\n\tlong __gcd(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn __gcd(b, a % b);\n\n\t}\n\n\tpublic int getInt(int num) {\n\t\tint ret = -1;\n\t\tswitch (num) {\n\t\tcase 0:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tret = 2;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tret = 4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tret = 3;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tret = 7;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\t}\n\t\treturn ret;\n\t}\n\n\tpublic int isPow(long num) {\n\t\tint count = 0;\n\t\twhile (num > 0) {\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n}",
"TaskB",
"public void solve(int testNumber, InputReader in, PrintWriter pw) {\n\t\tint X = in.nextInt();\n\t\tint N = in.nextInt();\n\t\tboolean arr[] = new boolean[102];\n\t\tArrays.fill(arr, true);\n//\t\tArrayList<Integer> ans=new ArrayList<Integer>();\n\t\tint num[] = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnum[i] = in.nextInt();\n\t\t\tarr[num[i]] = false;\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint index = -1;\n\t\tfor (int i = 0; i <= X; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tfor (int i = X + 1; i <= 101; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tpw.println(index);\n\n\t}",
"solve",
"{\n\t\tint X = in.nextInt();\n\t\tint N = in.nextInt();\n\t\tboolean arr[] = new boolean[102];\n\t\tArrays.fill(arr, true);\n//\t\tArrayList<Integer> ans=new ArrayList<Integer>();\n\t\tint num[] = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnum[i] = in.nextInt();\n\t\t\tarr[num[i]] = false;\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint index = -1;\n\t\tfor (int i = 0; i <= X; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tfor (int i = X + 1; i <= 101; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tpw.println(index);\n\n\t}",
"int X = in.nextInt();",
"X",
"in.nextInt()",
"in.nextInt",
"in",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"boolean arr[] = new boolean[102];",
"arr",
"new boolean[102]",
"102",
"Arrays.fill(arr, true)",
"Arrays.fill",
"Arrays",
"arr",
"true",
"int num[] = new int[N];",
"num",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tnum[i] = in.nextInt();\n\t\t\tarr[num[i]] = false;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = in.nextInt();\n\t\t\tarr[num[i]] = false;\n\t\t}",
"{\n\t\t\tnum[i] = in.nextInt();\n\t\t\tarr[num[i]] = false;\n\t\t}",
"num[i] = in.nextInt()",
"num[i]",
"num",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"arr[num[i]] = false",
"arr[num[i]]",
"arr",
"num[i]",
"num",
"i",
"false",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int index = -1;",
"index",
"-1",
"1",
"for (int i = 0; i <= X; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= X",
"i",
"X",
"i++",
"i++",
"i",
"{\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"if (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}",
"arr[i]",
"arr",
"i",
"{\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}",
"int temp = Math.abs(X - i);",
"temp",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"if (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}",
"temp < min",
"temp",
"min",
"{\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}",
"index = i",
"index",
"i",
"min = temp",
"min",
"temp",
"for (int i = X + 1; i <= 101; i++) {\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"int i = X + 1;",
"int i = X + 1;",
"i",
"X + 1",
"X",
"1",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"if (arr[i]) {\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}",
"arr[i]",
"arr",
"i",
"{\n\t\t\t\tint temp = Math.abs(X - i);\n\t\t\t\tif (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}\n\n\t\t\t}",
"int temp = Math.abs(X - i);",
"temp",
"Math.abs(X - i)",
"Math.abs",
"Math",
"X - i",
"X",
"i",
"if (temp < min) {\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}",
"temp < min",
"temp",
"min",
"{\n\t\t\t\t\tindex = i;\n\t\t\t\t\tmin = temp;\n\t\t\t\t}",
"index = i",
"index",
"i",
"min = temp",
"min",
"temp",
"pw.println(index)",
"pw.println",
"pw",
"index",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"PrintWriter pw",
"pw",
"long __gcd(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn __gcd(b, a % b);\n\n\t}",
"__gcd",
"{\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn __gcd(b, a % b);\n\n\t}",
"if (b == 0)\n\t\t\treturn a;",
"b == 0",
"b",
"0",
"return a;",
"a",
"return __gcd(b, a % b);",
"__gcd(b, a % b)",
"__gcd",
"b",
"a % b",
"a",
"b",
"long a",
"a",
"long b",
"b",
"public int getInt(int num) {\n\t\tint ret = -1;\n\t\tswitch (num) {\n\t\tcase 0:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tret = 2;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tret = 4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tret = 3;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tret = 7;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\t}\n\t\treturn ret;\n\t}",
"getInt",
"{\n\t\tint ret = -1;\n\t\tswitch (num) {\n\t\tcase 0:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tret = 2;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tret = 4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tret = 3;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tret = 7;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\t}\n\t\treturn ret;\n\t}",
"int ret = -1;",
"ret",
"-1",
"1",
"switch (num) {\n\t\tcase 0:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tret = 2;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tret = 4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tret = 3;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tret = 7;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\t}",
"num",
"case 0:",
"0",
"case 0:",
"ret = 6",
"ret",
"6",
"break;",
"case 1:",
"1",
"case 1:",
"ret = 2",
"ret",
"2",
"break;",
"case 2:",
"2",
"case 2:",
"ret = 5",
"ret",
"5",
"break;",
"case 3:",
"3",
"case 3:",
"ret = 5",
"ret",
"5",
"break;",
"case 4:",
"4",
"case 4:",
"ret = 4",
"ret",
"4",
"break;",
"case 5:",
"5",
"case 5:",
"ret = 5",
"ret",
"5",
"break;",
"case 6:",
"6",
"case 6:",
"ret = 6",
"ret",
"6",
"break;",
"case 7:",
"7",
"case 7:",
"ret = 3",
"ret",
"3",
"break;",
"case 8:",
"8",
"case 8:",
"ret = 7",
"ret",
"7",
"break;",
"case 9:",
"9",
"case 9:",
"ret = 6",
"ret",
"6",
"break;",
"return ret;",
"ret",
"int num",
"num",
"public int isPow(long num) {\n\t\tint count = 0;\n\t\twhile (num > 0) {\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}",
"isPow",
"{\n\t\tint count = 0;\n\t\twhile (num > 0) {\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}",
"int count = 0;",
"count",
"0",
"while (num > 0) {\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}",
"num > 0",
"num",
"0",
"{\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}",
"num /= 2",
"num",
"2",
"count++",
"count",
"return count;",
"count",
"long num",
"num",
"class InputReader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\n\tpublic InputReader(InputStream in) {\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}\n\n\tpublic String next() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"InputReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public InputReader(InputStream in) {\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}",
"InputReader",
"{\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}",
"br = new BufferedReader(new InputStreamReader(in))",
"br",
"new BufferedReader(new InputStreamReader(in))",
"st = null",
"st",
"null",
"InputStream in",
"in",
"public String next() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}",
"next",
"{\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}",
"while (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}",
"try {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"IOException e",
"{\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t}",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}",
"nextInt",
"{\n\t\treturn Integer.parseInt(next());\n\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}",
"nextLong",
"{\n\t\treturn Long.parseLong(next());\n\t}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}",
"nextDouble",
"{\n\t\treturn Double.parseDouble(next());\n\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
TaskB solver = new TaskB();
solver.solve(1, in, out);
out.flush();
out.close();
}
}
class Pair {
int first;
int second;
Pair(int first, int second) {
this.first = first;
this.second = second;
}
}
class TaskB {
public void solve(int testNumber, InputReader in, PrintWriter pw) {
int X = in.nextInt();
int N = in.nextInt();
boolean arr[] = new boolean[102];
Arrays.fill(arr, true);
// ArrayList<Integer> ans=new ArrayList<Integer>();
int num[] = new int[N];
for (int i = 0; i < N; i++) {
num[i] = in.nextInt();
arr[num[i]] = false;
}
int min = Integer.MAX_VALUE;
int index = -1;
for (int i = 0; i <= X; i++) {
if (arr[i]) {
int temp = Math.abs(X - i);
if (temp < min) {
index = i;
min = temp;
}
}
}
for (int i = X + 1; i <= 101; i++) {
if (arr[i]) {
int temp = Math.abs(X - i);
if (temp < min) {
index = i;
min = temp;
}
}
}
pw.println(index);
}
long __gcd(long a, long b) {
if (b == 0)
return a;
return __gcd(b, a % b);
}
public int getInt(int num) {
int ret = -1;
switch (num) {
case 0:
ret = 6;
break;
case 1:
ret = 2;
break;
case 2:
ret = 5;
break;
case 3:
ret = 5;
break;
case 4:
ret = 4;
break;
case 5:
ret = 5;
break;
case 6:
ret = 6;
break;
case 7:
ret = 3;
break;
case 8:
ret = 7;
break;
case 9:
ret = 6;
break;
}
return ret;
}
public int isPow(long num) {
int count = 0;
while (num > 0) {
num /= 2;
count++;
}
return count;
}
}
class InputReader {
BufferedReader br;
StringTokenizer st;
public InputReader(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
st = null;
}
public String next() {
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(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
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,
11,
1,
41,
13,
17,
1,
40,
13,
30,
30,
41,
13,
2,
13,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
3,
0,
13,
2,
13,
13,
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
],
[
103,
11
],
[
103,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
16,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
16,
30
],
[
30,
31
],
[
30,
32
],
[
16,
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
],
[
16,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
58,
59
],
[
52,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
61,
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
],
[
61,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
61,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
92,
99
],
[
12,
100
],
[
100,
101
],
[
0,
102
],
[
102,
103
],
[
102,
104
]
]
| [
"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\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\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\tpublic static void main(String[] args) {\n\t\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"main",
"{\n\t\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"try (Scanner scn = new Scanner(System.in)) {\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"Scanner scn = new Scanner(System.in)",
"Scanner scn = new Scanner(System.in)",
"new Scanner(System.in)",
"int num = scn.nextInt();",
"num",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int cnt = scn.nextInt();",
"cnt",
"scn.nextInt()",
"scn.nextInt",
"scn",
"Set<Integer> nums = new HashSet<>();",
"nums",
"new HashSet<>()",
"for(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<cnt",
"i",
"cnt",
"i++",
"i++",
"i",
"{\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}",
"{\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}",
"nums.add(scn.nextInt())",
"nums.add",
"nums",
"scn.nextInt()",
"scn.nextInt",
"scn",
"for(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i++",
"i++",
"i",
"{\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int tgt=num-i;",
"tgt",
"num-i",
"num",
"i",
"if(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"!nums.contains(tgt)",
"nums.contains(tgt)",
"nums.contains",
"nums",
"tgt",
"{\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"System.out.println(tgt)",
"System.out.println",
"System.out",
"System",
"System.out",
"tgt",
"break;",
"tgt=num+i",
"tgt",
"num+i",
"num",
"i",
"if(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"!nums.contains(tgt)",
"nums.contains(tgt)",
"nums.contains",
"nums",
"tgt",
"{\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"System.out.println(tgt)",
"System.out.println",
"System.out",
"System",
"System.out",
"tgt",
"break;",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint num = scn.nextInt();\n\t\t\tint cnt = scn.nextInt();\n\n Set<Integer> nums = new HashSet<>();\n\t\t\tfor(int i=0; i<cnt; i++) {\n\t\t\t\tnums.add(scn.nextInt());\n\t\t\t}\n\n\t\t\tfor(int i=0; ; i++) {\n\t\t\t\tint tgt=num-i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttgt=num+i;\n\t\t\t\tif(!nums.contains(tgt)) {\n\t\t\t\t\tSystem.out.println(tgt);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\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) {
try (Scanner scn = new Scanner(System.in)) {
int num = scn.nextInt();
int cnt = scn.nextInt();
Set<Integer> nums = new HashSet<>();
for(int i=0; i<cnt; i++) {
nums.add(scn.nextInt());
}
for(int i=0; ; i++) {
int tgt=num-i;
if(!nums.contains(tgt)) {
System.out.println(tgt);
break;
}
tgt=num+i;
if(!nums.contains(tgt)) {
System.out.println(tgt);
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,
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,
40,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
2,
13,
17,
42,
4,
18,
13,
13,
30,
40,
13,
41,
13,
2,
13,
17,
42,
4,
18,
13,
13,
30,
40,
13,
41,
13,
2,
13,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
13,
0,
13,
4,
18,
13,
13,
30,
0,
13,
2,
13,
13,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
252,
20
],
[
252,
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
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
37,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
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
],
[
65,
68
],
[
68,
69
],
[
69,
70
],
[
48,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
71,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
90,
95
],
[
95,
96
],
[
96,
97
],
[
84,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
84,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
103,
108
],
[
108,
109
],
[
109,
110
],
[
84,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
84,
116
],
[
116,
117
],
[
116,
118
],
[
84,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
119,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
84,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
139,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
21,
161
],
[
161,
162
],
[
252,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
163,
167
],
[
167,
168
],
[
163,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
163,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
178,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
188,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
177,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
163,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
207,
210
],
[
210,
211
],
[
163,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
216,
219
],
[
219,
220
],
[
163,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
225,
228
],
[
228,
229
],
[
163,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
236,
243
],
[
243,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
247,
248
],
[
232,
249
],
[
249,
250
],
[
0,
251
],
[
251,
252
],
[
251,
253
]
]
| [
"\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\npublic class Main {\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n public static void main(String[] args) {\n FastReader fr = new FastReader();\n int x = fr.nextInt();\n int n = fr.nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\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.HashSet;",
"HashSet",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n public static void main(String[] args) {\n FastReader fr = new FastReader();\n int x = fr.nextInt();\n int n = fr.nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n FastReader fr = new FastReader();\n int x = fr.nextInt();\n int n = fr.nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }\n }\n }",
"main",
"{\n FastReader fr = new FastReader();\n int x = fr.nextInt();\n int n = fr.nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }\n }\n }",
"FastReader fr = new FastReader();",
"fr",
"new FastReader()",
"int x = fr.nextInt();",
"x",
"fr.nextInt()",
"fr.nextInt",
"fr",
"int n = fr.nextInt();",
"n",
"fr.nextInt()",
"fr.nextInt",
"fr",
"if(n==0){\n System.out.println(x);\n }\n else{\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\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 Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }\n }",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n set.add(fr.nextInt());\n }",
"{\n set.add(fr.nextInt());\n }",
"set.add(fr.nextInt())",
"set.add",
"set",
"fr.nextInt()",
"fr.nextInt",
"fr",
"if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }",
"!set.contains(x)",
"set.contains(x)",
"set.contains",
"set",
"x",
"{\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }",
"int forward = x+1;",
"forward",
"x+1",
"x",
"1",
"while(set.contains(forward)){\n forward++;\n }",
"set.contains(forward)",
"set.contains",
"set",
"forward",
"{\n forward++;\n }",
"forward++",
"forward",
"int backward = x-1;",
"backward",
"x-1",
"x",
"1",
"while(set.contains(backward)){\n backward--;\n }",
"set.contains(backward)",
"set.contains",
"set",
"backward",
"{\n backward--;\n }",
"backward--",
"backward",
"int val1 = forward-x;",
"val1",
"forward-x",
"forward",
"x",
"int val2 = 0;",
"val2",
"0",
"if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }",
"backward<0",
"backward",
"0",
"{\n val2+=(x);\n val2+=(Math.abs(backward));\n }",
"val2+=(x)",
"val2",
"(x)",
"val2+=(Math.abs(backward))",
"val2",
"(Math.abs(backward))",
"Math.abs",
"Math",
"backward",
"{\n val2=(x-backward);\n }",
"val2=(x-backward)",
"val2",
"(x-backward)",
"x",
"backward",
"if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }",
"val1<val2",
"val1",
"val2",
"{\n System.out.println(x+val1);\n }",
"System.out.println(x+val1)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+val1",
"x",
"val1",
"{\n System.out.println(x-val2);\n }",
"System.out.println(x-val2)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-val2",
"x",
"val2",
"String[] args",
"args",
"static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\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\n InputStreamReader(System.in));\n }",
"FastReader",
"{\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }",
"br = new BufferedReader(new\n InputStreamReader(System.in))",
"br",
"new BufferedReader(new\n 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 } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"nextLine",
"{\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }",
"String str = \"\";",
"str",
"\"\"",
"try {\n str = 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 str = br.readLine();\n }",
"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\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n public static void main(String[] args) {\n FastReader fr = new FastReader();\n int x = fr.nextInt();\n int n = fr.nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }\n }\n }\n}",
"public class Main {\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\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\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n public static void main(String[] args) {\n FastReader fr = new FastReader();\n int x = fr.nextInt();\n int n = fr.nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < n; i++) {\n set.add(fr.nextInt());\n }\n if(!set.contains(x)){\n System.out.println(x);\n }\n else{\n int forward = x+1;\n while(set.contains(forward)){\n forward++;\n }\n int backward = x-1;\n while(set.contains(backward)){\n backward--;\n }\n int val1 = forward-x;\n int val2 = 0;\n if(backward<0){\n val2+=(x);\n val2+=(Math.abs(backward));\n }\n else{\n val2=(x-backward);\n }\n if(val1<val2){\n System.out.println(x+val1);\n }\n else{\n System.out.println(x-val2);\n }\n }\n }\n }\n}",
"Main"
]
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
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());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static void main(String[] args) {
FastReader fr = new FastReader();
int x = fr.nextInt();
int n = fr.nextInt();
if(n==0){
System.out.println(x);
}
else{
Set<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
set.add(fr.nextInt());
}
if(!set.contains(x)){
System.out.println(x);
}
else{
int forward = x+1;
while(set.contains(forward)){
forward++;
}
int backward = x-1;
while(set.contains(backward)){
backward--;
}
int val1 = forward-x;
int val2 = 0;
if(backward<0){
val2+=(x);
val2+=(Math.abs(backward));
}
else{
val2=(x-backward);
}
if(val1<val2){
System.out.println(x+val1);
}
else{
System.out.println(x-val2);
}
}
}
}
} |
[
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,
13,
41,
13,
17,
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,
42,
4,
18,
13,
13,
30,
40,
13,
42,
4,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
8,
2,
2,
13,
13,
2,
13,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
91,
5
],
[
91,
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,
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
],
[
45,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
57,
62
],
[
62,
63
],
[
63,
64
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
65,
70
],
[
70,
71
],
[
71,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
78,
87
],
[
6,
88
],
[
88,
89
],
[
0,
90
],
[
90,
91
],
[
90,
92
]
]
| [
"import java.util.*;\npublic class Main {\n public static void main(String... args) {\n Scanner input = new Scanner(System.in);\n \n int x = input.nextInt();\n int n = input.nextInt();\n \n Set<Integer> set = new HashSet<>();\n int[] a = new int[n];\n boolean notFound = true;\n for (int i = 0; i < n; i++) {\n set.add(input.nextInt());\n }\n\n int lower = x;\n int higher = x;\n \n while (set.contains(lower)) {\n lower--;\n }\n \n while (set.contains(higher)) {\n higher++;\n }\n \n System.out.println(x - lower <= higher - x ? lower : higher);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String... args) {\n Scanner input = new Scanner(System.in);\n \n int x = input.nextInt();\n int n = input.nextInt();\n \n Set<Integer> set = new HashSet<>();\n int[] a = new int[n];\n boolean notFound = true;\n for (int i = 0; i < n; i++) {\n set.add(input.nextInt());\n }\n\n int lower = x;\n int higher = x;\n \n while (set.contains(lower)) {\n lower--;\n }\n \n while (set.contains(higher)) {\n higher++;\n }\n \n System.out.println(x - lower <= higher - x ? lower : higher);\n }\n}",
"Main",
"public static void main(String... args) {\n Scanner input = new Scanner(System.in);\n \n int x = input.nextInt();\n int n = input.nextInt();\n \n Set<Integer> set = new HashSet<>();\n int[] a = new int[n];\n boolean notFound = true;\n for (int i = 0; i < n; i++) {\n set.add(input.nextInt());\n }\n\n int lower = x;\n int higher = x;\n \n while (set.contains(lower)) {\n lower--;\n }\n \n while (set.contains(higher)) {\n higher++;\n }\n \n System.out.println(x - lower <= higher - x ? lower : higher);\n }",
"main",
"{\n Scanner input = new Scanner(System.in);\n \n int x = input.nextInt();\n int n = input.nextInt();\n \n Set<Integer> set = new HashSet<>();\n int[] a = new int[n];\n boolean notFound = true;\n for (int i = 0; i < n; i++) {\n set.add(input.nextInt());\n }\n\n int lower = x;\n int higher = x;\n \n while (set.contains(lower)) {\n lower--;\n }\n \n while (set.contains(higher)) {\n higher++;\n }\n \n System.out.println(x - lower <= higher - x ? lower : higher);\n }",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int x = input.nextInt();",
"x",
"input.nextInt()",
"input.nextInt",
"input",
"int n = input.nextInt();",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"boolean notFound = true;",
"notFound",
"true",
"for (int i = 0; i < n; i++) {\n set.add(input.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n set.add(input.nextInt());\n }",
"{\n set.add(input.nextInt());\n }",
"set.add(input.nextInt())",
"set.add",
"set",
"input.nextInt()",
"input.nextInt",
"input",
"int lower = x;",
"lower",
"x",
"int higher = x;",
"higher",
"x",
"while (set.contains(lower)) {\n lower--;\n }",
"set.contains(lower)",
"set.contains",
"set",
"lower",
"{\n lower--;\n }",
"lower--",
"lower",
"while (set.contains(higher)) {\n higher++;\n }",
"set.contains(higher)",
"set.contains",
"set",
"higher",
"{\n higher++;\n }",
"higher++",
"higher",
"System.out.println(x - lower <= higher - x ? lower : higher)",
"System.out.println",
"System.out",
"System",
"System.out",
"x - lower <= higher - x ? lower : higher",
"x - lower <= higher - x",
"x - lower",
"x",
"lower",
"higher - x",
"higher",
"x",
"lower",
"higher",
"String... args",
"args",
"public class Main {\n public static void main(String... args) {\n Scanner input = new Scanner(System.in);\n \n int x = input.nextInt();\n int n = input.nextInt();\n \n Set<Integer> set = new HashSet<>();\n int[] a = new int[n];\n boolean notFound = true;\n for (int i = 0; i < n; i++) {\n set.add(input.nextInt());\n }\n\n int lower = x;\n int higher = x;\n \n while (set.contains(lower)) {\n lower--;\n }\n \n while (set.contains(higher)) {\n higher++;\n }\n \n System.out.println(x - lower <= higher - x ? lower : higher);\n }\n}",
"public class Main {\n public static void main(String... args) {\n Scanner input = new Scanner(System.in);\n \n int x = input.nextInt();\n int n = input.nextInt();\n \n Set<Integer> set = new HashSet<>();\n int[] a = new int[n];\n boolean notFound = true;\n for (int i = 0; i < n; i++) {\n set.add(input.nextInt());\n }\n\n int lower = x;\n int higher = x;\n \n while (set.contains(lower)) {\n lower--;\n }\n \n while (set.contains(higher)) {\n higher++;\n }\n \n System.out.println(x - lower <= higher - x ? lower : higher);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String... args) {
Scanner input = new Scanner(System.in);
int x = input.nextInt();
int n = input.nextInt();
Set<Integer> set = new HashSet<>();
int[] a = new int[n];
boolean notFound = true;
for (int i = 0; i < n; i++) {
set.add(input.nextInt());
}
int lower = x;
int higher = x;
while (set.contains(lower)) {
lower--;
}
while (set.contains(higher)) {
higher++;
}
System.out.println(x - lower <= higher - x ? lower : higher);
}
} |
[
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,
14,
2,
13,
17,
30,
0,
13,
20,
42,
4,
18,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
0,
18,
13,
13,
17,
41,
13,
13,
41,
13,
13,
42,
2,
2,
13,
17,
18,
13,
13,
40,
13,
42,
2,
2,
13,
17,
18,
13,
13,
40,
13,
4,
18,
13,
2,
8,
2,
2,
13,
13,
2,
13,
13,
13,
13,
17,
4,
18,
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
],
[
120,
8
],
[
120,
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
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
53,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
11,
67
],
[
67,
68
],
[
67,
69
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
11,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
11,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
11,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
97,
105
],
[
97,
106
],
[
96,
107
],
[
11,
108
],
[
108,
109
],
[
109,
110
],
[
11,
111
],
[
111,
112
],
[
112,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
9,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
]
| [
"import java.io.*;\nimport java.util.StringTokenizer;\n\npublic class Main{\n\tpublic static void main(String [] args) throws IOException{\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint x = Integer.parseInt(st.nextToken());\n\t\tint n = Integer.parseInt(st.nextToken());\n\n\t\tboolean [] isVisit = new boolean[101];\n\n\t\tif(n > 0){\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}\n\n\t\tint l = x, r = x;\n\t\twhile(l > 0 && isVisit[l]) l--;\n\t\twhile(r < 101 && isVisit[r]) r++;\n\n\t\tbw.write((x - l <= r - x ? l : r )+\"\" );\n\t\tbw.flush();\n\t\tbw.close();\n\t\tbr.close();\n\t}\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main{\n\tpublic static void main(String [] args) throws IOException{\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint x = Integer.parseInt(st.nextToken());\n\t\tint n = Integer.parseInt(st.nextToken());\n\n\t\tboolean [] isVisit = new boolean[101];\n\n\t\tif(n > 0){\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}\n\n\t\tint l = x, r = x;\n\t\twhile(l > 0 && isVisit[l]) l--;\n\t\twhile(r < 101 && isVisit[r]) r++;\n\n\t\tbw.write((x - l <= r - x ? l : r )+\"\" );\n\t\tbw.flush();\n\t\tbw.close();\n\t\tbr.close();\n\t}\n}",
"Main",
"public static void main(String [] args) throws IOException{\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint x = Integer.parseInt(st.nextToken());\n\t\tint n = Integer.parseInt(st.nextToken());\n\n\t\tboolean [] isVisit = new boolean[101];\n\n\t\tif(n > 0){\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}\n\n\t\tint l = x, r = x;\n\t\twhile(l > 0 && isVisit[l]) l--;\n\t\twhile(r < 101 && isVisit[r]) r++;\n\n\t\tbw.write((x - l <= r - x ? l : r )+\"\" );\n\t\tbw.flush();\n\t\tbw.close();\n\t\tbr.close();\n\t}",
"main",
"{\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint x = Integer.parseInt(st.nextToken());\n\t\tint n = Integer.parseInt(st.nextToken());\n\n\t\tboolean [] isVisit = new boolean[101];\n\n\t\tif(n > 0){\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}\n\n\t\tint l = x, r = x;\n\t\twhile(l > 0 && isVisit[l]) l--;\n\t\twhile(r < 101 && isVisit[r]) r++;\n\n\t\tbw.write((x - l <= r - x ? l : r )+\"\" );\n\t\tbw.flush();\n\t\tbw.close();\n\t\tbr.close();\n\t}",
"BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));",
"bw",
"new BufferedWriter(new OutputStreamWriter(System.out))",
"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",
"boolean [] isVisit = new boolean[101];",
"isVisit",
"new boolean[101]",
"101",
"if(n > 0){\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}",
"n > 0",
"n",
"0",
"{\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"while(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}",
"int cur = Integer.parseInt(st.nextToken());",
"cur",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"isVisit[cur] = true",
"isVisit[cur]",
"isVisit",
"cur",
"true",
"int l = x",
"l",
"x",
"r = x;",
"r",
"x",
"while(l > 0 && isVisit[l]) l--;",
"l > 0 && isVisit[l]",
"l > 0",
"l",
"0",
"isVisit[l]",
"isVisit",
"l",
"l--",
"l",
"while(r < 101 && isVisit[r]) r++;",
"r < 101 && isVisit[r]",
"r < 101",
"r",
"101",
"isVisit[r]",
"isVisit",
"r",
"r++",
"r",
"bw.write((x - l <= r - x ? l : r )+\"\" )",
"bw.write",
"bw",
"(x - l <= r - x ? l : r )+\"\"",
"(x - l <= r - x ? l : r )",
"x - l <= r - x",
"x - l",
"x",
"l",
"r - x",
"r",
"x",
"l",
"r",
"\"\"",
"bw.flush()",
"bw.flush",
"bw",
"bw.close()",
"bw.close",
"bw",
"br.close()",
"br.close",
"br",
"String [] args",
"args",
"public class Main{\n\tpublic static void main(String [] args) throws IOException{\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint x = Integer.parseInt(st.nextToken());\n\t\tint n = Integer.parseInt(st.nextToken());\n\n\t\tboolean [] isVisit = new boolean[101];\n\n\t\tif(n > 0){\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}\n\n\t\tint l = x, r = x;\n\t\twhile(l > 0 && isVisit[l]) l--;\n\t\twhile(r < 101 && isVisit[r]) r++;\n\n\t\tbw.write((x - l <= r - x ? l : r )+\"\" );\n\t\tbw.flush();\n\t\tbw.close();\n\t\tbr.close();\n\t}\n}",
"public class Main{\n\tpublic static void main(String [] args) throws IOException{\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint x = Integer.parseInt(st.nextToken());\n\t\tint n = Integer.parseInt(st.nextToken());\n\n\t\tboolean [] isVisit = new boolean[101];\n\n\t\tif(n > 0){\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\twhile(st.hasMoreTokens()){\n\t\t\t\tint cur = Integer.parseInt(st.nextToken());\n\t\t\t\tisVisit[cur] = true;\n\t\t\t}\n\t\t}\n\n\t\tint l = x, r = x;\n\t\twhile(l > 0 && isVisit[l]) l--;\n\t\twhile(r < 101 && isVisit[r]) r++;\n\n\t\tbw.write((x - l <= r - x ? l : r )+\"\" );\n\t\tbw.flush();\n\t\tbw.close();\n\t\tbr.close();\n\t}\n}",
"Main"
]
| import java.io.*;
import java.util.StringTokenizer;
public class Main{
public static void main(String [] args) throws IOException{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
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());
boolean [] isVisit = new boolean[101];
if(n > 0){
st = new StringTokenizer(br.readLine());
while(st.hasMoreTokens()){
int cur = Integer.parseInt(st.nextToken());
isVisit[cur] = true;
}
}
int l = x, r = x;
while(l > 0 && isVisit[l]) l--;
while(r < 101 && isVisit[r]) r++;
bw.write((x - l <= r - x ? l : r )+"" );
bw.flush();
bw.close();
br.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,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
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
]
| [
[
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
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
49,
55
],
[
55,
56
],
[
55,
57
],
[
49,
58
],
[
58,
59
],
[
59,
60
],
[
49,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
64,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
70,
77
],
[
63,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
6,
96
],
[
96,
97
]
]
| [
"\nimport java.util.*;\n\nclass Main{\n\tstatic public void main(String args[]){\n\t\tScanner sc=new Scanner(System.in);\n\t\t\n\t\tint x=sc.nextInt(),n=sc.nextInt();\n\t\t\n\t\tList<Integer>p=new ArrayList<>();\n\t\t\n\t\tfor(int i=0;i<n;i++)\n\t\t\tp.add(sc.nextInt());\n\t\t\t\n\t\t\n\t\tint ans=0,min=150;\n\t\t//minはカンスト値の半分\n\t\t\n\t\t\n\t\tfor(int i=-100;i<=200;i++){\n\t\t\tif(!p.contains(i)&&Math.abs(i-x)<min){\n\t\t\t\tans=i;\n\t\t\t\tmin=Math.abs(i-x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\tstatic public void main(String args[]){\n\t\tScanner sc=new Scanner(System.in);\n\t\t\n\t\tint x=sc.nextInt(),n=sc.nextInt();\n\t\t\n\t\tList<Integer>p=new ArrayList<>();\n\t\t\n\t\tfor(int i=0;i<n;i++)\n\t\t\tp.add(sc.nextInt());\n\t\t\t\n\t\t\n\t\tint ans=0,min=150;\n\t\t//minはカンスト値の半分\n\t\t\n\t\t\n\t\tfor(int i=-100;i<=200;i++){\n\t\t\tif(!p.contains(i)&&Math.abs(i-x)<min){\n\t\t\t\tans=i;\n\t\t\t\tmin=Math.abs(i-x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}\n}",
"Main",
"static public void main(String args[]){\n\t\tScanner sc=new Scanner(System.in);\n\t\t\n\t\tint x=sc.nextInt(),n=sc.nextInt();\n\t\t\n\t\tList<Integer>p=new ArrayList<>();\n\t\t\n\t\tfor(int i=0;i<n;i++)\n\t\t\tp.add(sc.nextInt());\n\t\t\t\n\t\t\n\t\tint ans=0,min=150;\n\t\t//minはカンスト値の半分\n\t\t\n\t\t\n\t\tfor(int i=-100;i<=200;i++){\n\t\t\tif(!p.contains(i)&&Math.abs(i-x)<min){\n\t\t\t\tans=i;\n\t\t\t\tmin=Math.abs(i-x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}",
"main",
"{\n\t\tScanner sc=new Scanner(System.in);\n\t\t\n\t\tint x=sc.nextInt(),n=sc.nextInt();\n\t\t\n\t\tList<Integer>p=new ArrayList<>();\n\t\t\n\t\tfor(int i=0;i<n;i++)\n\t\t\tp.add(sc.nextInt());\n\t\t\t\n\t\t\n\t\tint ans=0,min=150;\n\t\t//minはカンスト値の半分\n\t\t\n\t\t\n\t\tfor(int i=-100;i<=200;i++){\n\t\t\tif(!p.contains(i)&&Math.abs(i-x)<min){\n\t\t\t\tans=i;\n\t\t\t\tmin=Math.abs(i-x);\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x=sc.nextInt()",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer>p=new ArrayList<>();",
"p",
"new ArrayList<>()",
"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",
"int ans=0",
"ans",
"0",
"min=150;",
"min",
"150",
"for(int i=-100;i<=200;i++){\n\t\t\tif(!p.contains(i)&&Math.abs(i-x)<min){\n\t\t\t\tans=i;\n\t\t\t\tmin=Math.abs(i-x);\n\t\t\t}\n\t\t}",
"int i=-100;",
"int i=-100;",
"i",
"-100",
"100",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n\t\t\tif(!p.contains(i)&&Math.abs(i-x)<min){\n\t\t\t\tans=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\tans=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\tans=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\tans=i;\n\t\t\t\tmin=Math.abs(i-x);\n\t\t\t}",
"ans=i",
"ans",
"i",
"min=Math.abs(i-x)",
"min",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"System.out.print(ans)",
"System.out.print",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args"
]
|
import java.util.*;
class Main{
static public void main(String args[]){
Scanner sc=new Scanner(System.in);
int x=sc.nextInt(),n=sc.nextInt();
List<Integer>p=new ArrayList<>();
for(int i=0;i<n;i++)
p.add(sc.nextInt());
int ans=0,min=150;
//minはカンスト値の半分
for(int i=-100;i<=200;i++){
if(!p.contains(i)&&Math.abs(i-x)<min){
ans=i;
min=Math.abs(i-x);
}
}
System.out.print(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,
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
],
[
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
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
8,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
65,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
63,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
63,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
98,
100
],
[
62,
101
],
[
101,
102
],
[
8,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
6,
109
],
[
109,
110
]
]
| [
" import java.util.*;\n \n 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[] a = new int[n];\n for(int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n \n Arrays.sort(a);\n int t=0,ans=0,f=0;\n while(f == 0) {\n if(Arrays.binarySearch(a, x-t) < 0) {\n ans = x - t;\n f = 1;\n } else if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }\n t++;\n }\n System.out.println(ans);\n }\n }",
"import java.util.*;",
"util.*",
"java",
"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[] a = new int[n];\n for(int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n \n Arrays.sort(a);\n int t=0,ans=0,f=0;\n while(f == 0) {\n if(Arrays.binarySearch(a, x-t) < 0) {\n ans = x - t;\n f = 1;\n } else if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }\n t++;\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 int[] a = new int[n];\n for(int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n \n Arrays.sort(a);\n int t=0,ans=0,f=0;\n while(f == 0) {\n if(Arrays.binarySearch(a, x-t) < 0) {\n ans = x - t;\n f = 1;\n } else if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }\n t++;\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 int[] a = new int[n];\n for(int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n \n Arrays.sort(a);\n int t=0,ans=0,f=0;\n while(f == 0) {\n if(Arrays.binarySearch(a, x-t) < 0) {\n ans = x - t;\n f = 1;\n } else if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }\n t++;\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[] a = new int[n];",
"a",
"new int[n]",
"n",
"for(int i = 0; i < n; i++)\n a[i] = sc.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = sc.nextInt();",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"int t=0",
"t",
"0",
"ans=0",
"ans",
"0",
"f=0;",
"f",
"0",
"while(f == 0) {\n if(Arrays.binarySearch(a, x-t) < 0) {\n ans = x - t;\n f = 1;\n } else if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }\n t++;\n }",
"f == 0",
"f",
"0",
"{\n if(Arrays.binarySearch(a, x-t) < 0) {\n ans = x - t;\n f = 1;\n } else if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }\n t++;\n }",
"if(Arrays.binarySearch(a, x-t) < 0) {\n ans = x - t;\n f = 1;\n } else if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }",
"Arrays.binarySearch(a, x-t) < 0",
"Arrays.binarySearch(a, x-t)",
"Arrays.binarySearch",
"Arrays",
"a",
"x-t",
"x",
"t",
"0",
"{\n ans = x - t;\n f = 1;\n }",
"ans = x - t",
"ans",
"x - t",
"x",
"t",
"f = 1",
"f",
"1",
"if(Arrays.binarySearch(a, x+t) < 0) {\n ans = x + t;\n f = 1;\n }",
"Arrays.binarySearch(a, x+t) < 0",
"Arrays.binarySearch(a, x+t)",
"Arrays.binarySearch",
"Arrays",
"a",
"x+t",
"x",
"t",
"0",
"{\n ans = x + t;\n f = 1;\n }",
"ans = x + t",
"ans",
"x + t",
"x",
"t",
"f = 1",
"f",
"1",
"t++",
"t",
"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);
int x = sc.nextInt();
int n = sc.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++)
a[i] = sc.nextInt();
Arrays.sort(a);
int t=0,ans=0,f=0;
while(f == 0) {
if(Arrays.binarySearch(a, x-t) < 0) {
ans = x - t;
f = 1;
} else if(Arrays.binarySearch(a, x+t) < 0) {
ans = x + t;
f = 1;
}
t++;
}
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,
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,
40,
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,
13,
18,
13,
13,
30,
0,
13,
17,
14,
13,
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
],
[
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
],
[
26,
28
],
[
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
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
52,
58
],
[
58,
59
],
[
58,
60
],
[
52,
61
],
[
61,
62
],
[
62,
63
],
[
52,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
65,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
96,
103
],
[
95,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
113,
115
],
[
8,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
6,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
]
| [
"\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n @SuppressWarnings(\"resource\")\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 ans = 0;\n int ab = 100;\n for (int i = 0 ; i < n ; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = -100 ; i <= 101 ; i++) {\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }\n System.out.println(ans);\n }\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n @SuppressWarnings(\"resource\")\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 ans = 0;\n int ab = 100;\n for (int i = 0 ; i < n ; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = -100 ; i <= 101 ; i++) {\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }\n System.out.println(ans);\n }\n\n}",
"Main",
"public static void main(String[] args) {\n @SuppressWarnings(\"resource\")\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 ans = 0;\n int ab = 100;\n for (int i = 0 ; i < n ; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = -100 ; i <= 101 ; i++) {\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n @SuppressWarnings(\"resource\")\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 ans = 0;\n int ab = 100;\n for (int i = 0 ; i < n ; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = -100 ; i <= 101 ; i++) {\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }\n System.out.println(ans);\n }",
"@SuppressWarnings(\"resource\")\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 ans = 0;",
"ans",
"0",
"int ab = 100;",
"ab",
"100",
"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 = -100 ; i <= 101 ; i++) {\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }",
"int i = -100 ;",
"int i = -100 ;",
"i",
"-100",
"100",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }",
"{\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }",
"boolean flg = true;",
"flg",
"true",
"for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }",
"int j = 0 ;",
"int j = 0 ;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if (i == p[j]) {\n flg = false;\n }\n }",
"{\n if (i == p[j]) {\n flg = false;\n }\n }",
"if (i == p[j]) {\n flg = false;\n }",
"i == p[j]",
"i",
"p[j]",
"p",
"j",
"{\n flg = false;\n }",
"flg = false",
"flg",
"false",
"if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }",
"flg",
"{\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }",
"if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }",
"Math.abs(i - x) < ab",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"ab",
"{\n ans = i;\n ab = Math.abs(i - x);\n }",
"ans = i",
"ans",
"i",
"ab = Math.abs(i - x)",
"ab",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"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 @SuppressWarnings(\"resource\")\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 ans = 0;\n int ab = 100;\n for (int i = 0 ; i < n ; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = -100 ; i <= 101 ; i++) {\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }\n System.out.println(ans);\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n @SuppressWarnings(\"resource\")\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 ans = 0;\n int ab = 100;\n for (int i = 0 ; i < n ; i++) {\n p[i] = sc.nextInt();\n }\n for (int i = -100 ; i <= 101 ; i++) {\n boolean flg = true;\n for (int j = 0 ; j < n ; j++) {\n if (i == p[j]) {\n flg = false;\n }\n }\n\n if (flg) {\n if (Math.abs(i - x) < ab) {\n ans = i;\n ab = Math.abs(i - x);\n }\n }\n }\n System.out.println(ans);\n }\n\n}",
"Main"
]
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
int[] p = new int[n];
int ans = 0;
int ab = 100;
for (int i = 0 ; i < n ; i++) {
p[i] = sc.nextInt();
}
for (int i = -100 ; i <= 101 ; i++) {
boolean flg = true;
for (int j = 0 ; j < n ; j++) {
if (i == p[j]) {
flg = false;
}
}
if (flg) {
if (Math.abs(i - x) < ab) {
ans = i;
ab = Math.abs(i - 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,
17,
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,
41,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
13,
41,
13,
17,
42,
2,
13,
17,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
40,
13,
41,
13,
13,
41,
13,
17,
42,
2,
13,
17,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
40,
13,
14,
2,
4,
18,
13,
13,
4,
18,
13,
13,
30,
14,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
30,
0,
13,
13,
30,
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
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
29,
36
],
[
8,
37
],
[
37,
38
],
[
37,
39
],
[
8,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
52,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
8,
62
],
[
62,
63
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
73,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
72,
84
],
[
84,
85
],
[
8,
86
],
[
86,
87
],
[
86,
88
],
[
8,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
97,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
96,
108
],
[
108,
109
],
[
8,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
111,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
110,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
110,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
138,
139
],
[
138,
140
],
[
134,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
144,
145
],
[
144,
146
],
[
133,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
133,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
6,
161
],
[
161,
162
]
]
| [
"import java.util.*;\n\nclass 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 \tint res = 0;\n\n if(N == 0){\n System.out.println(x); \n return;\n }\n \n \t//set\n Set<Integer> s = new HashSet<Integer>(); \n for (int i=0; i<N; i++) {\n int p = sc.nextInt();\n s.add(p);\n } \n \t//while x 0\n \tint t = x;\n \tint resA = 0;\n \twhile(t > 0){\n if(!s.contains(t)){\n resA = t;\n break;\n }\n t--;\n }\n \n \t//while x 100\n int k = x;\n int resB = 101;\n \twhile(k <= 100){\n if(!s.contains(k)){\n resB = k;\n break;\n }\n k++;\n }\n\n \tif(Math.abs(resA) == Math.abs(resB)){\n\t\t if(resA > resB){\n res = resB;\n }else { res = resA;}\n }\n \telse if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n //System.out.println(resA+\" \"+resB);\n\n System.out.println(res);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"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 \tint res = 0;\n\n if(N == 0){\n System.out.println(x); \n return;\n }\n \n \t//set\n Set<Integer> s = new HashSet<Integer>(); \n for (int i=0; i<N; i++) {\n int p = sc.nextInt();\n s.add(p);\n } \n \t//while x 0\n \tint t = x;\n \tint resA = 0;\n \twhile(t > 0){\n if(!s.contains(t)){\n resA = t;\n break;\n }\n t--;\n }\n \n \t//while x 100\n int k = x;\n int resB = 101;\n \twhile(k <= 100){\n if(!s.contains(k)){\n resB = k;\n break;\n }\n k++;\n }\n\n \tif(Math.abs(resA) == Math.abs(resB)){\n\t\t if(resA > resB){\n res = resB;\n }else { res = resA;}\n }\n \telse if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n //System.out.println(resA+\" \"+resB);\n\n System.out.println(res);\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 \tint res = 0;\n\n if(N == 0){\n System.out.println(x); \n return;\n }\n \n \t//set\n Set<Integer> s = new HashSet<Integer>(); \n for (int i=0; i<N; i++) {\n int p = sc.nextInt();\n s.add(p);\n } \n \t//while x 0\n \tint t = x;\n \tint resA = 0;\n \twhile(t > 0){\n if(!s.contains(t)){\n resA = t;\n break;\n }\n t--;\n }\n \n \t//while x 100\n int k = x;\n int resB = 101;\n \twhile(k <= 100){\n if(!s.contains(k)){\n resB = k;\n break;\n }\n k++;\n }\n\n \tif(Math.abs(resA) == Math.abs(resB)){\n\t\t if(resA > resB){\n res = resB;\n }else { res = resA;}\n }\n \telse if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n //System.out.println(resA+\" \"+resB);\n\n System.out.println(res);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int N = sc.nextInt();\n \tint res = 0;\n\n if(N == 0){\n System.out.println(x); \n return;\n }\n \n \t//set\n Set<Integer> s = new HashSet<Integer>(); \n for (int i=0; i<N; i++) {\n int p = sc.nextInt();\n s.add(p);\n } \n \t//while x 0\n \tint t = x;\n \tint resA = 0;\n \twhile(t > 0){\n if(!s.contains(t)){\n resA = t;\n break;\n }\n t--;\n }\n \n \t//while x 100\n int k = x;\n int resB = 101;\n \twhile(k <= 100){\n if(!s.contains(k)){\n resB = k;\n break;\n }\n k++;\n }\n\n \tif(Math.abs(resA) == Math.abs(resB)){\n\t\t if(resA > resB){\n res = resB;\n }else { res = resA;}\n }\n \telse if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }\n //System.out.println(resA+\" \"+resB);\n\n System.out.println(res);\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 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;",
"Set<Integer> s = new HashSet<Integer>();",
"s",
"new HashSet<Integer>()",
"for (int i=0; i<N; i++) {\n int p = sc.nextInt();\n s.add(p);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int p = sc.nextInt();\n s.add(p);\n }",
"{\n int p = sc.nextInt();\n s.add(p);\n }",
"int p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"s.add(p)",
"s.add",
"s",
"p",
"int t = x;",
"t",
"x",
"int resA = 0;",
"resA",
"0",
"while(t > 0){\n if(!s.contains(t)){\n resA = t;\n break;\n }\n t--;\n }",
"t > 0",
"t",
"0",
"{\n if(!s.contains(t)){\n resA = t;\n break;\n }\n t--;\n }",
"if(!s.contains(t)){\n resA = t;\n break;\n }",
"!s.contains(t)",
"s.contains(t)",
"s.contains",
"s",
"t",
"{\n resA = t;\n break;\n }",
"resA = t",
"resA",
"t",
"break;",
"t--",
"t",
"int k = x;",
"k",
"x",
"int resB = 101;",
"resB",
"101",
"while(k <= 100){\n if(!s.contains(k)){\n resB = k;\n break;\n }\n k++;\n }",
"k <= 100",
"k",
"100",
"{\n if(!s.contains(k)){\n resB = k;\n break;\n }\n k++;\n }",
"if(!s.contains(k)){\n resB = k;\n break;\n }",
"!s.contains(k)",
"s.contains(k)",
"s.contains",
"s",
"k",
"{\n resB = k;\n break;\n }",
"resB = k",
"resB",
"k",
"break;",
"k++",
"k",
"if(Math.abs(resA) == Math.abs(resB)){\n\t\t if(resA > resB){\n res = resB;\n }else { res = resA;}\n }\n \telse if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }",
"Math.abs(resA) == Math.abs(resB)",
"Math.abs(resA)",
"Math.abs",
"Math",
"resA",
"Math.abs(resB)",
"Math.abs",
"Math",
"resB",
"{\n\t\t if(resA > resB){\n res = resB;\n }else { res = resA;}\n }",
"if(resA > resB){\n res = resB;\n }else { res = resA;}",
"resA > resB",
"resA",
"resB",
"{\n res = resB;\n }",
"res = resB",
"res",
"resB",
"{ res = resA;}",
"res = resA",
"res",
"resA",
"if(Math.abs(x - resA) > Math.abs(x - resB)){\n res = resB;\n }else{\n res = resA;\n }",
"Math.abs(x - resA) > Math.abs(x - resB)",
"Math.abs(x - resA)",
"Math.abs",
"Math",
"x - resA",
"x",
"resA",
"Math.abs(x - resB)",
"Math.abs",
"Math",
"x - resB",
"x",
"resB",
"{\n res = resB;\n }",
"res = resB",
"res",
"resB",
"{\n res = resA;\n }",
"res = resA",
"res",
"resA",
"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) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int N = sc.nextInt();
int res = 0;
if(N == 0){
System.out.println(x);
return;
}
//set
Set<Integer> s = new HashSet<Integer>();
for (int i=0; i<N; i++) {
int p = sc.nextInt();
s.add(p);
}
//while x 0
int t = x;
int resA = 0;
while(t > 0){
if(!s.contains(t)){
resA = t;
break;
}
t--;
}
//while x 100
int k = x;
int resB = 101;
while(k <= 100){
if(!s.contains(k)){
resB = k;
break;
}
k++;
}
if(Math.abs(resA) == Math.abs(resB)){
if(resA > resB){
res = resB;
}else { res = resA;}
}
else if(Math.abs(x - resA) > Math.abs(x - resB)){
res = resB;
}else{
res = resA;
}
//System.out.println(resA+" "+resB);
System.out.println(res);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
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,
13,
13,
30,
41,
13,
13,
41,
13,
13,
42,
17,
30,
40,
13,
40,
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,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
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,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
36,
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,
18,
36,
29,
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,
14,
2,
13,
17,
29,
4,
18,
13,
13,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
12,
13,
30,
29,
2,
2,
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
],
[
500,
8
],
[
500,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
50,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
65,
67
],
[
61,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
70,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
75,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
81,
86
],
[
75,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
93,
98
],
[
11,
99
],
[
99,
100
],
[
100,
101
],
[
9,
102
],
[
102,
103
],
[
500,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
104,
112
],
[
112,
113
],
[
104,
114
],
[
114,
115
],
[
104,
116
],
[
116,
117
],
[
104,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
118,
126
],
[
126,
127
],
[
104,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
131,
136
],
[
136,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
142,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
164,
165
],
[
130,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
104,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
173,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
178,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
173,
187
],
[
187,
188
],
[
187,
189
],
[
173,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
194,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
173,
203
],
[
203,
204
],
[
203,
205
],
[
173,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
206,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
213,
217
],
[
217,
218
],
[
217,
219
],
[
212,
220
],
[
220,
221
],
[
211,
222
],
[
222,
223
],
[
222,
224
],
[
211,
225
],
[
225,
226
],
[
225,
227
],
[
227,
228
],
[
227,
229
],
[
211,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
173,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
104,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
243,
244
],
[
240,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
245,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
240,
254
],
[
254,
255
],
[
254,
256
],
[
240,
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
],
[
240,
270
],
[
270,
271
],
[
270,
272
],
[
240,
273
],
[
273,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
273,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
281,
283
],
[
280,
284
],
[
284,
285
],
[
284,
286
],
[
279,
287
],
[
287,
288
],
[
278,
289
],
[
289,
290
],
[
289,
291
],
[
278,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
294,
296
],
[
278,
297
],
[
297,
298
],
[
297,
299
],
[
299,
300
],
[
240,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
104,
305
],
[
305,
306
],
[
305,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
307,
312
],
[
312,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
312,
317
],
[
317,
318
],
[
317,
319
],
[
312,
320
],
[
320,
321
],
[
321,
322
],
[
312,
323
],
[
324,
324
],
[
324,
325
],
[
325,
326
],
[
326,
327
],
[
326,
328
],
[
325,
329
],
[
329,
330
],
[
330,
331
],
[
307,
332
],
[
332,
333
],
[
305,
334
],
[
334,
335
],
[
104,
336
],
[
336,
337
],
[
336,
338
],
[
338,
339
],
[
339,
340
],
[
339,
341
],
[
338,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
343,
348
],
[
348,
349
],
[
348,
350
],
[
343,
351
],
[
351,
352
],
[
352,
353
],
[
343,
354
],
[
355,
355
],
[
355,
356
],
[
356,
357
],
[
357,
358
],
[
357,
359
],
[
356,
360
],
[
360,
361
],
[
361,
362
],
[
338,
363
],
[
363,
364
],
[
336,
365
],
[
365,
366
],
[
104,
367
],
[
367,
368
],
[
367,
369
],
[
369,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
369,
374
],
[
374,
375
],
[
375,
376
],
[
375,
377
],
[
374,
378
],
[
378,
379
],
[
379,
380
],
[
379,
381
],
[
381,
382
],
[
369,
383
],
[
383,
384
],
[
383,
385
],
[
369,
386
],
[
386,
387
],
[
387,
388
],
[
388,
389
],
[
388,
390
],
[
386,
391
],
[
391,
392
],
[
392,
393
],
[
393,
394
],
[
392,
395
],
[
391,
396
],
[
396,
397
],
[
396,
398
],
[
398,
399
],
[
369,
400
],
[
400,
401
],
[
401,
402
],
[
402,
403
],
[
104,
404
],
[
404,
405
],
[
404,
406
],
[
406,
407
],
[
407,
408
],
[
407,
409
],
[
409,
410
],
[
406,
411
],
[
411,
412
],
[
412,
413
],
[
412,
414
],
[
411,
415
],
[
415,
416
],
[
415,
417
],
[
417,
418
],
[
406,
419
],
[
419,
420
],
[
419,
421
],
[
406,
422
],
[
422,
423
],
[
423,
424
],
[
424,
425
],
[
424,
426
],
[
422,
427
],
[
427,
428
],
[
428,
429
],
[
429,
430
],
[
428,
431
],
[
427,
432
],
[
432,
433
],
[
432,
434
],
[
434,
435
],
[
406,
436
],
[
436,
437
],
[
437,
438
],
[
438,
439
],
[
104,
440
],
[
440,
441
],
[
440,
442
],
[
442,
443
],
[
443,
444
],
[
444,
445
],
[
444,
446
],
[
443,
447
],
[
447,
448
],
[
448,
449
],
[
449,
450
],
[
448,
451
],
[
442,
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
],
[
440,
473
],
[
473,
474
],
[
104,
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
],
[
104,
493
],
[
493,
494
],
[
493,
495
],
[
495,
496
],
[
495,
497
],
[
497,
498
],
[
0,
499
],
[
499,
500
],
[
499,
501
]
]
| [
"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int x = in.nextInt();\n int n = in.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for (int i = 0; i < n; i++) {\n hs.add(in.nextInt());\n }\n if (!hs.contains(x)) {\n w.println(x);\n } else {\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }\n w.close();\n }\n\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\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] = this.nextInt();\n }\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }\n return a;\n }\n\n public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int x = in.nextInt();\n int n = in.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for (int i = 0; i < n; i++) {\n hs.add(in.nextInt());\n }\n if (!hs.contains(x)) {\n w.println(x);\n } else {\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }\n w.close();\n }\n\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\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] = this.nextInt();\n }\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }\n return a;\n }\n\n public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int x = in.nextInt();\n int n = in.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for (int i = 0; i < n; i++) {\n hs.add(in.nextInt());\n }\n if (!hs.contains(x)) {\n w.println(x);\n } else {\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }\n w.close();\n }",
"main",
"{\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int x = in.nextInt();\n int n = in.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for (int i = 0; i < n; i++) {\n hs.add(in.nextInt());\n }\n if (!hs.contains(x)) {\n w.println(x);\n } else {\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }\n w.close();\n }",
"InputReader in = new InputReader(System.in);",
"in",
"new InputReader(System.in)",
"PrintWriter w = new PrintWriter(System.out);",
"w",
"new PrintWriter(System.out)",
"int x = in.nextInt();",
"x",
"in.nextInt()",
"in.nextInt",
"in",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"HashSet<Integer> hs = new HashSet<>();",
"hs",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n hs.add(in.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n hs.add(in.nextInt());\n }",
"{\n hs.add(in.nextInt());\n }",
"hs.add(in.nextInt())",
"hs.add",
"hs",
"in.nextInt()",
"in.nextInt",
"in",
"if (!hs.contains(x)) {\n w.println(x);\n } else {\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }",
"!hs.contains(x)",
"hs.contains(x)",
"hs.contains",
"hs",
"x",
"{\n w.println(x);\n }",
"w.println(x)",
"w.println",
"w",
"x",
"{\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }",
"int n1 = x;",
"n1",
"x",
"int n2 = x;",
"n2",
"x",
"while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }",
"true",
"{\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }",
"n1--",
"n1",
"n2++",
"n2",
"if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }",
"!hs.contains(n1)",
"hs.contains(n1)",
"hs.contains",
"hs",
"n1",
"{\n w.println(n1);\n break;\n }",
"w.println(n1)",
"w.println",
"w",
"n1",
"break;",
"if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }",
"!hs.contains(n2)",
"hs.contains(n2)",
"hs.contains",
"hs",
"n2",
"{\n w.println(n2);\n break;\n }",
"w.println(n2)",
"w.println",
"w",
"n2",
"break;",
"w.close()",
"w.close",
"w",
"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 private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\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] = this.nextInt();\n }\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }\n return a;\n }\n\n public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\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",
"private SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int snext() {\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 }",
"snext",
"{\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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = snext();",
"c",
"snext()",
"snext",
"while (isSpaceChar(c)) {\n c = snext();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = snext();\n }",
"c = snext()",
"c",
"snext()",
"snext",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = snext();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = snext();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = snext()",
"c",
"snext()",
"snext",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n }",
"if (c < '0' || c > '9')\n throw new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = snext()",
"c",
"snext()",
"snext",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextLong",
"{\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = snext();",
"c",
"snext()",
"snext",
"while (isSpaceChar(c)) {\n c = snext();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = snext();\n }",
"c = snext()",
"c",
"snext()",
"snext",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = snext();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = snext();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = snext()",
"c",
"snext()",
"snext",
"long res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n }",
"if (c < '0' || c > '9')\n throw new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = snext()",
"c",
"snext()",
"snext",
"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] = this.nextInt();\n }\n return a;\n }",
"nextIntArray",
"{\n int a[] = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.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] = this.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = this.nextInt();\n }",
"{\n a[i] = this.nextInt();\n }",
"a[i] = this.nextInt()",
"a[i]",
"a",
"i",
"this.nextInt()",
"this.nextInt",
"this",
"return a;",
"a",
"int n",
"n",
"public long[] nextLongArray(int n) {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }\n return a;\n }",
"nextLongArray",
"{\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }\n return a;\n }",
"long a[] = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = this.nextLong();\n }",
"{\n a[i] = this.nextLong();\n }",
"a[i] = this.nextLong()",
"a[i]",
"a",
"i",
"this.nextLong()",
"this.nextLong",
"this",
"return a;",
"a",
"int n",
"n",
"public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }",
"readString",
"{\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }",
"int c = snext();",
"c",
"snext()",
"snext",
"while (isSpaceChar(c)) {\n c = snext();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = snext();\n }",
"c = snext()",
"c",
"snext()",
"snext",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n res.appendCodePoint(c);\n c = snext();\n }",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = snext()",
"c",
"snext()",
"snext",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }",
"nextLine",
"{\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }",
"int c = snext();",
"c",
"snext()",
"snext",
"while (isSpaceChar(c))\n c = snext();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = snext()",
"c",
"snext()",
"snext",
"StringBuilder res = new StringBuilder();",
"res",
"new StringBuilder()",
"do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));",
"!isEndOfLine(c)",
"isEndOfLine(c)",
"isEndOfLine",
"c",
"{\n res.appendCodePoint(c);\n c = snext();\n }",
"res.appendCodePoint(c)",
"res.appendCodePoint",
"res",
"c",
"c = snext()",
"c",
"snext()",
"snext",
"return res.toString();",
"res.toString()",
"res.toString",
"res",
"public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isSpaceChar",
"{\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"if (filter != null)\n return filter.isSpaceChar(c);",
"filter != null",
"filter",
"null",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"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 interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int x = in.nextInt();\n int n = in.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for (int i = 0; i < n; i++) {\n hs.add(in.nextInt());\n }\n if (!hs.contains(x)) {\n w.println(x);\n } else {\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }\n w.close();\n }\n\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\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] = this.nextInt();\n }\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }\n return a;\n }\n\n public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int x = in.nextInt();\n int n = in.nextInt();\n HashSet<Integer> hs = new HashSet<>();\n for (int i = 0; i < n; i++) {\n hs.add(in.nextInt());\n }\n if (!hs.contains(x)) {\n w.println(x);\n } else {\n int n1 = x;\n int n2 = x;\n while (true) {\n n1--;\n n2++;\n if (!hs.contains(n1)) {\n w.println(n1);\n break;\n } else if (!hs.contains(n2)) {\n w.println(n2);\n break;\n }\n }\n }\n w.close();\n }\n\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\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] = this.nextInt();\n }\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = this.nextLong();\n }\n return a;\n }\n\n public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"Main"
]
| import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int x = in.nextInt();
int n = in.nextInt();
HashSet<Integer> hs = new HashSet<>();
for (int i = 0; i < n; i++) {
hs.add(in.nextInt());
}
if (!hs.contains(x)) {
w.println(x);
} else {
int n1 = x;
int n2 = x;
while (true) {
n1--;
n2++;
if (!hs.contains(n1)) {
w.println(n1);
break;
} else if (!hs.contains(n2)) {
w.println(n2);
break;
}
}
}
w.close();
}
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int snext() {
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 = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} 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] = this.nextInt();
}
return a;
}
public long[] nextLongArray(int n) {
long a[] = new long[n];
for (int i = 0; i < n; i++) {
a[i] = this.nextLong();
}
return a;
}
public String readString() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = snext();
while (isSpaceChar(c))
c = snext();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
13,
41,
13,
13,
41,
13,
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,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
13,
13,
30,
0,
13,
13,
3,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
13,
13,
30,
0,
13,
13,
3,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
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
],
[
203,
5
],
[
203,
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
],
[
35,
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
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
58,
68
],
[
68,
69
],
[
69,
70
],
[
58,
71
],
[
72,
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
],
[
88,
90
],
[
87,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
72,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
72,
104
],
[
104,
105
],
[
104,
106
],
[
72,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
8,
112
],
[
112,
113
],
[
112,
114
],
[
8,
115
],
[
115,
116
],
[
115,
117
],
[
8,
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
],
[
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
],
[
132,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
132,
164
],
[
164,
165
],
[
164,
166
],
[
132,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
169,
171
],
[
8,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
8,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
179,
181
],
[
8,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
187,
192
],
[
182,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
194,
199
],
[
6,
200
],
[
200,
201
],
[
0,
202
],
[
202,
203
],
[
202,
204
]
]
| [
"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 p[] = new int[N];\n\n\t\tint a = X;\n\t\tint ans1 = X;\n\t\tint ans2 = X;\n\t\tint s = 0;\n\n\t\tfor(int i = 0;i<N;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}\n\t\tX=a;\n\t\ts=0;\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}\n\n\t\tX=a-ans1;\n\t\tN=ans2-a;\n\n\t\tif(X<=N) {\n\t\t\tSystem.out.println(ans1);\n\t\t}else {\n\t\t\tSystem.out.println(ans2);\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\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 p[] = new int[N];\n\n\t\tint a = X;\n\t\tint ans1 = X;\n\t\tint ans2 = X;\n\t\tint s = 0;\n\n\t\tfor(int i = 0;i<N;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}\n\t\tX=a;\n\t\ts=0;\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}\n\n\t\tX=a-ans1;\n\t\tN=ans2-a;\n\n\t\tif(X<=N) {\n\t\t\tSystem.out.println(ans1);\n\t\t}else {\n\t\t\tSystem.out.println(ans2);\n\t\t}\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint p[] = new int[N];\n\n\t\tint a = X;\n\t\tint ans1 = X;\n\t\tint ans2 = X;\n\t\tint s = 0;\n\n\t\tfor(int i = 0;i<N;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}\n\t\tX=a;\n\t\ts=0;\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}\n\n\t\tX=a-ans1;\n\t\tN=ans2-a;\n\n\t\tif(X<=N) {\n\t\t\tSystem.out.println(ans1);\n\t\t}else {\n\t\t\tSystem.out.println(ans2);\n\t\t}\n\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 p[] = new int[N];\n\n\t\tint a = X;\n\t\tint ans1 = X;\n\t\tint ans2 = X;\n\t\tint s = 0;\n\n\t\tfor(int i = 0;i<N;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}\n\t\tX=a;\n\t\ts=0;\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}\n\n\t\tX=a-ans1;\n\t\tN=ans2-a;\n\n\t\tif(X<=N) {\n\t\t\tSystem.out.println(ans1);\n\t\t}else {\n\t\t\tSystem.out.println(ans2);\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",
"int p[] = new int[N];",
"p",
"new int[N]",
"N",
"int a = X;",
"a",
"X",
"int ans1 = X;",
"ans1",
"X",
"int ans2 = X;",
"ans2",
"X",
"int s = 0;",
"s",
"0",
"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",
"for(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i<N+1",
"i",
"N+1",
"N",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}",
"{\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}",
"for(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\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]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}",
"if(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}",
"p[j]!=X",
"p[j]",
"p",
"j",
"X",
"{\n\t\t\t\t\ts++;\n\t\t\t\t}",
"s++",
"s",
"if(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}",
"s==N",
"s",
"N",
"{\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}",
"ans1 = X",
"ans1",
"X",
"break;",
"s=0",
"s",
"0",
"X = X-1",
"X",
"X-1",
"X",
"1",
"X=a",
"X",
"a",
"s=0",
"s",
"0",
"for(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i<N+1",
"i",
"N+1",
"N",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}",
"{\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}",
"for(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\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]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}",
"if(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}",
"p[j]!=X",
"p[j]",
"p",
"j",
"X",
"{\n\t\t\t\t\ts++;\n\t\t\t\t}",
"s++",
"s",
"if(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}",
"s==N",
"s",
"N",
"{\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}",
"ans2 = X",
"ans2",
"X",
"break;",
"s=0",
"s",
"0",
"X = X+1",
"X",
"X+1",
"X",
"1",
"X=a-ans1",
"X",
"a-ans1",
"a",
"ans1",
"N=ans2-a",
"N",
"ans2-a",
"ans2",
"a",
"if(X<=N) {\n\t\t\tSystem.out.println(ans1);\n\t\t}else {\n\t\t\tSystem.out.println(ans2);\n\t\t}",
"X<=N",
"X",
"N",
"{\n\t\t\tSystem.out.println(ans1);\n\t\t}",
"System.out.println(ans1)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans1",
"{\n\t\t\tSystem.out.println(ans2);\n\t\t}",
"System.out.println(ans2)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans2",
"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 p[] = new int[N];\n\n\t\tint a = X;\n\t\tint ans1 = X;\n\t\tint ans2 = X;\n\t\tint s = 0;\n\n\t\tfor(int i = 0;i<N;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}\n\t\tX=a;\n\t\ts=0;\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}\n\n\t\tX=a-ans1;\n\t\tN=ans2-a;\n\n\t\tif(X<=N) {\n\t\t\tSystem.out.println(ans1);\n\t\t}else {\n\t\t\tSystem.out.println(ans2);\n\t\t}\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tint p[] = new int[N];\n\n\t\tint a = X;\n\t\tint ans1 = X;\n\t\tint ans2 = X;\n\t\tint s = 0;\n\n\t\tfor(int i = 0;i<N;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans1 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X-1;\n\t\t}\n\t\tX=a;\n\t\ts=0;\n\t\tfor(int i = 0 ;i<N+1;i++) {\n\t\t\tfor(int j = 0;j<N;j++) {\n\t\t\t\tif(p[j]!=X) {\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s==N) {\n\t\t\t\tans2 = X;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts=0;\n\t\t\tX = X+1;\n\t\t}\n\n\t\tX=a-ans1;\n\t\tN=ans2-a;\n\n\t\tif(X<=N) {\n\t\t\tSystem.out.println(ans1);\n\t\t}else {\n\t\t\tSystem.out.println(ans2);\n\t\t}\n\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int N = sc.nextInt();
int p[] = new int[N];
int a = X;
int ans1 = X;
int ans2 = X;
int s = 0;
for(int i = 0;i<N;i++) {
p[i] = sc.nextInt();
}
for(int i = 0 ;i<N+1;i++) {
for(int j = 0;j<N;j++) {
if(p[j]!=X) {
s++;
}
}
if(s==N) {
ans1 = X;
break;
}
s=0;
X = X-1;
}
X=a;
s=0;
for(int i = 0 ;i<N+1;i++) {
for(int j = 0;j<N;j++) {
if(p[j]!=X) {
s++;
}
}
if(s==N) {
ans2 = X;
break;
}
s=0;
X = X+1;
}
X=a-ans1;
N=ans2-a;
if(X<=N) {
System.out.println(ans1);
}else {
System.out.println(ans2);
}
}
}
|
[
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,
2,
18,
13,
13,
17,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
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
],
[
102,
5
],
[
102,
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
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
53,
59
],
[
59,
60
],
[
59,
61
],
[
53,
62
],
[
62,
63
],
[
63,
64
],
[
53,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
77,
79
],
[
73,
80
],
[
66,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
90,
91
],
[
90,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
6,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
]
| [
"import java.util.*;\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\tint ans = 0, min = Integer.MAX_VALUE/2;\n\t\tfor(int i = -100; i <= 200; i++)\n\t\t\tif(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"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\tint ans = 0, min = Integer.MAX_VALUE/2;\n\t\tfor(int i = -100; i <= 200; i++)\n\t\t\tif(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}\n\t\tSystem.out.println(ans);\n\t}\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\tSet<Integer> p = new HashSet<>();\n\t\tfor(int i = 0; i < N; i++)\n\t\t\tp.add(sc.nextInt());\n\t\tint ans = 0, min = Integer.MAX_VALUE/2;\n\t\tfor(int i = -100; i <= 200; i++)\n\t\t\tif(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}\n\t\tSystem.out.println(ans);\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\tint ans = 0, min = Integer.MAX_VALUE/2;\n\t\tfor(int i = -100; i <= 200; i++)\n\t\t\tif(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\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",
"Set<Integer> p = new HashSet<>();",
"p",
"new HashSet<>()",
"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",
"int ans = 0",
"ans",
"0",
"min = Integer.MAX_VALUE/2;",
"min",
"Integer.MAX_VALUE/2",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"2",
"for(int i = -100; i <= 200; i++)\n\t\t\tif(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}",
"int i = -100;",
"int i = -100;",
"i",
"-100",
"100",
"i <= 200",
"i",
"200",
"i++",
"i++",
"i",
"if(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}",
"if(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = 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\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}",
"ans = i",
"ans",
"i",
"min = Math.abs(i-X)",
"min",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"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 = 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\tint ans = 0, min = Integer.MAX_VALUE/2;\n\t\tfor(int i = -100; i <= 200; i++)\n\t\t\tif(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}\n\t\tSystem.out.println(ans);\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 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\tint ans = 0, min = Integer.MAX_VALUE/2;\n\t\tfor(int i = -100; i <= 200; i++)\n\t\t\tif(!p.contains(i) && Math.abs(i-X) < min) {\n\t\t\t\tans = i;\n\t\t\t\tmin = Math.abs(i-X);\n\t\t\t}\n\t\tSystem.out.println(ans);\n\t}\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> p = new HashSet<>();
for(int i = 0; i < N; i++)
p.add(sc.nextInt());
int ans = 0, min = Integer.MAX_VALUE/2;
for(int i = -100; i <= 200; i++)
if(!p.contains(i) && Math.abs(i-X) < min) {
ans = i;
min = Math.abs(i-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,
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,
14,
2,
4,
18,
13,
13,
13,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
2,
4,
18,
13,
13,
13,
2,
4,
18,
13,
13,
4,
18,
13,
13,
30,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
14,
2,
2,
13,
4,
18,
13,
2,
13,
17,
2,
4,
18,
13,
2,
13,
17,
13,
30,
4,
18,
18,
13,
13,
4,
18,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
4,
18,
13,
2,
13,
17,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
196,
5
],
[
196,
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
],
[
43,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
51,
56
],
[
50,
57
],
[
57,
58
],
[
57,
59
],
[
8,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
62,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
90,
100
],
[
100,
101
],
[
101,
102
],
[
90,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
105,
115
],
[
115,
116
],
[
116,
117
],
[
105,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
122,
127
],
[
121,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
128,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
120,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
8,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
8,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
155,
156
],
[
155,
157
],
[
149,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
162,
163
],
[
162,
164
],
[
158,
165
],
[
148,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
173,
174
],
[
172,
175
],
[
175,
176
],
[
175,
177
],
[
148,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
179,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
187,
188
],
[
187,
189
],
[
8,
190
],
[
190,
191
],
[
191,
192
],
[
6,
193
],
[
193,
194
],
[
0,
195
],
[
195,
196
],
[
195,
197
]
]
| [
"import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint X = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tList<Integer> data = new ArrayList<Integer>();\n\t\tboolean b = true;\n\n\t\tfor(int i = 0; i < N;i++) {\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}\n\t\tif(b) {\n\t\t\tSystem.out.println(X);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0;i<=101;i++) {\n\t\t\tdata.add(i);\n\t\t}\n\t\tfor(int i = 0; i < nums.size();i++) {\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint Xindex = data.indexOf(X);\n\t\tif(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}else {\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}\n\t\tscanner.close();\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint X = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tList<Integer> data = new ArrayList<Integer>();\n\t\tboolean b = true;\n\n\t\tfor(int i = 0; i < N;i++) {\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}\n\t\tif(b) {\n\t\t\tSystem.out.println(X);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0;i<=101;i++) {\n\t\t\tdata.add(i);\n\t\t}\n\t\tfor(int i = 0; i < nums.size();i++) {\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint Xindex = data.indexOf(X);\n\t\tif(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}else {\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}\n\t\tscanner.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint X = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tList<Integer> data = new ArrayList<Integer>();\n\t\tboolean b = true;\n\n\t\tfor(int i = 0; i < N;i++) {\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}\n\t\tif(b) {\n\t\t\tSystem.out.println(X);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0;i<=101;i++) {\n\t\t\tdata.add(i);\n\t\t}\n\t\tfor(int i = 0; i < nums.size();i++) {\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint Xindex = data.indexOf(X);\n\t\tif(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}else {\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}\n\t\tscanner.close();\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint X = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tList<Integer> data = new ArrayList<Integer>();\n\t\tboolean b = true;\n\n\t\tfor(int i = 0; i < N;i++) {\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}\n\t\tif(b) {\n\t\t\tSystem.out.println(X);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0;i<=101;i++) {\n\t\t\tdata.add(i);\n\t\t}\n\t\tfor(int i = 0; i < nums.size();i++) {\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint Xindex = data.indexOf(X);\n\t\tif(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}else {\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}\n\t\tscanner.close();\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",
"List<Integer> nums = new ArrayList<Integer>();",
"nums",
"new ArrayList<Integer>()",
"List<Integer> data = new ArrayList<Integer>();",
"data",
"new ArrayList<Integer>()",
"boolean b = true;",
"b",
"true",
"for(int i = 0; i < N;i++) {\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}",
"{\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}",
"nums.add(scanner.nextInt())",
"nums.add",
"nums",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"if(nums.get(i) == X)b = false;",
"nums.get(i) == X",
"nums.get(i)",
"nums.get",
"nums",
"i",
"X",
"b = false",
"b",
"false",
"if(b) {\n\t\t\tSystem.out.println(X);\n\t\t\tSystem.exit(0);\n\t\t}",
"b",
"{\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<=101;i++) {\n\t\t\tdata.add(i);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tdata.add(i);\n\t\t}",
"{\n\t\t\tdata.add(i);\n\t\t}",
"data.add(i)",
"data.add",
"data",
"i",
"for(int i = 0; i < nums.size();i++) {\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < nums.size()",
"i",
"nums.size()",
"nums.size",
"nums",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j<data.size()",
"j",
"data.size()",
"data.size",
"data",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}",
"if(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}",
"data.get(j) != X && nums.get(i) == data.get(j)",
"data.get(j) != X",
"data.get(j)",
"data.get",
"data",
"j",
"X",
"nums.get(i) == data.get(j)",
"nums.get(i)",
"nums.get",
"nums",
"i",
"data.get(j)",
"data.get",
"data",
"j",
"{\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}",
"data.remove(j)",
"data.remove",
"data",
"j",
"int Xindex = data.indexOf(X);",
"Xindex",
"data.indexOf(X)",
"data.indexOf",
"data",
"X",
"if(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}else {\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}",
"X-data.get(Xindex-1)<=data.get(Xindex+1)-X",
"X-data.get(Xindex-1)",
"X",
"data.get(Xindex-1)",
"data.get",
"data",
"Xindex-1",
"Xindex",
"1",
"data.get(Xindex+1)-X",
"data.get(Xindex+1)",
"data.get",
"data",
"Xindex+1",
"Xindex",
"1",
"X",
"{\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}",
"System.out.println(data.get(Xindex-1))",
"System.out.println",
"System.out",
"System",
"System.out",
"data.get(Xindex-1)",
"data.get",
"data",
"Xindex-1",
"Xindex",
"1",
"{\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}",
"System.out.println(data.get(Xindex+1))",
"System.out.println",
"System.out",
"System",
"System.out",
"data.get(Xindex+1)",
"data.get",
"data",
"Xindex+1",
"Xindex",
"1",
"scanner.close()",
"scanner.close",
"scanner",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint X = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tList<Integer> data = new ArrayList<Integer>();\n\t\tboolean b = true;\n\n\t\tfor(int i = 0; i < N;i++) {\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}\n\t\tif(b) {\n\t\t\tSystem.out.println(X);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0;i<=101;i++) {\n\t\t\tdata.add(i);\n\t\t}\n\t\tfor(int i = 0; i < nums.size();i++) {\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint Xindex = data.indexOf(X);\n\t\tif(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}else {\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}\n\t\tscanner.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint X = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\t\tList<Integer> nums = new ArrayList<Integer>();\n\t\tList<Integer> data = new ArrayList<Integer>();\n\t\tboolean b = true;\n\n\t\tfor(int i = 0; i < N;i++) {\n\t\t\tnums.add(scanner.nextInt());\n\t\t\tif(nums.get(i) == X)b = false;\n\t\t}\n\t\tif(b) {\n\t\t\tSystem.out.println(X);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tfor(int i = 0;i<=101;i++) {\n\t\t\tdata.add(i);\n\t\t}\n\t\tfor(int i = 0; i < nums.size();i++) {\n\t\t\tfor(int j = 0; j<data.size();j++) {\n\t\t\t\tif(data.get(j) != X && nums.get(i) == data.get(j)) {\n\t\t\t\t\tdata.remove(j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint Xindex = data.indexOf(X);\n\t\tif(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {\n\t\t\tSystem.out.println(data.get(Xindex-1));\n\t\t}else {\n\t\t\tSystem.out.println(data.get(Xindex+1));\n\t\t}\n\t\tscanner.close();\n\t}\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();
List<Integer> nums = new ArrayList<Integer>();
List<Integer> data = new ArrayList<Integer>();
boolean b = true;
for(int i = 0; i < N;i++) {
nums.add(scanner.nextInt());
if(nums.get(i) == X)b = false;
}
if(b) {
System.out.println(X);
System.exit(0);
}
for(int i = 0;i<=101;i++) {
data.add(i);
}
for(int i = 0; i < nums.size();i++) {
for(int j = 0; j<data.size();j++) {
if(data.get(j) != X && nums.get(i) == data.get(j)) {
data.remove(j);
}
}
}
int Xindex = data.indexOf(X);
if(X-data.get(Xindex-1)<=data.get(Xindex+1)-X) {
System.out.println(data.get(Xindex-1));
}else {
System.out.println(data.get(Xindex+1));
}
scanner.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
11,
1,
41,
13,
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,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
0,
13,
13,
3,
4,
18,
18,
13,
13,
8,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
34,
35
],
[
35,
36
],
[
17,
37
],
[
37,
38
],
[
37,
39
],
[
17,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
17,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
17,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
17,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
17,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
17,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
100,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
113,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
17,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
134,
135
],
[
134,
136
],
[
130,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
140,
141
],
[
140,
142
],
[
129,
143
],
[
129,
144
],
[
15,
145
],
[
145,
146
]
]
| [
"import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = Integer.parseInt(sc.next());\n\t\tint N = Integer.parseInt(sc.next());\n\t\tList<Integer> list = new ArrayList();\n\t\tfor(int i=1; i<=N; i++) {\n\t\t\tlist.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tCollections.sort(list);\n\n\t\tint n1 = Integer.MAX_VALUE;\n\t\tint n2 = Integer.MAX_VALUE;\n\t\tfor(int i=X; i<=101; i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor(int i=X;i >=0;i--) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);\n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = Integer.parseInt(sc.next());\n\t\tint N = Integer.parseInt(sc.next());\n\t\tList<Integer> list = new ArrayList();\n\t\tfor(int i=1; i<=N; i++) {\n\t\t\tlist.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tCollections.sort(list);\n\n\t\tint n1 = Integer.MAX_VALUE;\n\t\tint n2 = Integer.MAX_VALUE;\n\t\tfor(int i=X; i<=101; i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor(int i=X;i >=0;i--) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = Integer.parseInt(sc.next());\n\t\tint N = Integer.parseInt(sc.next());\n\t\tList<Integer> list = new ArrayList();\n\t\tfor(int i=1; i<=N; i++) {\n\t\t\tlist.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tCollections.sort(list);\n\n\t\tint n1 = Integer.MAX_VALUE;\n\t\tint n2 = Integer.MAX_VALUE;\n\t\tfor(int i=X; i<=101; i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor(int i=X;i >=0;i--) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint X = Integer.parseInt(sc.next());\n\t\tint N = Integer.parseInt(sc.next());\n\t\tList<Integer> list = new ArrayList();\n\t\tfor(int i=1; i<=N; i++) {\n\t\t\tlist.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tCollections.sort(list);\n\n\t\tint n1 = Integer.MAX_VALUE;\n\t\tint n2 = Integer.MAX_VALUE;\n\t\tfor(int i=X; i<=101; i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor(int i=X;i >=0;i--) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"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",
"List<Integer> list = new ArrayList();",
"list",
"new ArrayList()",
"for(int i=1; i<=N; i++) {\n\t\t\tlist.add(Integer.parseInt(sc.next()));\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<=N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tlist.add(Integer.parseInt(sc.next()));\n\t\t}",
"{\n\t\t\tlist.add(Integer.parseInt(sc.next()));\n\t\t}",
"list.add(Integer.parseInt(sc.next()))",
"list.add",
"list",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"int n1 = Integer.MAX_VALUE;",
"n1",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int n2 = Integer.MAX_VALUE;",
"n2",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"for(int i=X; i<=101; i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i=X;",
"int i=X;",
"i",
"X",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(!list.contains(i)) {\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(i)",
"list.contains(i)",
"list.contains",
"list",
"i",
"{\n\t\t\t\tn1=i;\n\t\t\t\tbreak;\n\t\t\t}",
"n1=i",
"n1",
"i",
"break;",
"for(int i=X;i >=0;i--) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i=X;",
"int i=X;",
"i",
"X",
"i >=0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(!list.contains(i)) {\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(i)",
"list.contains(i)",
"list.contains",
"list",
"i",
"{\n\t\t\t\tn2=i;\n\t\t\t\tbreak;\n\t\t\t}",
"n2=i",
"n2",
"i",
"break;",
"System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1)",
"System.out.println",
"System.out",
"System",
"System.out",
"Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1",
"Math.abs(X-n2)<= Math.abs(n1-X)",
"Math.abs(X-n2)",
"Math.abs",
"Math",
"X-n2",
"X",
"n2",
"Math.abs(n1-X)",
"Math.abs",
"Math",
"n1-X",
"n1",
"X",
"n2",
"n1",
"String[] args",
"args"
]
| import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = Integer.parseInt(sc.next());
int N = Integer.parseInt(sc.next());
List<Integer> list = new ArrayList();
for(int i=1; i<=N; i++) {
list.add(Integer.parseInt(sc.next()));
}
Collections.sort(list);
int n1 = Integer.MAX_VALUE;
int n2 = Integer.MAX_VALUE;
for(int i=X; i<=101; i++) {
if(!list.contains(i)) {
n1=i;
break;
}
}
for(int i=X;i >=0;i--) {
if(!list.contains(i)) {
n2=i;
break;
}
}
System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
20,
12,
13,
30,
41,
13,
20,
41,
13,
20,
4,
18,
13,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
4,
18,
13,
0,
18,
36,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
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,
29,
13,
12,
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
],
[
147,
11
],
[
147,
12
],
[
12,
13
],
[
147,
14
],
[
14,
15
],
[
147,
16
],
[
16,
17
],
[
147,
18
],
[
18,
19
],
[
18,
20
],
[
147,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
23,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
33,
34
],
[
34,
35
],
[
23,
36
],
[
36,
37
],
[
37,
38
],
[
21,
39
],
[
39,
40
],
[
147,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
43,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
43,
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
],
[
76,
79
],
[
79,
80
],
[
80,
81
],
[
41,
82
],
[
82,
83
],
[
147,
84
],
[
84,
85
],
[
84,
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
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
108,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
103,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
126,
132
],
[
86,
133
],
[
133,
134
],
[
147,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
135,
144
],
[
144,
145
],
[
0,
146
],
[
146,
147
],
[
146,
148
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n m.show(m.solve());\n sc.close();\n }\n \n\t//フィールド\n Scanner sc;\n int X;\n int N;\n List<Integer> p = new ArrayList<Integer>();;\n \n //入力\n Main(Scanner sc) {\n this.sc = sc;\n this.X = sc.nextInt();\n this.N = sc.nextInt();\n for (int i = 0; i< N; i++) {\n \tp.add(sc.nextInt());\n }\n }\n \n //解答処理\n private int solve() {\n int answer = 0;\n \n for (int i = 0; i<= 100; i++) {\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }\n \n return answer;\n }\n \n //出力\n public void show(int answer) {\n System.out.println(answer);\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\tpublic static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n m.show(m.solve());\n sc.close();\n }\n \n\t//フィールド\n Scanner sc;\n int X;\n int N;\n List<Integer> p = new ArrayList<Integer>();;\n \n //入力\n Main(Scanner sc) {\n this.sc = sc;\n this.X = sc.nextInt();\n this.N = sc.nextInt();\n for (int i = 0; i< N; i++) {\n \tp.add(sc.nextInt());\n }\n }\n \n //解答処理\n private int solve() {\n int answer = 0;\n \n for (int i = 0; i<= 100; i++) {\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }\n \n return answer;\n }\n \n //出力\n public void show(int answer) {\n System.out.println(answer);\n }\n\n}",
"Main",
"//フィールド\n Scanner sc;",
"sc",
"int X;",
"X",
"int N;",
"N",
"List<Integer> p = new ArrayList<Integer>();",
"p",
"new ArrayList<Integer>()",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n m.show(m.solve());\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n m.show(m.solve());\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"Main m = new Main(sc);",
"m",
"new Main(sc)",
"m.show(m.solve())",
"m.show",
"m",
"m.solve()",
"m.solve",
"m",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"//入力\n Main(Scanner sc) {\n this.sc = sc;\n this.X = sc.nextInt();\n this.N = sc.nextInt();\n for (int i = 0; i< N; i++) {\n \tp.add(sc.nextInt());\n }\n }",
"Main",
"{\n this.sc = sc;\n this.X = sc.nextInt();\n this.N = sc.nextInt();\n for (int i = 0; i< N; i++) {\n \tp.add(sc.nextInt());\n }\n }",
"this.sc = sc",
"this.sc",
"this",
"this.sc",
"sc",
"this.X = sc.nextInt()",
"this.X",
"this",
"this.X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"this.N = sc.nextInt()",
"this.N",
"this",
"this.N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i< N; i++) {\n \tp.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i< N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \tp.add(sc.nextInt());\n }",
"{\n \tp.add(sc.nextInt());\n }",
"p.add(sc.nextInt())",
"p.add",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Scanner sc",
"sc",
"//解答処理\n private int solve() {\n int answer = 0;\n \n for (int i = 0; i<= 100; i++) {\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }\n \n return answer;\n }",
"solve",
"{\n int answer = 0;\n \n for (int i = 0; i<= 100; i++) {\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }\n \n return answer;\n }",
"int answer = 0;",
"answer",
"0",
"for (int i = 0; i<= 100; i++) {\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<= 100",
"i",
"100",
"i++",
"i++",
"i",
"{\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }",
"{\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }",
"if (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}",
"!p.contains(X - i)",
"p.contains(X - i)",
"p.contains",
"p",
"X - i",
"X",
"i",
"{\n \t\tanswer = X - i;\n \t\tbreak;\n \t}",
"answer = X - i",
"answer",
"X - i",
"X",
"i",
"break;",
"if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}",
"!p.contains(X + i)",
"p.contains(X + i)",
"p.contains",
"p",
"X + i",
"X",
"i",
"{\n \t\tanswer = X + i;\n \t\tbreak;\n \t}",
"answer = X + i",
"answer",
"X + i",
"X",
"i",
"break;",
"return answer;",
"answer",
"//出力\n public void show(int answer) {\n System.out.println(answer);\n }",
"show",
"{\n System.out.println(answer);\n }",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"int answer",
"answer",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n m.show(m.solve());\n sc.close();\n }\n \n\t//フィールド\n Scanner sc;\n int X;\n int N;\n List<Integer> p = new ArrayList<Integer>();;\n \n //入力\n Main(Scanner sc) {\n this.sc = sc;\n this.X = sc.nextInt();\n this.N = sc.nextInt();\n for (int i = 0; i< N; i++) {\n \tp.add(sc.nextInt());\n }\n }\n \n //解答処理\n private int solve() {\n int answer = 0;\n \n for (int i = 0; i<= 100; i++) {\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }\n \n return answer;\n }\n \n //出力\n public void show(int answer) {\n System.out.println(answer);\n }\n\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n m.show(m.solve());\n sc.close();\n }\n \n\t//フィールド\n Scanner sc;\n int X;\n int N;\n List<Integer> p = new ArrayList<Integer>();;\n \n //入力\n Main(Scanner sc) {\n this.sc = sc;\n this.X = sc.nextInt();\n this.N = sc.nextInt();\n for (int i = 0; i< N; i++) {\n \tp.add(sc.nextInt());\n }\n }\n \n //解答処理\n private int solve() {\n int answer = 0;\n \n for (int i = 0; i<= 100; i++) {\n \tif (!p.contains(X - i)) {\n \t\tanswer = X - i;\n \t\tbreak;\n \t} else if (!p.contains(X + i)) {\n \t\tanswer = X + i;\n \t\tbreak;\n \t}\n }\n \n return answer;\n }\n \n //出力\n public void show(int answer) {\n System.out.println(answer);\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) throws Exception {
Scanner sc = new Scanner(System.in);
Main m = new Main(sc);
m.show(m.solve());
sc.close();
}
//フィールド
Scanner sc;
int X;
int N;
List<Integer> p = new ArrayList<Integer>();;
//入力
Main(Scanner sc) {
this.sc = sc;
this.X = sc.nextInt();
this.N = sc.nextInt();
for (int i = 0; i< N; i++) {
p.add(sc.nextInt());
}
}
//解答処理
private int solve() {
int answer = 0;
for (int i = 0; i<= 100; i++) {
if (!p.contains(X - i)) {
answer = X - i;
break;
} else if (!p.contains(X + i)) {
answer = X + i;
break;
}
}
return answer;
}
//出力
public void show(int answer) {
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
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,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
106,
5
],
[
106,
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
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
52,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
52,
64
],
[
64,
65
],
[
65,
66
],
[
52,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
69,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
82,
84
],
[
76,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
91,
93
],
[
85,
94
],
[
94,
95
],
[
94,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
6,
103
],
[
103,
104
],
[
0,
105
],
[
105,
106
],
[
105,
107
]
]
| [
"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\tHashSet<Integer> set = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t set.add(sc.nextInt());\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint minvalue = 0;\n\t\tfor (int i = x - 100; i <= x + 100; i++) {\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}\n\t System.out.println(minvalue);\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\tHashSet<Integer> set = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t set.add(sc.nextInt());\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint minvalue = 0;\n\t\tfor (int i = x - 100; i <= x + 100; i++) {\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}\n\t System.out.println(minvalue);\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\tHashSet<Integer> set = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t set.add(sc.nextInt());\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint minvalue = 0;\n\t\tfor (int i = x - 100; i <= x + 100; i++) {\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}\n\t System.out.println(minvalue);\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\tHashSet<Integer> set = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t set.add(sc.nextInt());\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint minvalue = 0;\n\t\tfor (int i = x - 100; i <= x + 100; i++) {\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}\n\t System.out.println(minvalue);\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",
"HashSet<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int i = 0; i < n; i++) {\n\t\t set.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t set.add(sc.nextInt());\n\t\t}",
"{\n\t\t set.add(sc.nextInt());\n\t\t}",
"set.add(sc.nextInt())",
"set.add",
"set",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int minvalue = 0;",
"minvalue",
"0",
"for (int i = x - 100; i <= x + 100; i++) {\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}",
"int i = x - 100;",
"int i = x - 100;",
"i",
"x - 100",
"x",
"100",
"i <= x + 100",
"i",
"x + 100",
"x",
"100",
"i++",
"i++",
"i",
"{\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}",
"{\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}",
"if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }",
"!set.contains(i)",
"set.contains(i)",
"set.contains",
"set",
"i",
"{\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }",
"if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }",
"min > Math.abs(x - i)",
"min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"{\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }",
"min = Math.abs(x - i)",
"min",
"Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"minvalue = i",
"minvalue",
"i",
"System.out.println(minvalue)",
"System.out.println",
"System.out",
"System",
"System.out",
"minvalue",
"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\tHashSet<Integer> set = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t set.add(sc.nextInt());\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint minvalue = 0;\n\t\tfor (int i = x - 100; i <= x + 100; i++) {\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}\n\t System.out.println(minvalue);\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\tHashSet<Integer> set = new HashSet<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t set.add(sc.nextInt());\n\t\t}\n\t\tint min = Integer.MAX_VALUE;\n\t\tint minvalue = 0;\n\t\tfor (int i = x - 100; i <= x + 100; i++) {\n\t\t if (!set.contains(i)) {\n\t\t if (min > Math.abs(x - i)) {\n\t\t min = Math.abs(x - i);\n\t\t minvalue = i;\n\t\t }\n\t\t }\n\t\t}\n\t System.out.println(minvalue);\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();
HashSet<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
set.add(sc.nextInt());
}
int min = Integer.MAX_VALUE;
int minvalue = 0;
for (int i = x - 100; i <= x + 100; i++) {
if (!set.contains(i)) {
if (min > Math.abs(x - i)) {
min = Math.abs(x - i);
minvalue = i;
}
}
}
System.out.println(minvalue);
}
}
|
[
7,
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,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
4,
18,
13,
13,
0,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
20,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
14,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
4,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
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
],
[
150,
8
],
[
150,
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
],
[
22,
23
],
[
23,
24
],
[
20,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
31,
32
],
[
31,
33
],
[
11,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
39,
40
],
[
39,
41
],
[
11,
42
],
[
42,
43
],
[
42,
44
],
[
11,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
50,
51
],
[
50,
52
],
[
45,
53
],
[
53,
54
],
[
54,
55
],
[
45,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
11,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
63,
68
],
[
11,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
11,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
11,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
11,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
102,
104
],
[
98,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
108,
110
],
[
97,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
97,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
120,
121
],
[
120,
122
],
[
116,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
126,
127
],
[
126,
128
],
[
115,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
115,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
136,
140
],
[
11,
141
],
[
141,
142
],
[
142,
143
],
[
11,
144
],
[
144,
145
],
[
145,
146
],
[
9,
147
],
[
147,
148
],
[
0,
149
],
[
149,
150
],
[
149,
151
]
]
| [
"import java.util.*;\nimport java.io.*;\npublic class Main\n{\n public static void main(String args[])throws Exception\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw=new PrintWriter(System.out);\n String str[]=br.readLine().split(\" \");\n int x=Integer.parseInt(str[0]);\n int n=Integer.parseInt(str[1]);\n TreeSet<Integer> ts=new TreeSet<>();\n for(int i=0;i<=101;i++)\n ts.add(i);\n str=br.readLine().split(\" \");\n for(int i=0;i<n;i++)\n ts.remove(new Integer(Integer.parseInt(str[i])));\n int t1=ts.floor(x);\n int t2=ts.ceiling(x);\n if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))\n pw.println(t1);\n else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));\n pw.flush();\n pw.close();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main\n{\n public static void main(String args[])throws Exception\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw=new PrintWriter(System.out);\n String str[]=br.readLine().split(\" \");\n int x=Integer.parseInt(str[0]);\n int n=Integer.parseInt(str[1]);\n TreeSet<Integer> ts=new TreeSet<>();\n for(int i=0;i<=101;i++)\n ts.add(i);\n str=br.readLine().split(\" \");\n for(int i=0;i<n;i++)\n ts.remove(new Integer(Integer.parseInt(str[i])));\n int t1=ts.floor(x);\n int t2=ts.ceiling(x);\n if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))\n pw.println(t1);\n else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));\n pw.flush();\n pw.close();\n }\n}",
"Main",
"public static void main(String args[])throws Exception\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw=new PrintWriter(System.out);\n String str[]=br.readLine().split(\" \");\n int x=Integer.parseInt(str[0]);\n int n=Integer.parseInt(str[1]);\n TreeSet<Integer> ts=new TreeSet<>();\n for(int i=0;i<=101;i++)\n ts.add(i);\n str=br.readLine().split(\" \");\n for(int i=0;i<n;i++)\n ts.remove(new Integer(Integer.parseInt(str[i])));\n int t1=ts.floor(x);\n int t2=ts.ceiling(x);\n if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))\n pw.println(t1);\n else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));\n pw.flush();\n pw.close();\n }",
"main",
"{\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw=new PrintWriter(System.out);\n String str[]=br.readLine().split(\" \");\n int x=Integer.parseInt(str[0]);\n int n=Integer.parseInt(str[1]);\n TreeSet<Integer> ts=new TreeSet<>();\n for(int i=0;i<=101;i++)\n ts.add(i);\n str=br.readLine().split(\" \");\n for(int i=0;i<n;i++)\n ts.remove(new Integer(Integer.parseInt(str[i])));\n int t1=ts.floor(x);\n int t2=ts.ceiling(x);\n if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))\n pw.println(t1);\n else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));\n pw.flush();\n pw.close();\n }",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"PrintWriter pw=new PrintWriter(System.out);",
"pw",
"new PrintWriter(System.out)",
"String str[]=br.readLine().split(\" \");",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int x=Integer.parseInt(str[0]);",
"x",
"Integer.parseInt(str[0])",
"Integer.parseInt",
"Integer",
"str[0]",
"str",
"0",
"int n=Integer.parseInt(str[1]);",
"n",
"Integer.parseInt(str[1])",
"Integer.parseInt",
"Integer",
"str[1]",
"str",
"1",
"TreeSet<Integer> ts=new TreeSet<>();",
"ts",
"new TreeSet<>()",
"for(int i=0;i<=101;i++)\n ts.add(i);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"ts.add(i);",
"ts.add(i)",
"ts.add",
"ts",
"i",
"str=br.readLine().split(\" \")",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i=0;i<n;i++)\n ts.remove(new Integer(Integer.parseInt(str[i])));",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"ts.remove(new Integer(Integer.parseInt(str[i])));",
"ts.remove(new Integer(Integer.parseInt(str[i])))",
"ts.remove",
"ts",
"new Integer(Integer.parseInt(str[i]))",
"int t1=ts.floor(x);",
"t1",
"ts.floor(x)",
"ts.floor",
"ts",
"x",
"int t2=ts.ceiling(x);",
"t2",
"ts.ceiling(x)",
"ts.ceiling",
"ts",
"x",
"if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))\n pw.println(t1);\n else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));",
"(int)Math.abs(t1-x)<(int)Math.abs(t2-x)",
"(int)Math.abs(t1-x)",
"Math.abs",
"Math",
"t1-x",
"t1",
"x",
"(int)Math.abs(t2-x)",
"Math.abs",
"Math",
"t2-x",
"t2",
"x",
"pw.println(t1)",
"pw.println",
"pw",
"t1",
"if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));",
"(int)Math.abs(t1-x)>(int)Math.abs(t2-x)",
"(int)Math.abs(t1-x)",
"Math.abs",
"Math",
"t1-x",
"t1",
"x",
"(int)Math.abs(t2-x)",
"Math.abs",
"Math",
"t2-x",
"t2",
"x",
"pw.println(t2)",
"pw.println",
"pw",
"t2",
"pw.println(Math.min(t1,t2))",
"pw.println",
"pw",
"Math.min(t1,t2)",
"Math.min",
"Math",
"t1",
"t2",
"pw.flush()",
"pw.flush",
"pw",
"pw.close()",
"pw.close",
"pw",
"String args[]",
"args",
"public class Main\n{\n public static void main(String args[])throws Exception\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw=new PrintWriter(System.out);\n String str[]=br.readLine().split(\" \");\n int x=Integer.parseInt(str[0]);\n int n=Integer.parseInt(str[1]);\n TreeSet<Integer> ts=new TreeSet<>();\n for(int i=0;i<=101;i++)\n ts.add(i);\n str=br.readLine().split(\" \");\n for(int i=0;i<n;i++)\n ts.remove(new Integer(Integer.parseInt(str[i])));\n int t1=ts.floor(x);\n int t2=ts.ceiling(x);\n if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))\n pw.println(t1);\n else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));\n pw.flush();\n pw.close();\n }\n}",
"public class Main\n{\n public static void main(String args[])throws Exception\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw=new PrintWriter(System.out);\n String str[]=br.readLine().split(\" \");\n int x=Integer.parseInt(str[0]);\n int n=Integer.parseInt(str[1]);\n TreeSet<Integer> ts=new TreeSet<>();\n for(int i=0;i<=101;i++)\n ts.add(i);\n str=br.readLine().split(\" \");\n for(int i=0;i<n;i++)\n ts.remove(new Integer(Integer.parseInt(str[i])));\n int t1=ts.floor(x);\n int t2=ts.ceiling(x);\n if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))\n pw.println(t1);\n else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))\n pw.println(t2);\n else\n pw.println(Math.min(t1,t2));\n pw.flush();\n pw.close();\n }\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main
{
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw=new PrintWriter(System.out);
String str[]=br.readLine().split(" ");
int x=Integer.parseInt(str[0]);
int n=Integer.parseInt(str[1]);
TreeSet<Integer> ts=new TreeSet<>();
for(int i=0;i<=101;i++)
ts.add(i);
str=br.readLine().split(" ");
for(int i=0;i<n;i++)
ts.remove(new Integer(Integer.parseInt(str[i])));
int t1=ts.floor(x);
int t2=ts.ceiling(x);
if((int)Math.abs(t1-x)<(int)Math.abs(t2-x))
pw.println(t1);
else if((int)Math.abs(t1-x)>(int)Math.abs(t2-x))
pw.println(t2);
else
pw.println(Math.min(t1,t2));
pw.flush();
pw.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
13,
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,
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,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
119,
11
],
[
119,
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
],
[
48,
49
],
[
47,
50
],
[
50,
51
],
[
51,
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
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
74,
80
],
[
65,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
14,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
14,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
14,
113
],
[
113,
114
],
[
114,
115
],
[
12,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
]
| [
"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 sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tif (n > 100) {\n\t\t\tSystem.out.println(\"error\");\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\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\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tif (n > 100) {\n\t\t\tSystem.out.println(\"error\");\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\n\t}\n\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\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tif (n > 100) {\n\t\t\tSystem.out.println(\"error\");\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\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\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tif (n > 100) {\n\t\t\tSystem.out.println(\"error\");\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\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> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"int ans = x;",
"ans",
"x",
"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",
"for (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}",
"int dif = 0;",
"int dif = 0;",
"dif",
"0",
"dif <= n",
"dif",
"n",
"dif++",
"dif++",
"dif",
"{\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}",
"{\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}",
"if (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x - dif)",
"list.contains(x - dif)",
"list.contains",
"list",
"x - dif",
"x",
"dif",
"{\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;",
"if (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}",
"!list.contains(x + dif)",
"list.contains(x + dif)",
"list.contains",
"list",
"x + dif",
"x",
"dif",
"{\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;",
"if (n > 100) {\n\t\t\tSystem.out.println(\"error\");\n\t\t}",
"n > 100",
"n",
"100",
"{\n\t\t\tSystem.out.println(\"error\");\n\t\t}",
"System.out.println(\"error\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"error\"",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tif (n > 100) {\n\t\t\tSystem.out.println(\"error\");\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\n\t}\n\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\tList<Integer> list = new ArrayList<>();\n\t\tint ans = x;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\n\t\tfor (int dif = 0; dif <= n; dif++) {\n\n\t\t\t//x-difがリストに無いとき\n\t\t\tif (!list.contains(x - dif)) {\n\t\t\t\tans = x - dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//x+difがリストに無いとき\n\t\t\tif (!list.contains(x + dif)) {\n\t\t\t\tans = x + dif;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t\tif (n > 100) {\n\t\t\tSystem.out.println(\"error\");\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\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) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
List<Integer> list = new ArrayList<>();
int ans = x;
for (int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
for (int dif = 0; dif <= n; dif++) {
//x-difがリストに無いとき
if (!list.contains(x - dif)) {
ans = x - dif;
break;
}
//x+difがリストに無いとき
if (!list.contains(x + dif)) {
ans = x + dif;
break;
}
}
if (n > 100) {
System.out.println("error");
}
System.out.println(ans);
sc.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
4,
18,
13,
13,
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,
30,
0,
13,
17,
3,
14,
2,
40,
13,
2,
4,
18,
13,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
128,
8
],
[
128,
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
],
[
53,
54
],
[
52,
55
],
[
11,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
72,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
68,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
102,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
112,
113
],
[
112,
114
],
[
98,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
11,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
9,
125
],
[
125,
126
],
[
0,
127
],
[
127,
128
],
[
127,
129
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main{\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tint ans =0;\n\t\tArrays.sort(p); //昇順にソート\n\t\tfor(int i=0; i<=101; i++) {\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tint ans =0;\n\t\tArrays.sort(p); //昇順にソート\n\t\tfor(int i=0; i<=101; i++) {\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tint ans =0;\n\t\tArrays.sort(p); //昇順にソート\n\t\tfor(int i=0; i<=101; i++) {\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t}",
"main",
"{\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tint ans =0;\n\t\tArrays.sort(p); //昇順にソート\n\t\tfor(int i=0; i<=101; i++) {\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t}",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int X = s.nextInt();",
"X",
"s.nextInt()",
"s.nextInt",
"s",
"int N = s.nextInt();",
"N",
"s.nextInt()",
"s.nextInt",
"s",
"int[] p = new int[N];",
"p",
"new int[N]",
"N",
"for(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tp[i] = s.nextInt();\n\t\t}",
"{\n\t\t\tp[i] = s.nextInt();\n\t\t}",
"p[i] = s.nextInt()",
"p[i]",
"p",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"int ans =0;",
"ans",
"0",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"for(int i=0; i<=101; i++) {\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\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\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}",
"{\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}",
"boolean include = false;",
"include",
"false",
"for(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}",
"int k=0;",
"int k=0;",
"k",
"0",
"k<p.length",
"k",
"p.length",
"p",
"p.length",
"k++",
"k++",
"k",
"{\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}",
"{\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}",
"if(i == p[k]) {include = true; break;}",
"i == p[k]",
"i",
"p[k]",
"p",
"k",
"{include = true; break;}",
"include = true",
"include",
"true",
"break;",
"if(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}",
"!include && Math.abs(X-ans) > Math.abs(X-i)",
"!include",
"include",
"Math.abs(X-ans) > Math.abs(X-i)",
"Math.abs(X-ans)",
"Math.abs",
"Math",
"X-ans",
"X",
"ans",
"Math.abs(X-i)",
"Math.abs",
"Math",
"X-i",
"X",
"i",
"{\n\t\t\t\tans = i; \n\t\t\t}",
"ans = i",
"ans",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tint ans =0;\n\t\tArrays.sort(p); //昇順にソート\n\t\tfor(int i=0; i<=101; i++) {\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t}\n\n}",
"public class Main{\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tint ans =0;\n\t\tArrays.sort(p); //昇順にソート\n\t\tfor(int i=0; i<=101; i++) {\n\t\t\tboolean include = false;\n\t\t\tfor(int k=0; k<p.length; k++) {\n\t\t\t\tif(i == p[k]) {include = true; break;}\n\t\t\t}\n\t\t\t\n\t\t\tif(!include && Math.abs(X-ans) > Math.abs(X-i) ) {\n\t\t\t\tans = i; \n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t}\n\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int X = s.nextInt();
int N = s.nextInt();
int[] p = new int[N];
for(int i=0; i<N; i++) {
p[i] = s.nextInt();
}
int ans =0;
Arrays.sort(p); //昇順にソート
for(int i=0; i<=101; i++) {
boolean include = false;
for(int k=0; k<p.length; k++) {
if(i == p[k]) {include = true; break;}
}
if(!include && Math.abs(X-ans) > Math.abs(X-i) ) {
ans = i;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
2,
17,
17,
12,
13,
30,
41,
13,
4,
18,
13,
41,
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,
41,
13,
4,
18,
13,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
14,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
12,
13,
30,
4,
18,
20,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
126,
5
],
[
126,
6
],
[
6,
7
],
[
6,
8
],
[
126,
9
],
[
9,
10
],
[
9,
11
],
[
126,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
16
],
[
126,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
19,
21
],
[
126,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
24,
26
],
[
126,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
29,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
40,
41
],
[
40,
42
],
[
29,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
44,
48
],
[
29,
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
],
[
29,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
72,
83
],
[
84,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
91,
100
],
[
84,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
107,
116
],
[
126,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
117,
123
],
[
123,
124
],
[
0,
125
],
[
125,
126
],
[
125,
127
]
]
| [
"import java.util.*;\n\npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = 998244353;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tint len = (int)1e6 + 1;\n\t\n\t\n\tvoid doIt() {\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tboolean[] able = new boolean[201];\n\t\tArrays.fill(able, true);\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\n\t\t}\n\t\tfor(int i = 0; i <= 100; i++) {\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = 998244353;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tint len = (int)1e6 + 1;\n\t\n\t\n\tvoid doIt() {\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tboolean[] able = new boolean[201];\n\t\tArrays.fill(able, true);\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\n\t\t}\n\t\tfor(int i = 0; i <= 100; i++) {\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n\n}",
"Main",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"final int MOD = 998244353;",
"MOD",
"998244353",
"final int MAX = Integer.MAX_VALUE;",
"MAX",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"final long LMAX = Long.MAX_VALUE;",
"LMAX",
"Long.MAX_VALUE",
"Long",
"Long.MAX_VALUE",
"int len = (int)1e6 + 1;",
"len",
"(int)1e6 + 1",
"(int)1e6",
"1",
"void doIt() {\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tboolean[] able = new boolean[201];\n\t\tArrays.fill(able, true);\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\n\t\t}\n\t\tfor(int i = 0; i <= 100; i++) {\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}",
"doIt",
"{\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tboolean[] able = new boolean[201];\n\t\tArrays.fill(able, true);\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\n\t\t}\n\t\tfor(int i = 0; i <= 100; i++) {\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}",
"int X = sc.nextInt();",
"X",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean[] able = new boolean[201];",
"able",
"new boolean[201]",
"201",
"Arrays.fill(able, true)",
"Arrays.fill",
"Arrays",
"able",
"true",
"for(int i = 0; i < N; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\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\table[p] = false;\n\t\t}",
"{\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\n\t\t}",
"int p = sc.nextInt();",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"able[p] = false",
"able[p]",
"able",
"p",
"false",
"for(int i = 0; i <= 100; i++) {\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\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(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"if(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}",
"able[X-i]",
"able",
"X-i",
"X",
"i",
"{\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(X-i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X-i",
"X",
"i",
"return;",
"if(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}",
"able[X+i]",
"able",
"X+i",
"X",
"i",
"{\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(X+i)",
"System.out.println",
"System.out",
"System",
"System.out",
"X+i",
"X",
"i",
"return;",
"public static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}",
"main",
"{\n\t\tnew Main().doIt();\n\t}",
"new Main().doIt()",
"new Main().doIt",
"new Main()",
"String[] args",
"args",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = 998244353;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tint len = (int)1e6 + 1;\n\t\n\t\n\tvoid doIt() {\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tboolean[] able = new boolean[201];\n\t\tArrays.fill(able, true);\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\n\t\t}\n\t\tfor(int i = 0; i <= 100; i++) {\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n\n}",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = 998244353;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tint len = (int)1e6 + 1;\n\t\n\t\n\tvoid doIt() {\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\tboolean[] able = new boolean[201];\n\t\tArrays.fill(able, true);\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\table[p] = false;\n\t\t}\n\t\tfor(int i = 0; i <= 100; i++) {\n\t\t\tif(able[X-i]) {\n\t\t\t\tSystem.out.println(X-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(able[X+i]) {\n\t\t\t\tSystem.out.println(X+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n\n}",
"Main"
]
| import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
final int MOD = 998244353;
final int MAX = Integer.MAX_VALUE;
final long LMAX = Long.MAX_VALUE;
int len = (int)1e6 + 1;
void doIt() {
int X = sc.nextInt();
int N = sc.nextInt();
boolean[] able = new boolean[201];
Arrays.fill(able, true);
for(int i = 0; i < N; i++) {
int p = sc.nextInt();
able[p] = false;
}
for(int i = 0; i <= 100; i++) {
if(able[X-i]) {
System.out.println(X-i);
return;
}
if(able[X+i]) {
System.out.println(X+i);
return;
}
}
}
public static void main(String[] args) {
new Main().doIt();
}
}
|
[
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,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
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,
13,
18,
13,
13,
30,
0,
13,
17,
14,
13,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
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
],
[
140,
5
],
[
140,
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
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
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
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
83,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
79,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
108,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
79,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
119,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
119,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
6,
137
],
[
137,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
]
]
| [
"import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0;j<=100;j++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\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 scan = new Scanner(System.in);\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0;j<=100;j++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\n\t\t\t}\n\t\t}\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0;j<=100;j++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\n\t\t\t}\n\t\t}\n\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0;j<=100;j++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\n\t\t\t}\n\t\t}\n\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",
"int ans = x;",
"ans",
"x",
"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",
"int count = 0;",
"count",
"0",
"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",
"for(int j=0;j<=100;j++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\n\t\t\t}\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<=100",
"j",
"100",
"j++",
"j++",
"j",
"{\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\n\t\t\t}\n\t\t}",
"boolean b = true;",
"b",
"true",
"for(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}",
"int k=0;",
"int k=0;",
"k",
"0",
"k<n",
"k",
"n",
"k++",
"k++",
"k",
"{\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}",
"if(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}",
"ans == p[k]",
"ans",
"p[k]",
"p",
"k",
"{\n\t\t\t\t\tb = false;\n\t\t\t\t}",
"b = false",
"b",
"false",
"if(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"b",
"{\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"System.exit(0)",
"System.exit",
"System",
"0",
"if(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\n\t\t\t}",
"j % 2 == 0",
"j % 2",
"j",
"2",
"0",
"{\n\t\t\t\tans -= j+1;\n\t\t\t}",
"ans -= j+1",
"ans",
"j+1",
"j",
"1",
"{\n\t\t\t\tans += j+1;\n\t\t\t}",
"ans += j+1",
"ans",
"j+1",
"j",
"1",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0;j<=100;j++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\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 scan = new Scanner(System.in);\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tint[] p = new int[n];\n\t\tint ans = x;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tint count = 0;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0;j<=100;j++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int k=0;k<n;k++) {\n\t\t\t\tif(ans == p[k]) {\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tSystem.out.println(ans);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(j % 2 == 0) {\n\t\t\t\tans -= j+1;\n\t\t\t}else {\n\t\t\t\tans += j+1;\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 scan = new Scanner(System.in);
int x = scan.nextInt();
int n = scan.nextInt();
int[] p = new int[n];
int ans = x;
if(n == 0) {
System.out.println(x);
System.exit(0);
}
int count = 0;
for(int i=0;i<n;i++) {
p[i] = scan.nextInt();
}
for(int j=0;j<=100;j++) {
boolean b = true;
for(int k=0;k<n;k++) {
if(ans == p[k]) {
b = false;
}
}
if(b) {
System.out.println(ans);
System.exit(0);
}
if(j % 2 == 0) {
ans -= j+1;
}else {
ans += j+1;
}
}
}
} |
[
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,
0,
18,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
13,
17,
30,
14,
2,
17,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
30,
4,
18,
18,
13,
13,
40,
17,
29,
14,
2,
2,
13,
13,
17,
30,
14,
2,
17,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
29,
30,
4,
18,
18,
13,
13,
17,
29,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
141,
5
],
[
141,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
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
],
[
54,
55
],
[
55,
56
],
[
51,
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
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
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
],
[
71,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
96,
104
],
[
70,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
126,
127
],
[
126,
128
],
[
120,
129
],
[
105,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
130,
137
],
[
6,
138
],
[
138,
139
],
[
0,
140
],
[
140,
141
],
[
140,
142
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n if(n == 0) {\n System.out.println(x);\n return;\n }\n int[]p = new int [101];\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n for(int i=0; i<101; i++) {\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\n }\n }\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[]p = new int [101];\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n for(int i=0; i<101; i++) {\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\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 if(n == 0) {\n System.out.println(x);\n return;\n }\n int[]p = new int [101];\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n for(int i=0; i<101; i++) {\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\n }\n }\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[]p = new int [101];\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n for(int i=0; i<101; i++) {\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\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",
"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[]p = new int [101];",
"p",
"new int [101]",
"101",
"for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[sc.nextInt()] = 1;\n }",
"{\n p[sc.nextInt()] = 1;\n }",
"p[sc.nextInt()] = 1",
"p[sc.nextInt()]",
"p",
"sc.nextInt()",
"sc.nextInt",
"sc",
"1",
"for(int i=0; i<101; i++) {\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\n }\n }",
"{\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\n }\n }",
"if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }",
"x-i >= 0",
"x-i",
"x",
"i",
"0",
"{\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n }",
"if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }",
"0 == p[x-i]",
"0",
"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;",
"{\n System.out.println(-1);\n return;\n }",
"System.out.println(-1)",
"System.out.println",
"System.out",
"System",
"System.out",
"-1",
"1",
"return;",
"if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\n }",
"x+i <101",
"x+i",
"x",
"i",
"101",
"{\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }",
"if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }",
"0 == p[x+i]",
"0",
"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;",
"{\n System.out.println(101);\n return;\n }",
"System.out.println(101)",
"System.out.println",
"System.out",
"System",
"System.out",
"101",
"return;",
"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[]p = new int [101];\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n for(int i=0; i<101; i++) {\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\n }\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 if(n == 0) {\n System.out.println(x);\n return;\n }\n int[]p = new int [101];\n for(int i=0; i<n; i++) {\n p[sc.nextInt()] = 1;\n }\n for(int i=0; i<101; i++) {\n if(x-i >= 0) {\n if(0 == p[x-i]) {\n System.out.println(x-i);\n return;\n }\n } else {\n System.out.println(-1);\n return;\n }\n if(x+i <101) {\n if(0 == p[x+i]) {\n System.out.println(x+i);\n return;\n }\n }else {\n System.out.println(101);\n return;\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();
if(n == 0) {
System.out.println(x);
return;
}
int[]p = new int [101];
for(int i=0; i<n; i++) {
p[sc.nextInt()] = 1;
}
for(int i=0; i<101; i++) {
if(x-i >= 0) {
if(0 == p[x-i]) {
System.out.println(x-i);
return;
}
} else {
System.out.println(-1);
return;
}
if(x+i <101) {
if(0 == p[x+i]) {
System.out.println(x+i);
return;
}
}else {
System.out.println(101);
return;
}
}
}
} |
[
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,
40,
17,
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,
0,
13,
13,
3,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
14,
40,
13,
30,
0,
13,
13,
14,
2,
13,
2,
2,
13,
2,
18,
13,
2,
13,
17,
18,
13,
17,
17,
30,
14,
2,
2,
13,
18,
13,
17,
2,
18,
13,
2,
13,
17,
13,
30,
0,
13,
2,
18,
13,
17,
17,
30,
0,
13,
2,
18,
13,
2,
13,
17,
17,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
2,
13,
13,
2,
13,
2,
2,
13,
17,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
13,
2,
18,
13,
13,
13,
30,
0,
13,
2,
18,
13,
13,
13,
0,
13,
17,
3,
14,
2,
18,
13,
2,
13,
13,
2,
18,
13,
13,
13,
30,
0,
13,
2,
18,
13,
13,
13,
0,
13,
17,
3,
14,
40,
13,
30,
14,
2,
2,
13,
18,
13,
17,
2,
18,
13,
2,
13,
17,
13,
30,
0,
13,
17,
30,
0,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
275,
8
],
[
275,
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
],
[
55,
56
],
[
11,
57
],
[
57,
58
],
[
57,
59
],
[
11,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
73,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
79,
86
],
[
11,
87
],
[
87,
88
],
[
87,
89
],
[
11,
90
],
[
90,
91
],
[
90,
92
],
[
11,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
11,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
111,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
124,
130
],
[
130,
131
],
[
130,
132
],
[
121,
133
],
[
118,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
142,
148
],
[
135,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
135,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
160,
166
],
[
118,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
180,
181
],
[
180,
182
],
[
183,
183
],
[
183,
184
],
[
183,
185
],
[
183,
186
],
[
171,
187
],
[
187,
188
],
[
188,
189
],
[
171,
190
],
[
191,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
196,
198
],
[
193,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
199,
203
],
[
192,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
207,
211
],
[
204,
212
],
[
212,
213
],
[
212,
214
],
[
204,
215
],
[
192,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
220,
222
],
[
217,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
223,
227
],
[
216,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
231,
235
],
[
228,
236
],
[
236,
237
],
[
236,
238
],
[
228,
239
],
[
167,
240
],
[
240,
241
],
[
241,
242
],
[
240,
243
],
[
243,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
248,
249
],
[
248,
250
],
[
245,
251
],
[
251,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
254,
256
],
[
251,
257
],
[
244,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
244,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
11,
266
],
[
266,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
266,
271
],
[
9,
272
],
[
272,
273
],
[
0,
274
],
[
274,
275
],
[
274,
276
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tArrays.sort(p); //昇順にソート\n\t\tint i_X =-1; //p[i] = X を満たす整数i\n\t\tboolean existX = false;\n\t\tfor(int i =0; i<N; i++) {\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\n\t\t}\n\n\t\tint ans=0;\n\t\tint sumP =0;\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tsumP += p[i];\n\t\t}\n\t\t\n\t\tif(!existX) {ans = X; }\n\t\telse if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tArrays.sort(p); //昇順にソート\n\t\tint i_X =-1; //p[i] = X を満たす整数i\n\t\tboolean existX = false;\n\t\tfor(int i =0; i<N; i++) {\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\n\t\t}\n\n\t\tint ans=0;\n\t\tint sumP =0;\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tsumP += p[i];\n\t\t}\n\t\t\n\t\tif(!existX) {ans = X; }\n\t\telse if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tArrays.sort(p); //昇順にソート\n\t\tint i_X =-1; //p[i] = X を満たす整数i\n\t\tboolean existX = false;\n\t\tfor(int i =0; i<N; i++) {\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\n\t\t}\n\n\t\tint ans=0;\n\t\tint sumP =0;\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tsumP += p[i];\n\t\t}\n\t\t\n\t\tif(!existX) {ans = X; }\n\t\telse if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tArrays.sort(p); //昇順にソート\n\t\tint i_X =-1; //p[i] = X を満たす整数i\n\t\tboolean existX = false;\n\t\tfor(int i =0; i<N; i++) {\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\n\t\t}\n\n\t\tint ans=0;\n\t\tint sumP =0;\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tsumP += p[i];\n\t\t}\n\t\t\n\t\tif(!existX) {ans = X; }\n\t\telse if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int X = s.nextInt();",
"X",
"s.nextInt()",
"s.nextInt",
"s",
"int N = s.nextInt();",
"N",
"s.nextInt()",
"s.nextInt",
"s",
"int[] p = new int[N];",
"p",
"new int[N]",
"N",
"for(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tp[i] = s.nextInt();\n\t\t}",
"{\n\t\t\tp[i] = s.nextInt();\n\t\t}",
"p[i] = s.nextInt()",
"p[i]",
"p",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"int i_X =-1;",
"i_X",
"-1",
"1",
"boolean existX = false;",
"existX",
"false",
"for(int i =0; i<N; i++) {\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\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 ) {existX = true; i_X = i; break;}\n\t\t}",
"{\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\n\t\t}",
"if(p[i] == X ) {existX = true; i_X = i; break;}",
"p[i] == X",
"p[i]",
"p",
"i",
"X",
"{existX = true; i_X = i; break;}",
"existX = true",
"existX",
"true",
"i_X = i",
"i_X",
"i",
"break;",
"int ans=0;",
"ans",
"0",
"int sumP =0;",
"sumP",
"0",
"for(int i=0; i<N; i++) {\n\t\t\tsumP += p[i];\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tsumP += p[i];\n\t\t}",
"{\n\t\t\tsumP += p[i];\n\t\t}",
"sumP += p[i]",
"sumP",
"p[i]",
"p",
"i",
"if(!existX) {ans = X; }\n\t\telse if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}",
"!existX",
"existX",
"{ans = X; }",
"ans = X",
"ans",
"X",
"if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}",
"sumP == (N*(p[N-1]+p[0]))/2",
"sumP",
"(N*(p[N-1]+p[0]))/2",
"(N*(p[N-1]+p[0]))",
"N",
"(p[N-1]+p[0])",
"p[N-1]",
"p",
"N-1",
"N",
"1",
"p[0]",
"p",
"0",
"2",
"{ \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}",
"if(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}",
"X-p[0] <= p[N-1]-X",
"X-p[0]",
"X",
"p[0]",
"p",
"0",
"p[N-1]-X",
"p[N-1]",
"p",
"N-1",
"N",
"1",
"X",
"{ans = p[0]-1;}",
"ans = p[0]-1",
"ans",
"p[0]-1",
"p[0]",
"p",
"0",
"1",
"{ans = p[N-1]+1;}",
"ans = p[N-1]+1",
"ans",
"p[N-1]+1",
"p[N-1]",
"p",
"N-1",
"N",
"1",
"1",
"{ boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}",
"boolean da = false;",
"da",
"false",
"for(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}",
"int k=1;",
"int k=1;",
"k",
"1",
"k<=i_X && k<=N-1-i_X",
"k<=i_X",
"k",
"i_X",
"k<=N-1-i_X",
"k",
"N-1-i_X",
"N-1-i_X",
"N",
"1",
"i_X",
"k++",
"k++",
"k",
"{\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}",
"{\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}",
"if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}",
"p[i_X-k] != p[i_X]-k",
"p[i_X-k]",
"p",
"i_X-k",
"i_X",
"k",
"p[i_X]-k",
"p[i_X]",
"p",
"i_X",
"k",
"{ans =p[i_X]-k; da = true; break;}",
"ans =p[i_X]-k",
"ans",
"p[i_X]-k",
"p[i_X]",
"p",
"i_X",
"k",
"da = true",
"da",
"true",
"break;",
"if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}",
"p[i_X+k] != p[i_X]+k",
"p[i_X+k]",
"p",
"i_X+k",
"i_X",
"k",
"p[i_X]+k",
"p[i_X]",
"p",
"i_X",
"k",
"{ans =p[i_X]+k; da = true; break;}",
"ans =p[i_X]+k",
"ans",
"p[i_X]+k",
"p[i_X]",
"p",
"i_X",
"k",
"da = true",
"da",
"true",
"break;",
"if(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}",
"!da",
"da",
"{\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}",
"if(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }",
"X-p[0] <= p[N-1]-X",
"X-p[0]",
"X",
"p[0]",
"p",
"0",
"p[N-1]-X",
"p[N-1]",
"p",
"N-1",
"N",
"1",
"X",
"{ans = 9;}",
"ans = 9",
"ans",
"9",
"{ans = 9; }",
"ans = 9",
"ans",
"9",
"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 s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tArrays.sort(p); //昇順にソート\n\t\tint i_X =-1; //p[i] = X を満たす整数i\n\t\tboolean existX = false;\n\t\tfor(int i =0; i<N; i++) {\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\n\t\t}\n\n\t\tint ans=0;\n\t\tint sumP =0;\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tsumP += p[i];\n\t\t}\n\t\t\n\t\tif(!existX) {ans = X; }\n\t\telse if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"public class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint X = s.nextInt();\n\t\tint N = s.nextInt();\n\t\tint[] p = new int[N];\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp[i] = s.nextInt();\n\t\t}\n\t\tArrays.sort(p); //昇順にソート\n\t\tint i_X =-1; //p[i] = X を満たす整数i\n\t\tboolean existX = false;\n\t\tfor(int i =0; i<N; i++) {\n\t\t\tif(p[i] == X ) {existX = true; i_X = i; break;}\n\t\t}\n\n\t\tint ans=0;\n\t\tint sumP =0;\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tsumP += p[i];\n\t\t}\n\t\t\n\t\tif(!existX) {ans = X; }\n\t\telse if(sumP == (N*(p[N-1]+p[0]))/2 ) { \n\t\t\tif(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}\n\t\t\telse {ans = p[N-1]+1;}\n\t\t}\n\t\telse { boolean da = false;\n\t\t\tfor(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {\n\n\t\t\t\t if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}\n\t\t\t\t else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}\n\t\t\t\t}\n\t\t\tif(!da) {\n\t\t\t\tif(X-p[0] <= p[N-1]-X) {ans = 9;}\n\t\t\t\t\telse {ans = 9; }\t\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int X = s.nextInt();
int N = s.nextInt();
int[] p = new int[N];
for(int i=0; i<N; i++) {
p[i] = s.nextInt();
}
Arrays.sort(p); //昇順にソート
int i_X =-1; //p[i] = X を満たす整数i
boolean existX = false;
for(int i =0; i<N; i++) {
if(p[i] == X ) {existX = true; i_X = i; break;}
}
int ans=0;
int sumP =0;
for(int i=0; i<N; i++) {
sumP += p[i];
}
if(!existX) {ans = X; }
else if(sumP == (N*(p[N-1]+p[0]))/2 ) {
if(X-p[0] <= p[N-1]-X) {ans = p[0]-1;}
else {ans = p[N-1]+1;}
}
else { boolean da = false;
for(int k=1; k<=i_X && k<=N-1-i_X; k++ ) {
if(p[i_X-k] != p[i_X]-k) {ans =p[i_X]-k; da = true; break;}
else if(p[i_X+k] != p[i_X]+k) {ans =p[i_X]+k; da = true; break;}
}
if(!da) {
if(X-p[0] <= p[N-1]-X) {ans = 9;}
else {ans = 9; }
}
}
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,
17,
14,
2,
13,
17,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
4,
18,
13,
13,
9,
0,
13,
4,
18,
13,
13,
4,
18,
13,
2,
13,
13,
14,
0,
13,
17,
30,
14,
4,
18,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
30,
4,
18,
18,
13,
13,
2,
13,
13,
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
],
[
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
],
[
29,
30
],
[
29,
31
],
[
28,
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
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
57,
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
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
77,
82
],
[
76,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
8,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
100,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
100,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
95,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
6,
132
],
[
132,
133
]
]
| [
"import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> p = new ArrayList<Integer>();\n boolean f = true;\n if(n == 0) f = false;\n\n for(int i=0; i<n; i++) {\n int tmp = sc.nextInt();\n p.add(tmp);\n }\n\n Collections.sort(p);\n int ans = 101;\n for(int i=0; i<102; i++) {\n if(p.contains(i)) continue;\n //System.out.println(Math.abs(x-i));\n ans = Math.min(ans, Math.abs(x-i));\n //System.out.println(ans);\n }\n\n if(f = true) {\n if(p.contains(x-ans)) {\n System.out.println(x+ans);\n } else {\n System.out.println(x-ans);\n }\n } else {\n System.out.println(x);\n }\n\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> p = new ArrayList<Integer>();\n boolean f = true;\n if(n == 0) f = false;\n\n for(int i=0; i<n; i++) {\n int tmp = sc.nextInt();\n p.add(tmp);\n }\n\n Collections.sort(p);\n int ans = 101;\n for(int i=0; i<102; i++) {\n if(p.contains(i)) continue;\n //System.out.println(Math.abs(x-i));\n ans = Math.min(ans, Math.abs(x-i));\n //System.out.println(ans);\n }\n\n if(f = true) {\n if(p.contains(x-ans)) {\n System.out.println(x+ans);\n } else {\n System.out.println(x-ans);\n }\n } else {\n System.out.println(x);\n }\n\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 int n = sc.nextInt();\n ArrayList<Integer> p = new ArrayList<Integer>();\n boolean f = true;\n if(n == 0) f = false;\n\n for(int i=0; i<n; i++) {\n int tmp = sc.nextInt();\n p.add(tmp);\n }\n\n Collections.sort(p);\n int ans = 101;\n for(int i=0; i<102; i++) {\n if(p.contains(i)) continue;\n //System.out.println(Math.abs(x-i));\n ans = Math.min(ans, Math.abs(x-i));\n //System.out.println(ans);\n }\n\n if(f = true) {\n if(p.contains(x-ans)) {\n System.out.println(x+ans);\n } else {\n System.out.println(x-ans);\n }\n } else {\n System.out.println(x);\n }\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> p = new ArrayList<Integer>();\n boolean f = true;\n if(n == 0) f = false;\n\n for(int i=0; i<n; i++) {\n int tmp = sc.nextInt();\n p.add(tmp);\n }\n\n Collections.sort(p);\n int ans = 101;\n for(int i=0; i<102; i++) {\n if(p.contains(i)) continue;\n //System.out.println(Math.abs(x-i));\n ans = Math.min(ans, Math.abs(x-i));\n //System.out.println(ans);\n }\n\n if(f = true) {\n if(p.contains(x-ans)) {\n System.out.println(x+ans);\n } else {\n System.out.println(x-ans);\n }\n } else {\n System.out.println(x);\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",
"ArrayList<Integer> p = new ArrayList<Integer>();",
"p",
"new ArrayList<Integer>()",
"boolean f = true;",
"f",
"true",
"if(n == 0) f = false;",
"n == 0",
"n",
"0",
"f = false",
"f",
"false",
"for(int i=0; i<n; i++) {\n int tmp = sc.nextInt();\n p.add(tmp);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int tmp = sc.nextInt();\n p.add(tmp);\n }",
"{\n int tmp = sc.nextInt();\n p.add(tmp);\n }",
"int tmp = sc.nextInt();",
"tmp",
"sc.nextInt()",
"sc.nextInt",
"sc",
"p.add(tmp)",
"p.add",
"p",
"tmp",
"Collections.sort(p)",
"Collections.sort",
"Collections",
"p",
"int ans = 101;",
"ans",
"101",
"for(int i=0; i<102; i++) {\n if(p.contains(i)) continue;\n //System.out.println(Math.abs(x-i));\n ans = Math.min(ans, Math.abs(x-i));\n //System.out.println(ans);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<102",
"i",
"102",
"i++",
"i++",
"i",
"{\n if(p.contains(i)) continue;\n //System.out.println(Math.abs(x-i));\n ans = Math.min(ans, Math.abs(x-i));\n //System.out.println(ans);\n }",
"{\n if(p.contains(i)) continue;\n //System.out.println(Math.abs(x-i));\n ans = Math.min(ans, Math.abs(x-i));\n //System.out.println(ans);\n }",
"if(p.contains(i)) continue;",
"p.contains(i)",
"p.contains",
"p",
"i",
"continue;",
"ans = Math.min(ans, Math.abs(x-i))",
"ans",
"Math.min(ans, Math.abs(x-i))",
"Math.min",
"Math",
"ans",
"Math.abs(x-i)",
"Math.abs",
"Math",
"x-i",
"x",
"i",
"if(f = true) {\n if(p.contains(x-ans)) {\n System.out.println(x+ans);\n } else {\n System.out.println(x-ans);\n }\n } else {\n System.out.println(x);\n }",
"f = true",
"f",
"true",
"{\n if(p.contains(x-ans)) {\n System.out.println(x+ans);\n } else {\n System.out.println(x-ans);\n }\n }",
"if(p.contains(x-ans)) {\n System.out.println(x+ans);\n } else {\n System.out.println(x-ans);\n }",
"p.contains(x-ans)",
"p.contains",
"p",
"x-ans",
"x",
"ans",
"{\n System.out.println(x+ans);\n }",
"System.out.println(x+ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"x+ans",
"x",
"ans",
"{\n System.out.println(x-ans);\n }",
"System.out.println(x-ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"x-ans",
"x",
"ans",
"{\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 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
ArrayList<Integer> p = new ArrayList<Integer>();
boolean f = true;
if(n == 0) f = false;
for(int i=0; i<n; i++) {
int tmp = sc.nextInt();
p.add(tmp);
}
Collections.sort(p);
int ans = 101;
for(int i=0; i<102; i++) {
if(p.contains(i)) continue;
//System.out.println(Math.abs(x-i));
ans = Math.min(ans, Math.abs(x-i));
//System.out.println(ans);
}
if(f = true) {
if(p.contains(x-ans)) {
System.out.println(x+ans);
} else {
System.out.println(x-ans);
}
} else {
System.out.println(x);
}
}
}
|
[
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,
41,
13,
17,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
13,
30,
41,
13,
2,
13,
13,
14,
2,
13,
17,
30,
0,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
112,
8
],
[
112,
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
],
[
11,
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
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
76,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
11,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
9,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
]
| [
"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\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tArrayList<Integer> H = new ArrayList<>();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tH.add(scan.nextInt());\n\t\t}\n\t\tscan.close();\n\n\t\tint min = 100;\n\t\tint result = 0;\n\n\t\tfor(int i=-100;i<=101;i++) {\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\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\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tArrayList<Integer> H = new ArrayList<>();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tH.add(scan.nextInt());\n\t\t}\n\t\tscan.close();\n\n\t\tint min = 100;\n\t\tint result = 0;\n\n\t\tfor(int i=-100;i<=101;i++) {\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}",
"Main",
"public static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tArrayList<Integer> H = new ArrayList<>();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tH.add(scan.nextInt());\n\t\t}\n\t\tscan.close();\n\n\t\tint min = 100;\n\t\tint result = 0;\n\n\t\tfor(int i=-100;i<=101;i++) {\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tArrayList<Integer> H = new ArrayList<>();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tH.add(scan.nextInt());\n\t\t}\n\t\tscan.close();\n\n\t\tint min = 100;\n\t\tint result = 0;\n\n\t\tfor(int i=-100;i<=101;i++) {\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int X = scan.nextInt();",
"X",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"ArrayList<Integer> H = new ArrayList<>();",
"H",
"new ArrayList<>()",
"for(int i=0;i<N;i++) {\n\t\t\tH.add(scan.nextInt());\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tH.add(scan.nextInt());\n\t\t}",
"{\n\t\t\tH.add(scan.nextInt());\n\t\t}",
"H.add(scan.nextInt())",
"H.add",
"H",
"scan.nextInt()",
"scan.nextInt",
"scan",
"scan.close()",
"scan.close",
"scan",
"int min = 100;",
"min",
"100",
"int result = 0;",
"result",
"0",
"for(int i=-100;i<=101;i++) {\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=-100;",
"int i=-100;",
"i",
"-100",
"100",
"i<=101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"if(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}",
"!H.contains(i)",
"H.contains(i)",
"H.contains",
"H",
"i",
"{\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}",
"int tmp2 = X-i;",
"tmp2",
"X-i",
"X",
"i",
"if(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}",
"tmp2<0",
"tmp2",
"0",
"{\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}",
"tmp2 = i-X",
"tmp2",
"i-X",
"i",
"X",
"if(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}",
"tmp2<min",
"tmp2",
"min",
"{\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}",
"min = tmp2",
"min",
"tmp2",
"result = i",
"result",
"i",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String args[]",
"args",
"public class Main{\n\tpublic static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tArrayList<Integer> H = new ArrayList<>();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tH.add(scan.nextInt());\n\t\t}\n\t\tscan.close();\n\n\t\tint min = 100;\n\t\tint result = 0;\n\n\t\tfor(int i=-100;i<=101;i++) {\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}",
"public class Main{\n\tpublic static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tArrayList<Integer> H = new ArrayList<>();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tH.add(scan.nextInt());\n\t\t}\n\t\tscan.close();\n\n\t\tint min = 100;\n\t\tint result = 0;\n\n\t\tfor(int i=-100;i<=101;i++) {\n\t\t\tif(!H.contains(i)) {\n\t\t\t\tint tmp2 = X-i;\n\t\t\t\tif(tmp2<0) {\n\t\t\t\t\ttmp2 = i-X;\n\t\t\t\t}\n\t\t\t\tif(tmp2<min) {\n\t\t\t\t\tmin = tmp2;\n\t\t\t\t\tresult = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\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> H = new ArrayList<>();
for(int i=0;i<N;i++) {
H.add(scan.nextInt());
}
scan.close();
int min = 100;
int result = 0;
for(int i=-100;i<=101;i++) {
if(!H.contains(i)) {
int tmp2 = X-i;
if(tmp2<0) {
tmp2 = i-X;
}
if(tmp2<min) {
min = tmp2;
result = i;
}
}
}
System.out.println(result);
}
}
|
[
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,
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,
13,
41,
13,
13,
41,
13,
13,
42,
2,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
30,
40,
13,
40,
13,
14,
2,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
30,
3,
14,
2,
18,
13,
13,
17,
30,
40,
13,
14,
2,
18,
13,
13,
17,
30,
40,
13,
14,
2,
2,
13,
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
],
[
159,
5
],
[
159,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
26,
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
],
[
26,
72
],
[
72,
73
],
[
72,
74
],
[
26,
75
],
[
75,
76
],
[
75,
77
],
[
26,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
78,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
90,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
95,
107
],
[
107,
108
],
[
95,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
109,
115
],
[
115,
116
],
[
116,
117
],
[
109,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
26,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
127,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
22,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
6,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
]
| [
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int key = sc.nextInt();\n int num = sc.nextInt();\n if(num > 0){\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }\n else{\n System.out.println(key);\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 key = sc.nextInt();\n int num = sc.nextInt();\n if(num > 0){\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }\n else{\n System.out.println(key);\n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int key = sc.nextInt();\n int num = sc.nextInt();\n if(num > 0){\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }\n else{\n System.out.println(key);\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int key = sc.nextInt();\n int num = sc.nextInt();\n if(num > 0){\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }\n else{\n System.out.println(key);\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int key = sc.nextInt();",
"key",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(num > 0){\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }\n else{\n System.out.println(key);\n }",
"num > 0",
"num",
"0",
"{\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }",
"int map[] = new int[102];",
"map",
"new int[102]",
"102",
"for(int i = 0;i < 102;i++){\n map[i] = 0;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < 102",
"i",
"102",
"i++",
"i++",
"i",
"{\n map[i] = 0;\n }",
"{\n map[i] = 0;\n }",
"map[i] = 0",
"map[i]",
"map",
"i",
"0",
"for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n int n = sc.nextInt();\n map[n] = n;\n }",
"{\n int n = sc.nextInt();\n map[n] = n;\n }",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"map[n] = n",
"map[n]",
"map",
"n",
"n",
"int plus = key;",
"plus",
"key",
"int minus = key;",
"minus",
"key",
"while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }",
"map[plus] != 0 && map[minus] != 0",
"map[plus] != 0",
"map[plus]",
"map",
"plus",
"0",
"map[minus] != 0",
"map[minus]",
"map",
"minus",
"0",
"{\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }",
"plus++",
"plus",
"minus--",
"minus",
"if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }",
"map[plus] == 0 && map[minus] == 0",
"map[plus] == 0",
"map[plus]",
"map",
"plus",
"0",
"map[minus] == 0",
"map[minus]",
"map",
"minus",
"0",
"{\n break;\n }",
"break;",
"if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }",
"map[plus] == 0",
"map[plus]",
"map",
"plus",
"0",
"{\n minus--;\n }",
"minus--",
"minus",
"if(map[minus] == 0){\n plus++;\n }",
"map[minus] == 0",
"map[minus]",
"map",
"minus",
"0",
"{\n plus++;\n }",
"plus++",
"plus",
"if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }",
"key - minus <= plus - key",
"key - minus",
"key",
"minus",
"plus - key",
"plus",
"key",
"{\n System.out.println(minus);\n }",
"System.out.println(minus)",
"System.out.println",
"System.out",
"System",
"System.out",
"minus",
"{\n System.out.println(plus);\n }",
"System.out.println(plus)",
"System.out.println",
"System.out",
"System",
"System.out",
"plus",
"{\n System.out.println(key);\n }",
"System.out.println(key)",
"System.out.println",
"System.out",
"System",
"System.out",
"key",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int key = sc.nextInt();\n int num = sc.nextInt();\n if(num > 0){\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }\n else{\n System.out.println(key);\n }\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int key = sc.nextInt();\n int num = sc.nextInt();\n if(num > 0){\n int map[] = new int[102];\n for(int i = 0;i < 102;i++){\n map[i] = 0;\n }\n for(int i = 0;i < num;i++){\n int n = sc.nextInt();\n map[n] = n;\n }\n int plus = key;\n int minus = key;\n while(map[plus] != 0 && map[minus] != 0){\n plus++;\n minus--;\n if(map[plus] == 0 && map[minus] == 0){\n break;\n }\n else if(map[plus] == 0){\n minus--;\n }\n else if(map[minus] == 0){\n plus++;\n }\n \n }\n if(key - minus <= plus - key){\n System.out.println(minus);\n }\n else{\n System.out.println(plus);\n }\n }\n else{\n System.out.println(key);\n }\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int key = sc.nextInt();
int num = sc.nextInt();
if(num > 0){
int map[] = new int[102];
for(int i = 0;i < 102;i++){
map[i] = 0;
}
for(int i = 0;i < num;i++){
int n = sc.nextInt();
map[n] = n;
}
int plus = key;
int minus = key;
while(map[plus] != 0 && map[minus] != 0){
plus++;
minus--;
if(map[plus] == 0 && map[minus] == 0){
break;
}
else if(map[plus] == 0){
minus--;
}
else if(map[minus] == 0){
plus++;
}
}
if(key - minus <= plus - key){
System.out.println(minus);
}
else{
System.out.println(plus);
}
}
else{
System.out.println(key);
}
}
} |
[
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,
20,
13,
41,
13,
20,
2,
17,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
40,
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,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
13,
17,
30,
0,
18,
13,
13,
13,
40,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
4,
18,
13,
2,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
3,
30,
0,
13,
4,
18,
13,
2,
13,
18,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
174,
5
],
[
174,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
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
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
58,
64
],
[
64,
65
],
[
64,
66
],
[
58,
67
],
[
67,
68
],
[
68,
69
],
[
58,
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
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
88,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
71,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
102,
108
],
[
108,
109
],
[
8,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
110,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
137,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
148,
159
],
[
137,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
6,
171
],
[
171,
172
],
[
0,
173
],
[
173,
174
],
[
173,
175
]
]
| [
"import java.util.*;\n\npublic class Main{\n\t\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \tint x=sc.nextInt(),n=sc.nextInt(),min=301;\n int[] p=new int[n],a=new int[300-n];\n \n \n for(int i=0;i<n;i++){\n p[i]=sc.nextInt();\n \n }\n int l=0;\n for(int i=-150;i<150;i++){\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }\n \n if(n==0){\n System.out.println(x);\n }else{\n for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\t\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \tint x=sc.nextInt(),n=sc.nextInt(),min=301;\n int[] p=new int[n],a=new int[300-n];\n \n \n for(int i=0;i<n;i++){\n p[i]=sc.nextInt();\n \n }\n int l=0;\n for(int i=-150;i<150;i++){\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }\n \n if(n==0){\n System.out.println(x);\n }else{\n for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }\n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \tint x=sc.nextInt(),n=sc.nextInt(),min=301;\n int[] p=new int[n],a=new int[300-n];\n \n \n for(int i=0;i<n;i++){\n p[i]=sc.nextInt();\n \n }\n int l=0;\n for(int i=-150;i<150;i++){\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }\n \n if(n==0){\n System.out.println(x);\n }else{\n for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \tint x=sc.nextInt(),n=sc.nextInt(),min=301;\n int[] p=new int[n],a=new int[300-n];\n \n \n for(int i=0;i<n;i++){\n p[i]=sc.nextInt();\n \n }\n int l=0;\n for(int i=-150;i<150;i++){\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }\n \n if(n==0){\n System.out.println(x);\n }else{\n for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\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",
"n=sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"min=301;",
"min",
"301",
"int[] p=new int[n]",
"p",
"new int[n]",
"n",
"a=new int[300-n];",
"a",
"new int[300-n]",
"300-n",
"300",
"n",
"for(int i=0;i<n;i++){\n p[i]=sc.nextInt();\n \n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i]=sc.nextInt();\n \n }",
"{\n p[i]=sc.nextInt();\n \n }",
"p[i]=sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int l=0;",
"l",
"0",
"for(int i=-150;i<150;i++){\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }",
"int i=-150;",
"int i=-150;",
"i",
"-150",
"150",
"i<150",
"i",
"150",
"i++",
"i++",
"i",
"{\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }",
"{\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }",
"int f=0;",
"f",
"0",
"for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\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 f++;\n break;\n }\n }",
"{\n if(i==p[j]){\n f++;\n break;\n }\n }",
"if(i==p[j]){\n f++;\n break;\n }",
"i==p[j]",
"i",
"p[j]",
"p",
"j",
"{\n f++;\n break;\n }",
"f++",
"f",
"break;",
"if(f==0){\n a[l]=i;\n l++;\n }",
"f==0",
"f",
"0",
"{\n a[l]=i;\n l++;\n }",
"a[l]=i",
"a[l]",
"a",
"l",
"i",
"l++",
"l",
"if(n==0){\n System.out.println(x);\n }else{\n for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\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 for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }\n }",
"for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }",
"{\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }",
"if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }",
"min<=(int)Math.abs(x-a[i])",
"min",
"(int)Math.abs(x-a[i])",
"Math.abs",
"Math",
"x-a[i]",
"x",
"a[i]",
"a",
"i",
"{\n System.out.println(a[i-1]);\n break;\n }",
"System.out.println(a[i-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"break;",
"{\n min=(int)Math.abs(x-a[i]);\n }",
"min=(int)Math.abs(x-a[i])",
"min",
"(int)Math.abs(x-a[i])",
"Math.abs",
"Math",
"x-a[i]",
"x",
"a[i]",
"a",
"i",
"String[] args",
"args",
"public class Main{\n\t\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \tint x=sc.nextInt(),n=sc.nextInt(),min=301;\n int[] p=new int[n],a=new int[300-n];\n \n \n for(int i=0;i<n;i++){\n p[i]=sc.nextInt();\n \n }\n int l=0;\n for(int i=-150;i<150;i++){\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }\n \n if(n==0){\n System.out.println(x);\n }else{\n for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\n }\n }\n }\n}",
"public class Main{\n\t\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \tint x=sc.nextInt(),n=sc.nextInt(),min=301;\n int[] p=new int[n],a=new int[300-n];\n \n \n for(int i=0;i<n;i++){\n p[i]=sc.nextInt();\n \n }\n int l=0;\n for(int i=-150;i<150;i++){\n int f=0;\n for(int j=0;j<n;j++){\n if(i==p[j]){\n f++;\n break;\n }\n }\n if(f==0){\n a[l]=i;\n l++;\n }\n }\n \n if(n==0){\n System.out.println(x);\n }else{\n for(int i=0;i<a.length;i++){\n if(min<=(int)Math.abs(x-a[i])){\n System.out.println(a[i-1]);\n break;\n }else{\n min=(int)Math.abs(x-a[i]);\n }\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(),n=sc.nextInt(),min=301;
int[] p=new int[n],a=new int[300-n];
for(int i=0;i<n;i++){
p[i]=sc.nextInt();
}
int l=0;
for(int i=-150;i<150;i++){
int f=0;
for(int j=0;j<n;j++){
if(i==p[j]){
f++;
break;
}
}
if(f==0){
a[l]=i;
l++;
}
}
if(n==0){
System.out.println(x);
}else{
for(int i=0;i<a.length;i++){
if(min<=(int)Math.abs(x-a[i])){
System.out.println(a[i-1]);
break;
}else{
min=(int)Math.abs(x-a[i]);
}
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
2,
17,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
2,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
18,
13,
13,
41,
13,
17,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
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
],
[
123,
5
],
[
123,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
10,
24
],
[
24,
25
],
[
24,
26
],
[
27,
28
],
[
27,
29
],
[
10,
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
],
[
47,
50
],
[
50,
51
],
[
50,
52
],
[
10,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
10,
78
],
[
78,
79
],
[
78,
80
],
[
10,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
10,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
86,
97
],
[
98,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
99,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
10,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
6,
120
],
[
120,
121
],
[
0,
122
],
[
122,
123
],
[
122,
124
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}\n\t}\n\n}",
"Main",
"public static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}\n\t}",
"main",
"{\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}\n\t}",
"try(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}",
"{\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}",
"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",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] pArray = new int[100+2];",
"pArray",
"new int[100+2]",
"100+2",
"100",
"2",
"for(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}",
"{\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}",
"pArray[i] = (int)Math.abs(x - i)",
"pArray[i]",
"pArray",
"i",
"(int)Math.abs(x - i)",
"Math.abs",
"Math",
"x - i",
"x",
"i",
"for(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}",
"{\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}",
"int index = sc.nextInt();",
"index",
"sc.nextInt()",
"sc.nextInt",
"sc",
"pArray[index] = Integer.MAX_VALUE",
"pArray[index]",
"pArray",
"index",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int ans = 0;",
"ans",
"0",
"int minDiff = pArray[0];",
"minDiff",
"pArray[0]",
"pArray",
"0",
"for(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}",
"int i = 1 ;",
"int i = 1 ;",
"i",
"1",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}",
"if ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}",
"pArray[i] < minDiff",
"pArray[i]",
"pArray",
"i",
"minDiff",
"{\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}",
"ans = i",
"ans",
"i",
"minDiff = pArray[i]",
"minDiff",
"pArray[i]",
"pArray",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint x = sc.nextInt();\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] pArray = new int[100+2];\n\t\t\t\n\t\t\tfor(int i = 0 ; i <= 101 ; i++ ) {\n\t\t\t\tpArray[i] = (int)Math.abs(x - i);\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\tint index = sc.nextInt();\n\t\t\t\tpArray[index] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tint minDiff = pArray[0];\n\t\t\t\n\t\t\tfor(int i = 1 ; i <= 101 ; i++ ) {\n\t\t\t\tif ( pArray[i] < minDiff) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tminDiff = pArray[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\t\n\t\t}\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)) {
int x = sc.nextInt();
int n = sc.nextInt();
int[] pArray = new int[100+2];
for(int i = 0 ; i <= 101 ; i++ ) {
pArray[i] = (int)Math.abs(x - i);
}
for(int i = 0 ; i < n ; i++ ) {
int index = sc.nextInt();
pArray[index] = Integer.MAX_VALUE;
}
int ans = 0;
int minDiff = pArray[0];
for(int i = 1 ; i <= 101 ; i++ ) {
if ( pArray[i] < minDiff) {
ans = i;
minDiff = pArray[i];
}
}
System.out.println(ans);
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
2,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
40,
17,
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,
13,
4,
18,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
2,
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,
14,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
29,
4,
18,
13,
29,
4,
18,
13,
17,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
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,
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
],
[
274,
23
],
[
274,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
26,
40
],
[
40,
41
],
[
40,
42
],
[
26,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
49,
50
],
[
43,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
56,
60
],
[
26,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
26,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
26,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
69,
75
],
[
75,
76
],
[
75,
77
],
[
69,
78
],
[
78,
79
],
[
79,
80
],
[
69,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
90,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
83,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
26,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
108,
110
],
[
24,
111
],
[
111,
112
],
[
274,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
127,
129
],
[
121,
130
],
[
130,
131
],
[
113,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
135,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
145,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
134,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
113,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
162,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
172,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
161,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
113,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
195,
196
],
[
113,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
204,
205
],
[
113,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
210,
213
],
[
213,
214
],
[
113,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
217,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
222,
227
],
[
227,
228
],
[
227,
229
],
[
222,
230
],
[
230,
231
],
[
231,
232
],
[
222,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
234,
238
],
[
238,
239
],
[
217,
240
],
[
240,
241
],
[
215,
242
],
[
242,
243
],
[
113,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
246,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
251,
256
],
[
256,
257
],
[
256,
258
],
[
251,
259
],
[
259,
260
],
[
260,
261
],
[
251,
262
],
[
262,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
263,
267
],
[
267,
268
],
[
246,
269
],
[
269,
270
],
[
244,
271
],
[
271,
272
],
[
0,
273
],
[
273,
274
],
[
273,
275
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor(; n > 0; n--) {\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}\n\t\tCollections.sort(list);\n\t\tint ab = -100;\n\t\tfor(int i = -99; i <= 99; i++) {\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(x + ab);\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\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.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor(; n > 0; n--) {\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}\n\t\tCollections.sort(list);\n\t\tint ab = -100;\n\t\tfor(int i = -99; i <= 99; i++) {\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(x + ab);\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor(; n > 0; n--) {\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}\n\t\tCollections.sort(list);\n\t\tint ab = -100;\n\t\tfor(int i = -99; i <= 99; i++) {\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(x + ab);\n\t\t\n\t}",
"main",
"{\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor(; n > 0; n--) {\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}\n\t\tCollections.sort(list);\n\t\tint ab = -100;\n\t\tfor(int i = -99; i <= 99; i++) {\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(x + ab);\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",
"n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ArrayList<Integer> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"for(; n > 0; n--) {\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}",
";",
"n > 0",
"n",
"0",
"n--",
"n--",
"n",
"{\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}",
"{\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}",
"list.add(sc.nextInt()-x)",
"list.add",
"list",
"sc.nextInt()-x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"x",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"int ab = -100;",
"ab",
"-100",
"100",
"for(int i = -99; i <= 99; i++) {\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}",
"int i = -99;",
"int i = -99;",
"i",
"-99",
"99",
"i <= 99",
"i",
"99",
"i++",
"i++",
"i",
"{\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}",
"if(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}",
"!list.contains(i) && Math.abs(ab) > Math.abs(i)",
"!list.contains(i)",
"list.contains(i)",
"list.contains",
"list",
"i",
"Math.abs(ab) > Math.abs(i)",
"Math.abs(ab)",
"Math.abs",
"Math",
"ab",
"Math.abs(i)",
"Math.abs",
"Math",
"i",
"{\n\t\t\t\tab = i;\n\t\t\t}",
"ab = i",
"ab",
"i",
"System.out.println(x + ab)",
"System.out.println",
"System.out",
"System",
"System.out",
"x + ab",
"x",
"ab",
"String[] args",
"args",
"static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}",
"FastScanner",
"private BufferedReader reader = null;",
"reader",
"null",
"private StringTokenizer tokenizer = null;",
"tokenizer",
"null",
"public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }",
"FastScanner",
"{\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\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 if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }",
"next",
"{\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"IOException e",
"{\n\t throw new RuntimeException(e);\n\t }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }",
"nextLine",
"{\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }",
"try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }",
"IOException e",
"{\n\t throw new RuntimeException(e);\n\t }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n\t return reader.readLine();\n\t }",
"return reader.readLine();",
"reader.readLine()",
"reader.readLine",
"reader",
"return tokenizer.nextToken(\"\\n\");",
"tokenizer.nextToken(\"\\n\")",
"tokenizer.nextToken",
"tokenizer",
"\"\\n\"",
"public long nextLong() {\n\t return Long.parseLong(next());\n\t }",
"nextLong",
"{\n\t return Long.parseLong(next());\n\t }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public int nextInt() {\n\t return Integer.parseInt(next());\n\t }",
"nextInt",
"{\n\t return Integer.parseInt(next());\n\t }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }",
"nextDouble",
"{\n\t return Double.parseDouble(next());\n\t }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }",
"nextIntArray",
"{\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t 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 long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }",
"nextLongArray",
"{\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n\t 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",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor(; n > 0; n--) {\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}\n\t\tCollections.sort(list);\n\t\tint ab = -100;\n\t\tfor(int i = -99; i <= 99; i++) {\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(x + ab);\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor(; n > 0; n--) {\n\t\t\tlist.add(sc.nextInt()-x);\n\t\t}\n\t\tCollections.sort(list);\n\t\tint ab = -100;\n\t\tfor(int i = -99; i <= 99; i++) {\n\t\t\tif(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {\n\t\t\t\tab = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(x + ab);\n\t\t\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
int x = sc.nextInt(), n = sc.nextInt();
ArrayList<Integer> list = new ArrayList<>();
for(; n > 0; n--) {
list.add(sc.nextInt()-x);
}
Collections.sort(list);
int ab = -100;
for(int i = -99; i <= 99; i++) {
if(!list.contains(i) && Math.abs(ab) > Math.abs(i)) {
ab = i;
}
}
System.out.println(x + ab);
}
static class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}
}
|
[
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,
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,
17,
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,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
13,
9,
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
],
[
137,
5
],
[
137,
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
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
25,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
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
],
[
36,
61
],
[
61,
62
],
[
61,
63
],
[
36,
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
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
76,
104
],
[
104,
105
],
[
104,
106
],
[
76,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
112,
113
],
[
112,
114
],
[
108,
115
],
[
107,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
122,
123
],
[
122,
124
],
[
116,
125
],
[
125,
126
],
[
125,
127
],
[
36,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
6,
134
],
[
134,
135
],
[
0,
136
],
[
136,
137
],
[
136,
138
]
]
| [
"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\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\t\n\t\tint ans = 0;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tint[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\n\t\t}\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\t\n\t\tint ans = 0;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tint[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\n\t\t}\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\t\n\t\tint ans = 0;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tint[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\n\t\t}\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\t\n\t\tint ans = 0;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tint[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\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 ans = 0;",
"ans",
"0",
"if(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tint[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\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[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\n\t\t}",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\t\tp[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\tp[i] = sc.nextInt();\n\t\t\t}",
"{\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}",
"p[i] = sc.nextInt()",
"p[i]",
"p",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int min = 100;",
"min",
"100",
"for(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}",
"boolean flag = false;",
"flag",
"false",
"for(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = 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(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"if(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"i == p[j]",
"i",
"p[j]",
"p",
"j",
"{\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"flag = true",
"flag",
"true",
"break;",
"if(flag) continue;",
"flag",
"continue;",
"if(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = Math.abs(x - i);\n\t\t\t\t\tans = 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\tmin = Math.abs(x - i);\n\t\t\t\t\tans = i;\n\t\t\t\t}",
"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\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\t\n\t\tint ans = 0;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tint[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\n\t\t}\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\t\n\t\tint ans = 0;\n\t\tif(n == 0) {\n\t\t\tSystem.out.println(x);\n\t\t}else {\n\t\t\tint[] p = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tp[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint min = 100;\n\t\t\tfor(int i = 0; i <= 101; i++) {\n\t\t\t\tboolean flag = false;\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\t\tif(i == p[j]) {\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag) continue;\n\t\t\t\t\n\t\t\t\tif(Math.abs(x - i) < min) {\n\t\t\t\t\tmin = 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\tSystem.out.println(ans);\n\t\t}\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 ans = 0;
if(n == 0) {
System.out.println(x);
}else {
int[] p = new int[n];
for(int i = 0; i < n; i++) {
p[i] = sc.nextInt();
}
int min = 100;
for(int i = 0; i <= 101; i++) {
boolean flag = false;
for(int j = 0; j < n; j++) {
if(i == p[j]) {
flag = true;
break;
}
}
if(flag) continue;
if(Math.abs(x - i) < min) {
min = Math.abs(x - i);
ans = 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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
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,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
13,
13,
3,
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,
14,
2,
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
],
[
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
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
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
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
60,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
99,
101
],
[
93,
102
],
[
60,
103
],
[
103,
104
],
[
103,
105
],
[
60,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
106,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
60,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
135,
144
],
[
6,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n\n int X = in.nextInt(); // 整数\n int N = in.nextInt(); // 長さ\n int p[] = new int[N];\n for(int i=0; i<N; i++)\n p[i] = in.nextInt();\n int tmp = 0;\n\n for(int i=0; tmp==0; i++){\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n\n int X = in.nextInt(); // 整数\n int N = in.nextInt(); // 長さ\n int p[] = new int[N];\n for(int i=0; i<N; i++)\n p[i] = in.nextInt();\n int tmp = 0;\n\n for(int i=0; tmp==0; i++){\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n\n int X = in.nextInt(); // 整数\n int N = in.nextInt(); // 長さ\n int p[] = new int[N];\n for(int i=0; i<N; i++)\n p[i] = in.nextInt();\n int tmp = 0;\n\n for(int i=0; tmp==0; i++){\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n\n int X = in.nextInt(); // 整数\n int N = in.nextInt(); // 長さ\n int p[] = new int[N];\n for(int i=0; i<N; i++)\n p[i] = in.nextInt();\n int tmp = 0;\n\n for(int i=0; tmp==0; i++){\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"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",
"for(int i=0; i<N; i++)\n p[i] = in.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"p[i] = in.nextInt();",
"p[i] = in.nextInt()",
"p[i]",
"p",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int tmp = 0;",
"tmp",
"0",
"for(int i=0; tmp==0; i++){\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"tmp==0",
"tmp",
"0",
"i++",
"i++",
"i",
"{\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }",
"{\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }",
"tmp = 1",
"tmp",
"1",
"for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<N",
"j",
"N",
"j++",
"j++",
"j",
"{\n if( X-i == p[j]){\n tmp = 0;\n }\n }",
"{\n if( X-i == p[j]){\n tmp = 0;\n }\n }",
"if( X-i == p[j]){\n tmp = 0;\n }",
"X-i == p[j]",
"X-i",
"X",
"i",
"p[j]",
"p",
"j",
"{\n tmp = 0;\n }",
"tmp = 0",
"tmp",
"0",
"if(tmp == 1){\n System.out.println(X-i);\n break;\n }",
"tmp == 1",
"tmp",
"1",
"{\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;",
"tmp = 1",
"tmp",
"1",
"for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<N",
"j",
"N",
"j++",
"j++",
"j",
"{\n if( X+i == p[j]){\n tmp = 0;\n }\n }",
"{\n if( X+i == p[j]){\n tmp = 0;\n }\n }",
"if( X+i == p[j]){\n tmp = 0;\n }",
"X+i == p[j]",
"X+i",
"X",
"i",
"p[j]",
"p",
"j",
"{\n tmp = 0;\n }",
"tmp = 0",
"tmp",
"0",
"if(tmp == 1){\n System.out.println(X+i);\n break;\n }",
"tmp == 1",
"tmp",
"1",
"{\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 in = new Scanner(System.in);\n\n int X = in.nextInt(); // 整数\n int N = in.nextInt(); // 長さ\n int p[] = new int[N];\n for(int i=0; i<N; i++)\n p[i] = in.nextInt();\n int tmp = 0;\n\n for(int i=0; tmp==0; i++){\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }\n }\n}",
"public class Main {\n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n\n int X = in.nextInt(); // 整数\n int N = in.nextInt(); // 長さ\n int p[] = new int[N];\n for(int i=0; i<N; i++)\n p[i] = in.nextInt();\n int tmp = 0;\n\n for(int i=0; tmp==0; i++){\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X-i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X-i);\n break;\n }\n tmp = 1;\n for(int j=0; j<N; j++){\n if( X+i == p[j]){\n tmp = 0;\n }\n }\n if(tmp == 1){\n System.out.println(X+i);\n break;\n }\n }\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int X = in.nextInt(); // 整数
int N = in.nextInt(); // 長さ
int p[] = new int[N];
for(int i=0; i<N; i++)
p[i] = in.nextInt();
int tmp = 0;
for(int i=0; tmp==0; i++){
tmp = 1;
for(int j=0; j<N; j++){
if( X-i == p[j]){
tmp = 0;
}
}
if(tmp == 1){
System.out.println(X-i);
break;
}
tmp = 1;
for(int j=0; j<N; j++){
if( X+i == p[j]){
tmp = 0;
}
}
if(tmp == 1){
System.out.println(X+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,
41,
13,
20,
13,
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,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
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,
40,
13,
14,
2,
18,
13,
13,
13,
30,
3,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
3,
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,
40,
13,
14,
2,
18,
13,
13,
13,
30,
3,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
3,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
4,
18,
13,
2,
13,
13,
14,
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
],
[
227,
5
],
[
227,
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
],
[
31,
33
],
[
30,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
34,
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
],
[
59,
60
],
[
60,
61
],
[
8,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
8,
66
],
[
66,
67
],
[
66,
68
],
[
8,
69
],
[
69,
70
],
[
69,
71
],
[
8,
72
],
[
72,
73
],
[
72,
74
],
[
8,
75
],
[
75,
76
],
[
75,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
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
],
[
107,
113
],
[
113,
114
],
[
114,
115
],
[
107,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
116,
122
],
[
122,
123
],
[
90,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
124,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
8,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
140,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
135,
146
],
[
147,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
151,
159
],
[
159,
160
],
[
160,
161
],
[
151,
162
],
[
163,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
164,
170
],
[
170,
171
],
[
171,
172
],
[
164,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
174,
178
],
[
173,
179
],
[
179,
180
],
[
147,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
181,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
8,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
194,
197
],
[
197,
198
],
[
197,
199
],
[
8,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
203,
204
],
[
202,
205
],
[
205,
206
],
[
205,
207
],
[
8,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
212,
217
],
[
208,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
218,
223
],
[
6,
224
],
[
224,
225
],
[
0,
226
],
[
226,
227
],
[
226,
228
]
]
| [
"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 s[] = new int[n];\n if(n==0){\n System.out.println(x);\n return;\n }\n for(int i = 0 ; i < n ; ++i){\n p[i] = sc.nextInt(); \n }\n \n Arrays.sort(p);\n \n int ue_s = 0;\n int st_s = 0;\n int ue_ans = 0;\n int st_ans = 0;\n \n\n //うえ\n for(int i = x ; i <= 101 ; ++i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }\n\n //した\n for(int i = x ; i >= 0 ; --i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }\n ue_s = Math.abs(x-ue_ans);\n st_s = Math.abs(x-st_ans);\n if(ue_s<st_s) System.out.println(ue_ans);\n else System.out.println(st_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 int p[] = new int[n];\n int s[] = new int[n];\n if(n==0){\n System.out.println(x);\n return;\n }\n for(int i = 0 ; i < n ; ++i){\n p[i] = sc.nextInt(); \n }\n \n Arrays.sort(p);\n \n int ue_s = 0;\n int st_s = 0;\n int ue_ans = 0;\n int st_ans = 0;\n \n\n //うえ\n for(int i = x ; i <= 101 ; ++i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }\n\n //した\n for(int i = x ; i >= 0 ; --i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }\n ue_s = Math.abs(x-ue_ans);\n st_s = Math.abs(x-st_ans);\n if(ue_s<st_s) System.out.println(ue_ans);\n else System.out.println(st_ans);\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 s[] = new int[n];\n if(n==0){\n System.out.println(x);\n return;\n }\n for(int i = 0 ; i < n ; ++i){\n p[i] = sc.nextInt(); \n }\n \n Arrays.sort(p);\n \n int ue_s = 0;\n int st_s = 0;\n int ue_ans = 0;\n int st_ans = 0;\n \n\n //うえ\n for(int i = x ; i <= 101 ; ++i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }\n\n //した\n for(int i = x ; i >= 0 ; --i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }\n ue_s = Math.abs(x-ue_ans);\n st_s = Math.abs(x-st_ans);\n if(ue_s<st_s) System.out.println(ue_ans);\n else System.out.println(st_ans);\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 s[] = new int[n];\n if(n==0){\n System.out.println(x);\n return;\n }\n for(int i = 0 ; i < n ; ++i){\n p[i] = sc.nextInt(); \n }\n \n Arrays.sort(p);\n \n int ue_s = 0;\n int st_s = 0;\n int ue_ans = 0;\n int st_ans = 0;\n \n\n //うえ\n for(int i = x ; i <= 101 ; ++i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }\n\n //した\n for(int i = x ; i >= 0 ; --i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }\n ue_s = Math.abs(x-ue_ans);\n st_s = Math.abs(x-st_ans);\n if(ue_s<st_s) System.out.println(ue_ans);\n else System.out.println(st_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 p[] = new int[n];",
"p",
"new int[n]",
"n",
"int s[] = new int[n];",
"s",
"new int[n]",
"n",
"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 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",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"int ue_s = 0;",
"ue_s",
"0",
"int st_s = 0;",
"st_s",
"0",
"int ue_ans = 0;",
"ue_ans",
"0",
"int st_ans = 0;",
"st_ans",
"0",
"for(int i = x ; i <= 101 ; ++i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }",
"int i = x ;",
"int i = x ;",
"i",
"x",
"i <= 101",
"i",
"101",
"++i",
"++i",
"i",
"{\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }",
"{\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }",
"int count=0;",
"count",
"0",
"for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }",
"int j = 0 ;",
"int j = 0 ;",
"j",
"0",
"j < n",
"j",
"n",
"++j",
"++j",
"j",
"{ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }",
"{ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }",
"if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }",
"p[j] != i",
"p[j]",
"p",
"j",
"i",
"{\n count++; \n }",
"count++",
"count",
"if(p[j] == i){\n break;\n }",
"p[j] == i",
"p[j]",
"p",
"j",
"i",
"{\n break;\n }",
"break;",
"if(count == p.length){\n ue_ans = i;\n break;\n }",
"count == p.length",
"count",
"p.length",
"p",
"p.length",
"{\n ue_ans = i;\n break;\n }",
"ue_ans = i",
"ue_ans",
"i",
"break;",
"for(int i = x ; i >= 0 ; --i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }",
"int i = x ;",
"int i = x ;",
"i",
"x",
"i >= 0",
"i",
"0",
"--i",
"--i",
"i",
"{\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }",
"{\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }",
"int count=0;",
"count",
"0",
"for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }",
"int j = 0 ;",
"int j = 0 ;",
"j",
"0",
"j < n",
"j",
"n",
"++j",
"++j",
"j",
"{\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }",
"{\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }",
"if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }",
"p[j] != i",
"p[j]",
"p",
"j",
"i",
"{\n count++; \n }",
"count++",
"count",
"if(p[j] == i){\n break;\n }",
"p[j] == i",
"p[j]",
"p",
"j",
"i",
"{\n break;\n }",
"break;",
"if(count == p.length){\n st_ans = i;\n break;\n }",
"count == p.length",
"count",
"p.length",
"p",
"p.length",
"{\n st_ans = i;\n break;\n }",
"st_ans = i",
"st_ans",
"i",
"break;",
"ue_s = Math.abs(x-ue_ans)",
"ue_s",
"Math.abs(x-ue_ans)",
"Math.abs",
"Math",
"x-ue_ans",
"x",
"ue_ans",
"st_s = Math.abs(x-st_ans)",
"st_s",
"Math.abs(x-st_ans)",
"Math.abs",
"Math",
"x-st_ans",
"x",
"st_ans",
"if(ue_s<st_s) System.out.println(ue_ans);\n else System.out.println(st_ans);",
"ue_s<st_s",
"ue_s",
"st_s",
"System.out.println(ue_ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ue_ans",
"System.out.println(st_ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"st_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 int p[] = new int[n];\n int s[] = new int[n];\n if(n==0){\n System.out.println(x);\n return;\n }\n for(int i = 0 ; i < n ; ++i){\n p[i] = sc.nextInt(); \n }\n \n Arrays.sort(p);\n \n int ue_s = 0;\n int st_s = 0;\n int ue_ans = 0;\n int st_ans = 0;\n \n\n //うえ\n for(int i = x ; i <= 101 ; ++i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }\n\n //した\n for(int i = x ; i >= 0 ; --i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }\n ue_s = Math.abs(x-ue_ans);\n st_s = Math.abs(x-st_ans);\n if(ue_s<st_s) System.out.println(ue_ans);\n else System.out.println(st_ans);\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 s[] = new int[n];\n if(n==0){\n System.out.println(x);\n return;\n }\n for(int i = 0 ; i < n ; ++i){\n p[i] = sc.nextInt(); \n }\n \n Arrays.sort(p);\n \n int ue_s = 0;\n int st_s = 0;\n int ue_ans = 0;\n int st_ans = 0;\n \n\n //うえ\n for(int i = x ; i <= 101 ; ++i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){ \n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n ue_ans = i;\n break;\n }\n }\n\n //した\n for(int i = x ; i >= 0 ; --i){\n int count=0;\n for(int j = 0 ; j < n ; ++j){\n if(p[j] != i){\n count++; \n }else if(p[j] == i){\n break;\n }\n }if(count == p.length){\n st_ans = i;\n break;\n }\n }\n ue_s = Math.abs(x-ue_ans);\n st_s = Math.abs(x-st_ans);\n if(ue_s<st_s) System.out.println(ue_ans);\n else System.out.println(st_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 p[] = new int[n];
int s[] = new int[n];
if(n==0){
System.out.println(x);
return;
}
for(int i = 0 ; i < n ; ++i){
p[i] = sc.nextInt();
}
Arrays.sort(p);
int ue_s = 0;
int st_s = 0;
int ue_ans = 0;
int st_ans = 0;
//うえ
for(int i = x ; i <= 101 ; ++i){
int count=0;
for(int j = 0 ; j < n ; ++j){
if(p[j] != i){
count++;
}else if(p[j] == i){
break;
}
}if(count == p.length){
ue_ans = i;
break;
}
}
//した
for(int i = x ; i >= 0 ; --i){
int count=0;
for(int j = 0 ; j < n ; ++j){
if(p[j] != i){
count++;
}else if(p[j] == i){
break;
}
}if(count == p.length){
st_ans = i;
break;
}
}
ue_s = Math.abs(x-ue_ans);
st_s = Math.abs(x-st_ans);
if(ue_s<st_s) System.out.println(ue_ans);
else System.out.println(st_ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
29,
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,
18,
13,
13,
41,
13,
17,
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,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
134,
11
],
[
134,
12
],
[
12,
13
],
[
12,
14
],
[
134,
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
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
32,
39
],
[
28,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
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
],
[
58,
59
],
[
57,
60
],
[
60,
61
],
[
61,
62
],
[
40,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
40,
68
],
[
68,
69
],
[
68,
70
],
[
40,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
71,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
97,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
104,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
119,
121
],
[
113,
122
],
[
122,
123
],
[
122,
124
],
[
40,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
15,
131
],
[
131,
132
],
[
0,
133
],
[
133,
134
],
[
133,
135
]
]
| [
"\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args) {\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0){\n System.out.println(x);\n return;\n }else {\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\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 static Scanner sc = new Scanner(System.in);\n public static void main(String[] args) {\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0){\n System.out.println(x);\n return;\n }else {\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\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 int n = sc.nextInt();\n\n if(n == 0){\n System.out.println(x);\n return;\n }else {\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\n }\n }",
"main",
"{\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0){\n System.out.println(x);\n return;\n }else {\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\n }\n }",
"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 }else {\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\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;",
"{\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\n }",
"List<Integer> p = new ArrayList<>();",
"p",
"new ArrayList<>()",
"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",
"int minValue = Integer.MAX_VALUE;",
"minValue",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int ans = 101;",
"ans",
"101",
"for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }",
"{\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }",
"for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }",
"{\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }",
"if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }",
"!p.contains(i)",
"p.contains(i)",
"p.contains",
"p",
"i",
"{\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }",
"if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }",
"minValue > Math.abs(i - x)",
"minValue",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"{\n minValue = Math.abs(i - x);\n ans = i;\n }",
"minValue = Math.abs(i - x)",
"minValue",
"Math.abs(i - x)",
"Math.abs",
"Math",
"i - x",
"i",
"x",
"ans = i",
"ans",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args) {\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0){\n System.out.println(x);\n return;\n }else {\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\n }\n }\n}",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args) {\n int x = sc.nextInt();\n int n = sc.nextInt();\n\n if(n == 0){\n System.out.println(x);\n return;\n }else {\n\n List<Integer> p = new ArrayList<>();\n for (int i = 0; i < n; i++){\n p.add(sc.nextInt());\n }\n\n\n int minValue = Integer.MAX_VALUE;\n int ans = 101;\n for (int i = 0; i <= 101; i++) {\n for(int j = 0; j < n; j++) {\n if(!p.contains(i)){\n if (minValue > Math.abs(i - x)) {\n minValue = Math.abs(i - x);\n ans = i;\n }\n }\n }\n }\n\n System.out.println(ans);\n }\n }\n}",
"Main"
]
|
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int x = sc.nextInt();
int n = sc.nextInt();
if(n == 0){
System.out.println(x);
return;
}else {
List<Integer> p = new ArrayList<>();
for (int i = 0; i < n; i++){
p.add(sc.nextInt());
}
int minValue = Integer.MAX_VALUE;
int ans = 101;
for (int i = 0; i <= 101; i++) {
for(int j = 0; j < n; j++) {
if(!p.contains(i)){
if (minValue > Math.abs(i - x)) {
minValue = Math.abs(i - x);
ans = 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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
11,
1,
41,
13,
17,
1,
40,
13,
30,
30,
0,
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,
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
],
[
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
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
52,
53
],
[
46,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
58,
60
],
[
55,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
67,
74
],
[
55,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
55,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
86,
93
],
[
6,
94
],
[
94,
95
],
[
0,
96
],
[
96,
97
],
[
96,
98
]
]
| [
"import java.util.*;\n \npublic class Main {\n 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 ArrayList<Integer> pList = new ArrayList<Integer>();\n for (int i=0; i<n; i++) {\n pList.add(sc.nextInt());\n }\n // Arrays.sort(pList);\n \n int number;\n for (int i=0; ; i++) {\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> pList = new ArrayList<Integer>();\n for (int i=0; i<n; i++) {\n pList.add(sc.nextInt());\n }\n // Arrays.sort(pList);\n \n int number;\n for (int i=0; ; i++) {\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\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 ArrayList<Integer> pList = new ArrayList<Integer>();\n for (int i=0; i<n; i++) {\n pList.add(sc.nextInt());\n }\n // Arrays.sort(pList);\n \n int number;\n for (int i=0; ; i++) {\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n }\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n ArrayList<Integer> pList = new ArrayList<Integer>();\n for (int i=0; i<n; i++) {\n pList.add(sc.nextInt());\n }\n // Arrays.sort(pList);\n \n int number;\n for (int i=0; ; i++) {\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\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> pList = new ArrayList<Integer>();",
"pList",
"new ArrayList<Integer>()",
"for (int i=0; i<n; i++) {\n pList.add(sc.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n pList.add(sc.nextInt());\n }",
"{\n pList.add(sc.nextInt());\n }",
"pList.add(sc.nextInt())",
"pList.add",
"pList",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int number;",
"number",
"for (int i=0; ; i++) {\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i++",
"i++",
"i",
"{\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n }",
"{\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n }",
"number = x - i",
"number",
"x - i",
"x",
"i",
"if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }",
"!pList.contains(number)",
"pList.contains(number)",
"pList.contains",
"pList",
"number",
"{\n System.out.println(number);\n return;\n }",
"System.out.println(number)",
"System.out.println",
"System.out",
"System",
"System.out",
"number",
"return;",
"number = x + i",
"number",
"x + i",
"x",
"i",
"if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }",
"!pList.contains(number)",
"pList.contains(number)",
"pList.contains",
"pList",
"number",
"{\n System.out.println(number);\n return;\n }",
"System.out.println(number)",
"System.out.println",
"System.out",
"System",
"System.out",
"number",
"return;",
"String[] args",
"args",
"public class Main {\n 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 ArrayList<Integer> pList = new ArrayList<Integer>();\n for (int i=0; i<n; i++) {\n pList.add(sc.nextInt());\n }\n // Arrays.sort(pList);\n \n int number;\n for (int i=0; ; i++) {\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n }\n }\n}",
"public class Main {\n 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 ArrayList<Integer> pList = new ArrayList<Integer>();\n for (int i=0; i<n; i++) {\n pList.add(sc.nextInt());\n }\n // Arrays.sort(pList);\n \n int number;\n for (int i=0; ; i++) {\n number = x - i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\n }\n number = x + i;\n if (!pList.contains(number)) {\n System.out.println(number);\n return;\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();
ArrayList<Integer> pList = new ArrayList<Integer>();
for (int i=0; i<n; i++) {
pList.add(sc.nextInt());
}
// Arrays.sort(pList);
int number;
for (int i=0; ; i++) {
number = x - i;
if (!pList.contains(number)) {
System.out.println(number);
return;
}
number = x + i;
if (!pList.contains(number)) {
System.out.println(number);
return;
}
}
}
}
|
[
7,
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,
41,
13,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
4,
18,
13,
18,
13,
13,
40,
17,
41,
13,
40,
17,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
13,
13,
30,
14,
2,
18,
13,
13,
40,
17,
30,
0,
13,
13,
30,
14,
2,
18,
13,
13,
40,
17,
30,
0,
13,
13,
3,
41,
13,
17,
14,
2,
2,
13,
40,
17,
2,
13,
40,
17,
30,
14,
2,
2,
13,
18,
13,
13,
2,
18,
13,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
14,
2,
2,
13,
40,
17,
2,
13,
40,
17,
30,
0,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
212,
5
],
[
212,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
14,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
22,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
33,
34
],
[
33,
35
],
[
8,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
88,
89
],
[
88,
90
],
[
82,
91
],
[
91,
92
],
[
8,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
8,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
8,
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
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
119,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
114,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
131,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
8,
143
],
[
143,
144
],
[
143,
145
],
[
8,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
146,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
157,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
172,
174
],
[
157,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
146,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
182,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
181,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
194,
196
],
[
181,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
200,
202
],
[
8,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
203,
208
],
[
6,
209
],
[
209,
210
],
[
0,
211
],
[
211,
212
],
[
211,
213
]
]
| [
"\nimport java.util.Scanner;\n\npublic class Main {\n\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 int index = x;\n\n int[] num = new int[102];\n\n for(int i = 0 ; i < 102;i++) {\n num[i] = i;\n }\n \n\n for(int i = 0;i < n;i++) {\n num[Integer.parseInt(str2[i])] = -1;\n }\n int minIndex = -1;\n int maxIndex = -1;\n\n for(int i = 0 ; i < 102;i++) {\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }\n\n int ans = 0;\n if(minIndex != -1 && maxIndex != -1) {\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }else if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n\n System.out.println(ans);\n\n }\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 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 int index = x;\n\n int[] num = new int[102];\n\n for(int i = 0 ; i < 102;i++) {\n num[i] = i;\n }\n \n\n for(int i = 0;i < n;i++) {\n num[Integer.parseInt(str2[i])] = -1;\n }\n int minIndex = -1;\n int maxIndex = -1;\n\n for(int i = 0 ; i < 102;i++) {\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }\n\n int ans = 0;\n if(minIndex != -1 && maxIndex != -1) {\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }else if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n\n System.out.println(ans);\n\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 int index = x;\n\n int[] num = new int[102];\n\n for(int i = 0 ; i < 102;i++) {\n num[i] = i;\n }\n \n\n for(int i = 0;i < n;i++) {\n num[Integer.parseInt(str2[i])] = -1;\n }\n int minIndex = -1;\n int maxIndex = -1;\n\n for(int i = 0 ; i < 102;i++) {\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }\n\n int ans = 0;\n if(minIndex != -1 && maxIndex != -1) {\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }else if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n\n System.out.println(ans);\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 int index = x;\n\n int[] num = new int[102];\n\n for(int i = 0 ; i < 102;i++) {\n num[i] = i;\n }\n \n\n for(int i = 0;i < n;i++) {\n num[Integer.parseInt(str2[i])] = -1;\n }\n int minIndex = -1;\n int maxIndex = -1;\n\n for(int i = 0 ; i < 102;i++) {\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }\n\n int ans = 0;\n if(minIndex != -1 && maxIndex != -1) {\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }else if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n\n System.out.println(ans);\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",
"int index = x;",
"index",
"x",
"int[] num = new int[102];",
"num",
"new int[102]",
"102",
"for(int i = 0 ; i < 102;i++) {\n num[i] = i;\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < 102",
"i",
"102",
"i++",
"i++",
"i",
"{\n num[i] = i;\n }",
"{\n num[i] = i;\n }",
"num[i] = i",
"num[i]",
"num",
"i",
"i",
"for(int i = 0;i < n;i++) {\n num[Integer.parseInt(str2[i])] = -1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n num[Integer.parseInt(str2[i])] = -1;\n }",
"{\n num[Integer.parseInt(str2[i])] = -1;\n }",
"num[Integer.parseInt(str2[i])] = -1",
"num[Integer.parseInt(str2[i])]",
"num",
"Integer.parseInt(str2[i])",
"Integer.parseInt",
"Integer",
"str2[i]",
"str2",
"i",
"-1",
"1",
"int minIndex = -1;",
"minIndex",
"-1",
"1",
"int maxIndex = -1;",
"maxIndex",
"-1",
"1",
"for(int i = 0 ; i < 102;i++) {\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < 102",
"i",
"102",
"i++",
"i++",
"i",
"{\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }",
"{\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }",
"if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }",
"i < index",
"i",
"index",
"{\n if(num[i] != -1) {\n minIndex = i;\n }\n }",
"if(num[i] != -1) {\n minIndex = i;\n }",
"num[i] != -1",
"num[i]",
"num",
"i",
"-1",
"1",
"{\n minIndex = i;\n }",
"minIndex = i",
"minIndex",
"i",
"{\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }",
"if(num[i] != -1) {\n maxIndex = i;\n break;\n }",
"num[i] != -1",
"num[i]",
"num",
"i",
"-1",
"1",
"{\n maxIndex = i;\n break;\n }",
"maxIndex = i",
"maxIndex",
"i",
"break;",
"int ans = 0;",
"ans",
"0",
"if(minIndex != -1 && maxIndex != -1) {\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }else if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }",
"minIndex != -1 && maxIndex != -1",
"minIndex != -1",
"minIndex",
"-1",
"1",
"maxIndex != -1",
"maxIndex",
"-1",
"1",
"{\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }",
"if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }",
"x - num[minIndex] <= num[maxIndex] - x",
"x - num[minIndex]",
"x",
"num[minIndex]",
"num",
"minIndex",
"num[maxIndex] - x",
"num[maxIndex]",
"num",
"maxIndex",
"x",
"{\n ans = num[minIndex];\n }",
"ans = num[minIndex]",
"ans",
"num[minIndex]",
"num",
"minIndex",
"{\n ans = num[maxIndex];\n }",
"ans = num[maxIndex]",
"ans",
"num[maxIndex]",
"num",
"maxIndex",
"if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }",
"minIndex != -1 && maxIndex == -1",
"minIndex != -1",
"minIndex",
"-1",
"1",
"maxIndex == -1",
"maxIndex",
"-1",
"1",
"{\n ans = num[minIndex];\n }",
"ans = num[minIndex]",
"ans",
"num[minIndex]",
"num",
"minIndex",
"{\n ans = num[maxIndex];\n }",
"ans = num[maxIndex]",
"ans",
"num[maxIndex]",
"num",
"maxIndex",
"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 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 int index = x;\n\n int[] num = new int[102];\n\n for(int i = 0 ; i < 102;i++) {\n num[i] = i;\n }\n \n\n for(int i = 0;i < n;i++) {\n num[Integer.parseInt(str2[i])] = -1;\n }\n int minIndex = -1;\n int maxIndex = -1;\n\n for(int i = 0 ; i < 102;i++) {\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }\n\n int ans = 0;\n if(minIndex != -1 && maxIndex != -1) {\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }else if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n\n System.out.println(ans);\n\n }\n\n}",
"public class Main {\n\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 int index = x;\n\n int[] num = new int[102];\n\n for(int i = 0 ; i < 102;i++) {\n num[i] = i;\n }\n \n\n for(int i = 0;i < n;i++) {\n num[Integer.parseInt(str2[i])] = -1;\n }\n int minIndex = -1;\n int maxIndex = -1;\n\n for(int i = 0 ; i < 102;i++) {\n if(i < index) {\n if(num[i] != -1) {\n minIndex = i;\n }\n }else {\n if(num[i] != -1) {\n maxIndex = i;\n break;\n }\n }\n }\n\n int ans = 0;\n if(minIndex != -1 && maxIndex != -1) {\n if(x - num[minIndex] <= num[maxIndex] - x) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n }else if(minIndex != -1 && maxIndex == -1) {\n ans = num[minIndex];\n }else {\n ans = num[maxIndex];\n }\n\n System.out.println(ans);\n\n }\n\n}",
"Main"
]
|
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]);
int index = x;
int[] num = new int[102];
for(int i = 0 ; i < 102;i++) {
num[i] = i;
}
for(int i = 0;i < n;i++) {
num[Integer.parseInt(str2[i])] = -1;
}
int minIndex = -1;
int maxIndex = -1;
for(int i = 0 ; i < 102;i++) {
if(i < index) {
if(num[i] != -1) {
minIndex = i;
}
}else {
if(num[i] != -1) {
maxIndex = i;
break;
}
}
}
int ans = 0;
if(minIndex != -1 && maxIndex != -1) {
if(x - num[minIndex] <= num[maxIndex] - x) {
ans = num[minIndex];
}else {
ans = num[maxIndex];
}
}else if(minIndex != -1 && maxIndex == -1) {
ans = num[minIndex];
}else {
ans = num[maxIndex];
}
System.out.println(ans);
}
}
|
[
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,
38,
30,
41,
13,
20,
4,
18,
20,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
12,
13,
30,
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,
17,
42,
17,
30,
14,
13,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
13,
2,
13,
13,
29,
30,
0,
13,
17,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
4,
18,
13,
2,
13,
13,
29,
30,
40,
13,
0,
13,
17,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
37,
20,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
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
]
| [
[
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
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
28,
35
],
[
35,
36
],
[
36,
37
],
[
21,
38
],
[
38,
39
],
[
19,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
40,
44
],
[
44,
45
],
[
40,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
48,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
46,
59
],
[
59,
60
],
[
46,
61
],
[
61,
62
],
[
40,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
76,
77
],
[
76,
78
],
[
65,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
79,
87
],
[
87,
88
],
[
88,
89
],
[
79,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
96,
97
],
[
65,
98
],
[
98,
99
],
[
98,
100
],
[
65,
101
],
[
101,
102
],
[
101,
103
],
[
65,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
115,
116
],
[
115,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
110,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
107,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
143,
144
],
[
143,
145
],
[
139,
146
],
[
131,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
150,
151
],
[
150,
152
],
[
19,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
153,
160
],
[
160,
161
],
[
160,
162
],
[
153,
164
],
[
164,
165
],
[
164,
166
],
[
153,
167
],
[
167,
168
],
[
167,
169
],
[
153,
170
],
[
170,
171
],
[
170,
172
],
[
153,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
180,
181
],
[
181,
182
],
[
176,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
183,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
187,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
197,
200
],
[
183,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
205,
206
],
[
206,
207
],
[
175,
208
],
[
208,
209
],
[
153,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
213,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
213,
221
],
[
221,
222
],
[
222,
223
],
[
153,
224
],
[
224,
225
],
[
224,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
228,
232
],
[
232,
233
],
[
232,
234
],
[
224,
235
],
[
235,
236
],
[
153,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
241,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
247,
249
],
[
240,
250
],
[
250,
251
],
[
239,
252
],
[
252,
253
],
[
253,
254
],
[
153,
255
],
[
255,
256
],
[
255,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
258,
262
],
[
262,
263
],
[
257,
264
],
[
264,
265
],
[
264,
266
],
[
257,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
257,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
276,
279
],
[
275,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
257,
284
],
[
284,
285
],
[
285,
286
],
[
286,
287
],
[
153,
288
],
[
288,
289
],
[
288,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
291,
295
],
[
295,
296
],
[
290,
297
],
[
297,
298
],
[
297,
299
],
[
290,
300
],
[
300,
301
],
[
300,
302
],
[
290,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
290,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
307,
311
],
[
311,
312
],
[
312,
313
],
[
312,
314
],
[
311,
315
],
[
315,
316
],
[
315,
317
],
[
317,
318
],
[
290,
319
],
[
319,
320
],
[
320,
321
],
[
321,
322
],
[
321,
323
],
[
320,
324
],
[
324,
325
],
[
324,
326
],
[
319,
327
],
[
327,
328
],
[
328,
329
],
[
290,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
333,
334
],
[
334,
335
],
[
335,
336
],
[
335,
337
],
[
334,
338
],
[
338,
339
],
[
338,
340
],
[
333,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
341,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
347,
349
],
[
333,
350
],
[
350,
351
],
[
351,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
351,
356
],
[
356,
357
],
[
357,
358
],
[
357,
359
],
[
350,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
362,
364
],
[
364,
365
],
[
362,
366
],
[
350,
367
],
[
367,
368
],
[
368,
369
],
[
332,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
153,
374
],
[
374,
375
],
[
374,
376
],
[
376,
377
],
[
377,
378
],
[
377,
379
],
[
379,
380
],
[
376,
381
],
[
381,
382
],
[
382,
383
],
[
383,
384
],
[
383,
385
],
[
385,
386
],
[
385,
387
],
[
382,
388
],
[
388,
389
],
[
388,
390
],
[
390,
391
],
[
390,
392
],
[
381,
393
],
[
393,
394
],
[
376,
395
],
[
395,
396
],
[
153,
397
],
[
397,
398
],
[
397,
399
],
[
399,
400
],
[
400,
401
],
[
401,
402
],
[
402,
403
],
[
401,
404
],
[
404,
405
],
[
153,
406
],
[
406,
407
],
[
406,
408
],
[
408,
409
],
[
409,
410
],
[
409,
411
],
[
408,
413
],
[
413,
414
],
[
414,
415
],
[
415,
416
],
[
415,
417
],
[
413,
418
],
[
418,
419
],
[
418,
420
],
[
413,
421
],
[
421,
422
],
[
422,
423
],
[
413,
424
],
[
424,
425
],
[
425,
426
],
[
426,
427
],
[
426,
428
],
[
425,
429
],
[
429,
430
],
[
408,
431
],
[
431,
432
],
[
406,
433
],
[
433,
434
],
[
153,
435
],
[
435,
436
],
[
435,
437
],
[
437,
438
],
[
438,
439
],
[
438,
440
],
[
437,
442
],
[
442,
443
],
[
443,
444
],
[
444,
445
],
[
444,
446
],
[
442,
447
],
[
447,
448
],
[
447,
449
],
[
442,
450
],
[
450,
451
],
[
451,
452
],
[
442,
453
],
[
453,
454
],
[
454,
455
],
[
455,
456
],
[
455,
457
],
[
454,
458
],
[
458,
459
],
[
437,
460
],
[
460,
461
],
[
435,
462
],
[
462,
463
]
]
| [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.HashSet;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\n\nclass Main {\n\n static class Solver {\n final FastScanner sc;\n final PrintWriter writer;\n\n Solver(final FastScanner sc, final PrintWriter writer) {\n this.sc = sc;\n this.writer = writer;\n }\n\n void run() {\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 }\n int abs = 0;\n boolean minus = true;\n while (true) {\n if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }\n }\n }\n }\n\n public static void main(final String[] args) {\n final FastScanner sc = new FastScanner();\n try (final PrintWriter w = new PrintWriter(System.out)) {\n new Solver(sc, w).run();\n w.flush();\n }\n }\n\n // FastScanner\n static 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 public FastScanner() {\n }\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 (final IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private boolean isPrintableChar(final int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n final StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n 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 final long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(final int n) {\n final int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(final int n) {\n final long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\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.HashSet;",
"HashSet",
"java.util",
"import java.util.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"class Main {\n\n static class Solver {\n final FastScanner sc;\n final PrintWriter writer;\n\n Solver(final FastScanner sc, final PrintWriter writer) {\n this.sc = sc;\n this.writer = writer;\n }\n\n void run() {\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 }\n int abs = 0;\n boolean minus = true;\n while (true) {\n if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }\n }\n }\n }\n\n public static void main(final String[] args) {\n final FastScanner sc = new FastScanner();\n try (final PrintWriter w = new PrintWriter(System.out)) {\n new Solver(sc, w).run();\n w.flush();\n }\n }\n\n // FastScanner\n static 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 public FastScanner() {\n }\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 (final IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private boolean isPrintableChar(final int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n final StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n 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 final long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(final int n) {\n final int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(final int n) {\n final long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n}",
"Main",
"public static void main(final String[] args) {\n final FastScanner sc = new FastScanner();\n try (final PrintWriter w = new PrintWriter(System.out)) {\n new Solver(sc, w).run();\n w.flush();\n }\n }",
"main",
"{\n final FastScanner sc = new FastScanner();\n try (final PrintWriter w = new PrintWriter(System.out)) {\n new Solver(sc, w).run();\n w.flush();\n }\n }",
"final FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"try (final PrintWriter w = new PrintWriter(System.out)) {\n new Solver(sc, w).run();\n w.flush();\n }",
"{\n new Solver(sc, w).run();\n w.flush();\n }",
"final PrintWriter w = new PrintWriter(System.out)",
"final PrintWriter w = new PrintWriter(System.out)",
"new PrintWriter(System.out)",
"new Solver(sc, w).run()",
"new Solver(sc, w).run",
"new Solver(sc, w)",
"w.flush()",
"w.flush",
"w",
"final String[] args",
"args",
"static class Solver {\n final FastScanner sc;\n final PrintWriter writer;\n\n Solver(final FastScanner sc, final PrintWriter writer) {\n this.sc = sc;\n this.writer = writer;\n }\n\n void run() {\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 }\n int abs = 0;\n boolean minus = true;\n while (true) {\n if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }\n }\n }\n }",
"Solver",
"final FastScanner sc;",
"sc",
"final PrintWriter writer;",
"writer",
"Solver(final FastScanner sc, final PrintWriter writer) {\n this.sc = sc;\n this.writer = writer;\n }",
"Solver",
"{\n this.sc = sc;\n this.writer = writer;\n }",
"this.sc = sc",
"this.sc",
"this",
"this.sc",
"sc",
"this.writer = writer",
"this.writer",
"this",
"this.writer",
"writer",
"final FastScanner sc",
"sc",
"final PrintWriter writer",
"writer",
"void run() {\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 }\n int abs = 0;\n boolean minus = true;\n while (true) {\n if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }\n }\n }",
"run",
"{\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 }\n int abs = 0;\n boolean minus = true;\n while (true) {\n if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }\n }\n }",
"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());\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 abs = 0;",
"abs",
"0",
"boolean minus = true;",
"minus",
"true",
"while (true) {\n if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }\n }",
"true",
"{\n if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }\n }",
"if (minus) {\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n } else {\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }",
"minus",
"{\n if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }\n }",
"if (!set.contains(x - abs)) {\n writer.println(x - abs);\n return;\n } else {\n minus = false;\n }",
"!set.contains(x - abs)",
"set.contains(x - abs)",
"set.contains",
"set",
"x - abs",
"x",
"abs",
"{\n writer.println(x - abs);\n return;\n }",
"writer.println(x - abs)",
"writer.println",
"writer",
"x - abs",
"x",
"abs",
"return;",
"{\n minus = false;\n }",
"minus = false",
"minus",
"false",
"{\n if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }\n }",
"if (!set.contains(x + abs)) {\n writer.println(x + abs);\n return;\n } else {\n abs++;\n minus = true;\n }",
"!set.contains(x + abs)",
"set.contains(x + abs)",
"set.contains",
"set",
"x + abs",
"x",
"abs",
"{\n writer.println(x + abs);\n return;\n }",
"writer.println(x + abs)",
"writer.println",
"writer",
"x + abs",
"x",
"abs",
"return;",
"{\n abs++;\n minus = true;\n }",
"abs++",
"abs",
"minus = true",
"minus",
"true",
"static 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 public FastScanner() {\n }\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 (final IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private boolean isPrintableChar(final int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n final StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n 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 final long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(final int n) {\n final int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(final int n) {\n final long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"public FastScanner() {\n }",
"FastScanner",
"{\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 (final 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 (final 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 (final 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 (final 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 (final IOException e) {\n e.printStackTrace();\n }",
"catch (final IOException e) {\n e.printStackTrace();\n }",
"final IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }",
"readByte",
"{\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }",
"if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private boolean isPrintableChar(final int c) {\n return 33 <= c && c <= 126;\n }",
"isPrintableChar",
"{\n return 33 <= c && c <= 126;\n }",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"final int c",
"c",
"public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }",
"hasNext",
"{\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }",
"while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n 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())\n throw new NoSuchElementException();\n final StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"next",
"{\n if (!hasNext())\n throw new NoSuchElementException();\n final StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"if (!hasNext())\n throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"final StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n sb.appendCodePoint(b);\n b = readByte();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"nextLong",
"{\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"if (!hasNext())\n throw new NoSuchElementException();",
"!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 final long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }",
"nextInt",
"{\n final long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }",
"final long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n 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() {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] nextIntArray(final int n) {\n final int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }",
"nextIntArray",
"{\n final int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }",
"final int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n 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",
"final int n",
"n",
"public long[] nextLongArray(final int n) {\n final long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }",
"nextLongArray",
"{\n final long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }",
"final long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n 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",
"final int n",
"n"
]
| import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;
class Main {
static class Solver {
final FastScanner sc;
final PrintWriter writer;
Solver(final FastScanner sc, final PrintWriter writer) {
this.sc = sc;
this.writer = writer;
}
void run() {
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 abs = 0;
boolean minus = true;
while (true) {
if (minus) {
if (!set.contains(x - abs)) {
writer.println(x - abs);
return;
} else {
minus = false;
}
} else {
if (!set.contains(x + abs)) {
writer.println(x + abs);
return;
} else {
abs++;
minus = true;
}
}
}
}
}
public static void main(final String[] args) {
final FastScanner sc = new FastScanner();
try (final PrintWriter w = new PrintWriter(System.out)) {
new Solver(sc, w).run();
w.flush();
}
}
// FastScanner
static class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
public FastScanner() {
}
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (final IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private boolean isPrintableChar(final 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();
final 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() {
final long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int) nl;
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] nextIntArray(final int n) {
final int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(final int n) {
final long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
41,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
2,
13,
13,
17,
2,
18,
13,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
3,
30,
14,
2,
2,
2,
13,
13,
13,
2,
18,
13,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
3,
4,
18,
18,
13,
13,
13,
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
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
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
],
[
53,
55
],
[
52,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
57,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
77,
83
],
[
70,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
70,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
99,
105
],
[
92,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
8,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
8,
119
],
[
119,
120
],
[
120,
121
],
[
6,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
]
| [
"import java.util.*;\n\npublic class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint X = keyboard.nextInt();\n\t\tint N = keyboard.nextInt();\n\t\t\n\t\tint p;\n\t\tfinal int nmax = 102;\n\t\tint[] hako = new int[nmax];\n\t\t\n\t\tint ans = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}\n\t\t\n\t\tfor(int j=0; j<nmax; j++) {\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint X = keyboard.nextInt();\n\t\tint N = keyboard.nextInt();\n\t\t\n\t\tint p;\n\t\tfinal int nmax = 102;\n\t\tint[] hako = new int[nmax];\n\t\t\n\t\tint ans = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}\n\t\t\n\t\tfor(int j=0; j<nmax; j++) {\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint X = keyboard.nextInt();\n\t\tint N = keyboard.nextInt();\n\t\t\n\t\tint p;\n\t\tfinal int nmax = 102;\n\t\tint[] hako = new int[nmax];\n\t\t\n\t\tint ans = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}\n\t\t\n\t\tfor(int j=0; j<nmax; j++) {\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t}",
"main",
"{\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint X = keyboard.nextInt();\n\t\tint N = keyboard.nextInt();\n\t\t\n\t\tint p;\n\t\tfinal int nmax = 102;\n\t\tint[] hako = new int[nmax];\n\t\t\n\t\tint ans = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}\n\t\t\n\t\tfor(int j=0; j<nmax; j++) {\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t}",
"Scanner keyboard = new Scanner(System.in);",
"keyboard",
"new Scanner(System.in)",
"int X = keyboard.nextInt();",
"X",
"keyboard.nextInt()",
"keyboard.nextInt",
"keyboard",
"int N = keyboard.nextInt();",
"N",
"keyboard.nextInt()",
"keyboard.nextInt",
"keyboard",
"int p;",
"p",
"final int nmax = 102;",
"nmax",
"102",
"int[] hako = new int[nmax];",
"hako",
"new int[nmax]",
"nmax",
"int ans = 0;",
"ans",
"0",
"for(int i=0; i<N; i++) {\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}",
"{\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}",
"p = keyboard.nextInt()",
"p",
"keyboard.nextInt()",
"keyboard.nextInt",
"keyboard",
"hako[p] = 1",
"hako[p]",
"hako",
"p",
"1",
"for(int j=0; j<nmax; j++) {\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<nmax",
"j",
"nmax",
"j++",
"j++",
"j",
"{\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"if(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"X-j >=0 && hako[X-j] == 0",
"X-j >=0",
"X-j",
"X",
"j",
"0",
"hako[X-j] == 0",
"hako[X-j]",
"hako",
"X-j",
"X",
"j",
"0",
"{\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t}",
"ans = X-j",
"ans",
"X-j",
"X",
"j",
"break;",
"{\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"X+j <nmax && hako[X+j] == 0",
"X+j <nmax",
"X+j",
"X",
"j",
"nmax",
"hako[X+j] == 0",
"hako[X+j]",
"hako",
"X+j",
"X",
"j",
"0",
"{\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans = X+j",
"ans",
"X+j",
"X",
"j",
"break;",
"System.out.print(ans)",
"System.out.print",
"System.out",
"System",
"System.out",
"ans",
"keyboard.close()",
"keyboard.close",
"keyboard",
"String[] args",
"args",
"public class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint X = keyboard.nextInt();\n\t\tint N = keyboard.nextInt();\n\t\t\n\t\tint p;\n\t\tfinal int nmax = 102;\n\t\tint[] hako = new int[nmax];\n\t\t\n\t\tint ans = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}\n\t\t\n\t\tfor(int j=0; j<nmax; j++) {\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t}\n}",
"public class Main {\npublic static void main(String[] args) {\n\t\t\n\t\tScanner keyboard = new Scanner(System.in); \n\t\t\n\t\tint X = keyboard.nextInt();\n\t\tint N = keyboard.nextInt();\n\t\t\n\t\tint p;\n\t\tfinal int nmax = 102;\n\t\tint[] hako = new int[nmax];\n\t\t\n\t\tint ans = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tp = keyboard.nextInt();\n\t\t\thako[p] = 1;\n\t\t}\n\t\t\n\t\tfor(int j=0; j<nmax; j++) {\n\t\t\tif(X-j >=0 && hako[X-j] == 0){\n\t\t\t\tans = X-j;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t\telse {\n\t\t\t\tif(X+j <nmax && hako[X+j] == 0){\n\t\t\t\t\tans = X+j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.print(ans);\n\t\tkeyboard.close();\t\n\t}\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int X = keyboard.nextInt();
int N = keyboard.nextInt();
int p;
final int nmax = 102;
int[] hako = new int[nmax];
int ans = 0;
for(int i=0; i<N; i++) {
p = keyboard.nextInt();
hako[p] = 1;
}
for(int j=0; j<nmax; j++) {
if(X-j >=0 && hako[X-j] == 0){
ans = X-j;
break;
}
else {
if(X+j <nmax && hako[X+j] == 0){
ans = X+j;
break;
}
}
}
System.out.print(ans);
keyboard.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
13,
23,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
17,
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,
41,
13,
17,
14,
40,
4,
18,
4,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
0,
13,
17,
41,
13,
17,
14,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
2,
13,
13,
14,
40,
4,
18,
4,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
3,
0,
13,
2,
13,
13,
14,
40,
4,
18,
4,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
3,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
164,
8
],
[
164,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
9,
14
],
[
14,
15
],
[
164,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
19,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
35,
38
],
[
38,
39
],
[
39,
40
],
[
29,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
29,
49
],
[
49,
50
],
[
49,
51
],
[
29,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
74,
75
],
[
29,
76
],
[
76,
77
],
[
76,
78
],
[
29,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
81,
87
],
[
79,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
88,
95
],
[
95,
96
],
[
95,
97
],
[
29,
98
],
[
98,
99
],
[
98,
100
],
[
29,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
104,
114
],
[
114,
115
],
[
115,
116
],
[
104,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
126,
132
],
[
124,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
133,
140
],
[
118,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
118,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
148,
154
],
[
146,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
155,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n c();\n }\n\n public static void c() {\n try (Scanner sc = new Scanner(System.in)) {\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }\n } catch (Exception E) {\n System.out.println(\"エラー\");\n }\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n c();\n }\n\n public static void c() {\n try (Scanner sc = new Scanner(System.in)) {\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }\n } catch (Exception E) {\n System.out.println(\"エラー\");\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n c();\n }",
"main",
"{\n c();\n }",
"c()",
"c",
"String[] args",
"args",
"public static void c() {\n try (Scanner sc = new Scanner(System.in)) {\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }\n } catch (Exception E) {\n System.out.println(\"エラー\");\n }\n }",
"c",
"{\n try (Scanner sc = new Scanner(System.in)) {\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }\n } catch (Exception E) {\n System.out.println(\"エラー\");\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }\n } catch (Exception E) {\n System.out.println(\"エラー\");\n }",
"catch (Exception E) {\n System.out.println(\"エラー\");\n }",
"Exception E",
"{\n System.out.println(\"エラー\");\n }",
"System.out.println(\"エラー\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"エラー\"",
"{\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\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 y = Integer.parseInt(sc.next());",
"y",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"Integer[] a = new Integer[y];",
"a",
"new Integer[y]",
"y",
"for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }",
"int z = 0;",
"int z = 0;",
"z",
"0",
"z < y",
"z",
"y",
"z++",
"z++",
"z",
"{\n a[z] = Integer.parseInt(sc.next());\n }",
"{\n a[z] = Integer.parseInt(sc.next());\n }",
"a[z] = Integer.parseInt(sc.next())",
"a[z]",
"a",
"z",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"Boolean flg = true;",
"flg",
"true",
"if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }",
"!Arrays.asList(a).contains(x)",
"Arrays.asList(a).contains(x)",
"Arrays.asList(a).contains",
"Arrays.asList(a)",
"Arrays.asList",
"Arrays",
"a",
"x",
"{\n System.out.println(x);\n flg = false;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"flg = false",
"flg",
"false",
"int ans = 0;",
"ans",
"0",
"if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }",
"flg",
"{\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }",
"for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }",
"int q = 1;",
"int q = 1;",
"q",
"1",
"q < y + 2",
"q",
"y + 2",
"y",
"2",
"q++",
"q++",
"q",
"{\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }",
"{\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }",
"ans = x - q",
"ans",
"x - q",
"x",
"q",
"if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }",
"!Arrays.asList(a).contains(ans)",
"Arrays.asList(a).contains(ans)",
"Arrays.asList(a).contains",
"Arrays.asList(a)",
"Arrays.asList",
"Arrays",
"a",
"ans",
"{\n System.out.println(ans);\n break;\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"break;",
"ans = x + q",
"ans",
"x + q",
"x",
"q",
"if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }",
"!Arrays.asList(a).contains(ans)",
"Arrays.asList(a).contains(ans)",
"Arrays.asList(a).contains",
"Arrays.asList(a)",
"Arrays.asList",
"Arrays",
"a",
"ans",
"{\n System.out.println(ans);\n break;\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"break;",
"public class Main {\n public static void main(String[] args) {\n c();\n }\n\n public static void c() {\n try (Scanner sc = new Scanner(System.in)) {\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }\n } catch (Exception E) {\n System.out.println(\"エラー\");\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n c();\n }\n\n public static void c() {\n try (Scanner sc = new Scanner(System.in)) {\n int x = Integer.parseInt(sc.next());\n int y = Integer.parseInt(sc.next());\n Integer[] a = new Integer[y];\n for (int z = 0; z < y; z++) {\n a[z] = Integer.parseInt(sc.next());\n }\n Boolean flg = true;\n if (!Arrays.asList(a).contains(x)) {\n System.out.println(x);\n flg = false;\n }\n int ans = 0;\n if (flg) {\n for (int q = 1; q < y + 2; q++) {\n ans = x - q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n ans = x + q;\n if (!Arrays.asList(a).contains(ans)) {\n System.out.println(ans);\n break;\n }\n }\n }\n } catch (Exception E) {\n System.out.println(\"エラー\");\n }\n }\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
c();
}
public static void c() {
try (Scanner sc = new Scanner(System.in)) {
int x = Integer.parseInt(sc.next());
int y = Integer.parseInt(sc.next());
Integer[] a = new Integer[y];
for (int z = 0; z < y; z++) {
a[z] = Integer.parseInt(sc.next());
}
Boolean flg = true;
if (!Arrays.asList(a).contains(x)) {
System.out.println(x);
flg = false;
}
int ans = 0;
if (flg) {
for (int q = 1; q < y + 2; q++) {
ans = x - q;
if (!Arrays.asList(a).contains(ans)) {
System.out.println(ans);
break;
}
ans = x + q;
if (!Arrays.asList(a).contains(ans)) {
System.out.println(ans);
break;
}
}
}
} catch (Exception E) {
System.out.println("エラー");
}
}
} |
[
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,
29,
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,
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,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
120,
11
],
[
120,
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
],
[
32,
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
],
[
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
],
[
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
],
[
78,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
104,
113
],
[
14,
114
],
[
114,
115
],
[
115,
116
],
[
12,
117
],
[
117,
118
],
[
0,
119
],
[
119,
120
],
[
119,
121
]
]
| [
"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\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\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\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}\n\t\t\telse 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\n\t\tsc.close();\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\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\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\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}\n\t\t\telse 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\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\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\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}\n\t\t\telse 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\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\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\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}\n\t\t\telse 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\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",
"if (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}",
"N == 0",
"N",
"0",
"{\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}",
"System.out.println(X)",
"System.out.println",
"System.out",
"System",
"System.out",
"X",
"sc.close()",
"sc.close",
"sc",
"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",
"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}\n\t\t\telse 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}\n\t\t\telse 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}\n\t\t\telse 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}\n\t\t\telse 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;",
"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\n\t\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\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\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}\n\t\t\telse 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\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\n\t\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint N = sc.nextInt();\n\t\t\n\t\tif (N == 0) {\n\t\t\tSystem.out.println(X);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\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\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}\n\t\t\telse 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\n\t\tsc.close();\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);
sc.close();
return;
}
Set<Integer> p = new HashSet<>();
for (int i = 0; i < N; i++) {
p.add(sc.nextInt());
}
// 結果の出力
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;
}
}
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
40,
18,
13,
4,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
17,
2,
18,
13,
13,
17,
30,
0,
13,
4,
18,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
13,
14,
2,
13,
17,
30,
0,
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,
12,
13,
30,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
13,
17,
30,
29,
4,
13,
13,
2,
13,
13,
30,
29,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
17,
23,
13,
12,
13,
30,
29,
4,
18,
13,
23,
13,
12,
13,
30,
29,
2,
13,
17,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
29,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
422,
5
],
[
422,
6
],
[
6,
7
],
[
6,
8
],
[
422,
9
],
[
9,
10
],
[
9,
11
],
[
422,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
14,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
23,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
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
],
[
55,
56
],
[
34,
57
],
[
57,
58
],
[
57,
59
],
[
34,
60
],
[
60,
61
],
[
60,
62
],
[
34,
63
],
[
63,
64
],
[
63,
65
],
[
34,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
66,
72
],
[
72,
73
],
[
72,
74
],
[
66,
75
],
[
75,
76
],
[
76,
77
],
[
66,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
80,
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
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
79,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
120,
121
],
[
120,
122
],
[
114,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
34,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
12,
140
],
[
140,
141
],
[
422,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
147,
147
],
[
147,
148
],
[
147,
149
],
[
147,
150
],
[
150,
151
],
[
150,
152
],
[
150,
153
],
[
142,
154
],
[
154,
155
],
[
142,
156
],
[
156,
157
],
[
422,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
161,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
169,
172
],
[
172,
173
],
[
172,
174
],
[
161,
175
],
[
175,
176
],
[
176,
177
],
[
158,
178
],
[
178,
179
],
[
158,
180
],
[
180,
181
],
[
422,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
182,
189
],
[
189,
190
],
[
422,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
191,
198
],
[
198,
199
],
[
422,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
422,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
211,
214
],
[
214,
215
],
[
215,
216
],
[
422,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
221,
224
],
[
224,
225
],
[
225,
226
],
[
422,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
231,
234
],
[
234,
235
],
[
235,
236
],
[
422,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
241,
244
],
[
237,
245
],
[
245,
246
],
[
422,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
250,
251
],
[
251,
252
],
[
252,
253
],
[
247,
254
],
[
254,
255
],
[
422,
256
],
[
256,
257
],
[
256,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
256,
263
],
[
263,
264
],
[
422,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
270,
271
],
[
270,
272
],
[
267,
273
],
[
273,
274
],
[
273,
275
],
[
275,
276
],
[
275,
277
],
[
267,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
278,
283
],
[
283,
284
],
[
283,
285
],
[
278,
286
],
[
286,
287
],
[
287,
288
],
[
278,
289
],
[
290,
290
],
[
290,
291
],
[
291,
292
],
[
291,
293
],
[
293,
294
],
[
294,
295
],
[
293,
296
],
[
293,
297
],
[
297,
298
],
[
297,
299
],
[
267,
300
],
[
300,
301
],
[
265,
302
],
[
302,
303
],
[
422,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
307,
308
],
[
307,
309
],
[
309,
310
],
[
309,
311
],
[
306,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
314,
316
],
[
306,
317
],
[
317,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
317,
322
],
[
322,
323
],
[
322,
324
],
[
317,
325
],
[
325,
326
],
[
326,
327
],
[
317,
328
],
[
329,
329
],
[
329,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
333,
334
],
[
332,
335
],
[
332,
336
],
[
336,
337
],
[
336,
338
],
[
306,
339
],
[
339,
340
],
[
304,
341
],
[
341,
342
],
[
422,
343
],
[
343,
344
],
[
343,
345
],
[
345,
346
],
[
346,
347
],
[
346,
348
],
[
348,
349
],
[
348,
350
],
[
345,
351
],
[
351,
352
],
[
351,
353
],
[
353,
354
],
[
353,
355
],
[
345,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
358,
360
],
[
356,
361
],
[
361,
362
],
[
361,
363
],
[
356,
364
],
[
364,
365
],
[
365,
366
],
[
356,
367
],
[
368,
368
],
[
368,
369
],
[
369,
370
],
[
369,
371
],
[
371,
372
],
[
372,
373
],
[
371,
374
],
[
371,
375
],
[
375,
376
],
[
375,
377
],
[
345,
378
],
[
378,
379
],
[
343,
380
],
[
380,
381
],
[
422,
382
],
[
382,
383
],
[
382,
384
],
[
384,
385
],
[
385,
386
],
[
385,
387
],
[
387,
388
],
[
387,
389
],
[
384,
390
],
[
390,
391
],
[
390,
392
],
[
392,
393
],
[
392,
394
],
[
384,
395
],
[
395,
396
],
[
396,
397
],
[
397,
398
],
[
397,
399
],
[
395,
400
],
[
400,
401
],
[
400,
402
],
[
395,
403
],
[
403,
404
],
[
404,
405
],
[
395,
406
],
[
407,
407
],
[
407,
408
],
[
408,
409
],
[
408,
410
],
[
410,
411
],
[
411,
412
],
[
410,
413
],
[
410,
414
],
[
414,
415
],
[
414,
416
],
[
384,
417
],
[
417,
418
],
[
382,
419
],
[
419,
420
],
[
0,
421
],
[
421,
422
],
[
421,
423
]
]
| [
"import java.util.*;\n\n//update 2020/1/1 23:01\n\npublic class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n int x = nextInt();\n int n = nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n int[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\n\n }\n\n\n\n //System.out.println();\n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n int x = nextInt();\n int n = nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n int[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\n\n }\n\n\n\n //System.out.println();\n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"static StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"public static void main(String[] args) {\n\n int x = nextInt();\n int n = nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n int[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\n\n }\n\n\n\n //System.out.println();\n\n }",
"main",
"{\n\n int x = nextInt();\n int n = nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n int[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\n\n }\n\n\n\n //System.out.println();\n\n }",
"int x = nextInt();",
"x",
"nextInt()",
"nextInt",
"int n = nextInt();",
"n",
"nextInt()",
"nextInt",
"if(n==0){\n System.out.println(x);\n }\n else{\n int[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\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[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\n\n }",
"int[] p = new int[210];",
"p",
"new int[210]",
"210",
"for(int i=0;i<n;i++){\n p[nextInt()]++;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[nextInt()]++;\n }",
"{\n p[nextInt()]++;\n }",
"p[nextInt()]++",
"p[nextInt()]",
"p",
"nextInt()",
"nextInt",
"int abs = 0;",
"abs",
"0",
"int ans = 999;",
"ans",
"999",
"int anss = 0;",
"anss",
"0",
"for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }",
"int i=-100;",
"int i=-100;",
"i",
"-100",
"100",
"i<105",
"i",
"105",
"i++",
"i++",
"i",
"{\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }",
"{\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }",
"if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }",
"i>=0 && p[i]==0",
"i>=0",
"i",
"0",
"p[i]==0",
"p[i]",
"p",
"i",
"0",
"{\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }",
"abs = Math.abs(i-x)",
"abs",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"if(abs<ans){\n ans = abs;\n anss = i;\n }",
"abs<ans",
"abs",
"ans",
"{\n ans = abs;\n anss = i;\n }",
"ans = abs",
"ans",
"abs",
"anss = i",
"anss",
"i",
"if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }",
"i<0",
"i",
"0",
"{\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }",
"abs = Math.abs(i-x)",
"abs",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"if(abs<ans){\n ans = abs;\n anss = i;\n }",
"abs<ans",
"abs",
"ans",
"{\n ans = abs;\n anss = i;\n }",
"ans = abs",
"ans",
"abs",
"anss = i",
"anss",
"i",
"System.out.println(anss)",
"System.out.println",
"System.out",
"System",
"System.out",
"anss",
"String[] args",
"args",
"static int lcm(int a,int 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*gcd(a,b)",
"a",
"b",
"gcd(a,b)",
"gcd",
"a",
"b",
"int a",
"a",
"int b",
"b",
"static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }",
"gcd",
"{\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }",
"if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }",
"a%b!=0",
"a%b",
"a",
"b",
"0",
"{\n return gcd(b,a%b);\n }",
"return gcd(b,a%b);",
"gcd(b,a%b)",
"gcd",
"b",
"a%b",
"a",
"b",
"{\n return b;\n }",
"return b;",
"b",
"int a",
"a",
"int b",
"b",
"static String toSmall(String s){\n return s.toLowerCase();\n }",
"toSmall",
"{\n return s.toLowerCase();\n }",
"return s.toLowerCase();",
"s.toLowerCase()",
"s.toLowerCase",
"s",
"String s",
"s",
"static String toBig(String s){\n return s.toUpperCase();\n }",
"toBig",
"{\n return s.toUpperCase();\n }",
"return s.toUpperCase();",
"s.toUpperCase()",
"s.toUpperCase",
"s",
"String s",
"s",
"static String next(){\n return sc.next();\n }",
"next",
"{\n return sc.next();\n }",
"return sc.next();",
"sc.next()",
"sc.next",
"sc",
"static int nextInt(){\n return Integer.parseInt(sc.next());\n }",
"nextInt",
"{\n return Integer.parseInt(sc.next());\n }",
"return Integer.parseInt(sc.next());",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"static long nextLong(){\n return Long.parseLong(sc.next());\n }",
"nextLong",
"{\n return Long.parseLong(sc.next());\n }",
"return Long.parseLong(sc.next());",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"static double nextDouble(){\n return Double.parseDouble(sc.next());\n }",
"nextDouble",
"{\n return Double.parseDouble(sc.next());\n }",
"return Double.parseDouble(sc.next());",
"Double.parseDouble(sc.next())",
"Double.parseDouble",
"Double",
"sc.next()",
"sc.next",
"sc",
"static String[] splitString(String s){\n return s.split(\"\");\n }",
"splitString",
"{\n return s.split(\"\");\n }",
"return s.split(\"\");",
"s.split(\"\")",
"s.split",
"s",
"\"\"",
"String s",
"s",
"static char[] splitChar(String s){\n return s.toCharArray();\n }",
"splitChar",
"{\n return s.toCharArray();\n }",
"return s.toCharArray();",
"s.toCharArray()",
"s.toCharArray",
"s",
"String s",
"s",
"static int charToInt(char a){\n return a - 48;\n }",
"charToInt",
"{\n return a - 48;\n }",
"return a - 48;",
"a - 48",
"a",
"48",
"char a",
"a",
"////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"max",
"{\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"int max = a[0];",
"max",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n max = Math.max(max,a[i]);\n }",
"{\n max = Math.max(max,a[i]);\n }",
"max = Math.max(max,a[i])",
"max",
"Math.max(max,a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"return max;",
"max",
"int[] a",
"a",
"public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"max",
"{\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"long max = a[0];",
"max",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n max = Math.max(max,a[i]);\n }",
"{\n max = Math.max(max,a[i]);\n }",
"max = Math.max(max,a[i])",
"max",
"Math.max(max,a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"return max;",
"max",
"long[] a",
"a",
"////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"min",
"{\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"int min = a[0];",
"min",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n min = Math.min(min,a[i]);\n }",
"{\n min = Math.min(min,a[i]);\n }",
"min = Math.min(min,a[i])",
"min",
"Math.min(min,a[i])",
"Math.min",
"Math",
"min",
"a[i]",
"a",
"i",
"return min;",
"min",
"int[] a",
"a",
"public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"min",
"{\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }",
"int lng = a.length;",
"lng",
"a.length",
"a",
"a.length",
"long min = a[0];",
"min",
"a[0]",
"a",
"0",
"for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<lng",
"i",
"lng",
"i++",
"i++",
"i",
"{\n min = Math.min(min,a[i]);\n }",
"{\n min = Math.min(min,a[i]);\n }",
"min = Math.min(min,a[i])",
"min",
"Math.min(min,a[i])",
"Math.min",
"Math",
"min",
"a[i]",
"a",
"i",
"return min;",
"min",
"long[] a",
"a",
"public class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n int x = nextInt();\n int n = nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n int[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\n\n }\n\n\n\n //System.out.println();\n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"public class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n int x = nextInt();\n int n = nextInt();\n if(n==0){\n System.out.println(x);\n }\n else{\n int[] p = new int[210];\n for(int i=0;i<n;i++){\n p[nextInt()]++;\n }\n\n int abs = 0;\n int ans = 999;\n int anss = 0;\n\n for(int i=-100;i<105;i++){\n if(i>=0 && p[i]==0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n if(i<0){\n abs = Math.abs(i-x);\n if(abs<ans){\n ans = abs;\n anss = i;\n }\n }\n }\n\n System.out.println(anss);\n\n }\n\n\n\n //System.out.println();\n\n }\n\n static int lcm(int a,int b){\n return a*b*gcd(a,b);\n }\n\n static int gcd(int a,int b){\n if(a%b!=0){\n return gcd(b,a%b);\n }\n else{\n return b;\n }\n }\n\n /*\n static String toSmall(String s){\n char c = s.charAt(0);\n //if(Character.isUpperCase(c)){\n if(c<=90){\n c += 32;\n }\n return String.valueOf(c);\n }\n static String toBig(String s){\n char c = s.charAt(0);\n //if(Character.isLowerCase(c)){\n if(c>=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n public static long max(long[] a){\n int lng = a.length;\n long max = a[0];\n for(int i=1;i<lng;i++){\n max = Math.max(max,a[i]);\n }\n return max;\n }\n////////////////////////////////////////////\n\n////////////////////////////////////////////\n public static int min(int[] a){\n int lng = a.length;\n int min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n public static long min(long[] a){\n int lng = a.length;\n long min = a[0];\n for(int i=1;i<lng;i++){\n min = Math.min(min,a[i]);\n }\n return min;\n }\n////////////////////////////////////////////\n\n}",
"Main"
]
| import java.util.*;
//update 2020/1/1 23:01
public class Main{
static Scanner sc = new Scanner(System.in);
static StringBuilder sb = new StringBuilder();
public static void main(String[] args) {
int x = nextInt();
int n = nextInt();
if(n==0){
System.out.println(x);
}
else{
int[] p = new int[210];
for(int i=0;i<n;i++){
p[nextInt()]++;
}
int abs = 0;
int ans = 999;
int anss = 0;
for(int i=-100;i<105;i++){
if(i>=0 && p[i]==0){
abs = Math.abs(i-x);
if(abs<ans){
ans = abs;
anss = i;
}
}
if(i<0){
abs = Math.abs(i-x);
if(abs<ans){
ans = abs;
anss = i;
}
}
}
System.out.println(anss);
}
//System.out.println();
}
static int lcm(int a,int b){
return a*b*gcd(a,b);
}
static int gcd(int a,int b){
if(a%b!=0){
return gcd(b,a%b);
}
else{
return b;
}
}
/*
static String toSmall(String s){
char c = s.charAt(0);
//if(Character.isUpperCase(c)){
if(c<=90){
c += 32;
}
return String.valueOf(c);
}
static String toBig(String s){
char c = s.charAt(0);
//if(Character.isLowerCase(c)){
if(c>=97){
c -= 32;
}
return String.valueOf(c);
}
*/
static String toSmall(String s){
return s.toLowerCase();
}
static String toBig(String s){
return s.toUpperCase();
}
static String next(){
return sc.next();
}
static int nextInt(){
return Integer.parseInt(sc.next());
}
static long nextLong(){
return Long.parseLong(sc.next());
}
static double nextDouble(){
return Double.parseDouble(sc.next());
}
static String[] splitString(String s){
return s.split("");
}
static char[] splitChar(String s){
return s.toCharArray();
}
static int charToInt(char a){
return a - 48;
}
////////////////////////////////////////////
public static int max(int[] a){
int lng = a.length;
int max = a[0];
for(int i=1;i<lng;i++){
max = Math.max(max,a[i]);
}
return max;
}
public static long max(long[] a){
int lng = a.length;
long max = a[0];
for(int i=1;i<lng;i++){
max = Math.max(max,a[i]);
}
return max;
}
////////////////////////////////////////////
////////////////////////////////////////////
public static int min(int[] a){
int lng = a.length;
int min = a[0];
for(int i=1;i<lng;i++){
min = Math.min(min,a[i]);
}
return min;
}
public static long min(long[] a){
int lng = a.length;
long min = a[0];
for(int i=1;i<lng;i++){
min = Math.min(min,a[i]);
}
return min;
}
////////////////////////////////////////////
}
|
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
40,
17,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
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,
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
],
[
131,
11
],
[
131,
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
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
14,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
14,
56
],
[
56,
57
],
[
56,
58
],
[
14,
59
],
[
59,
60
],
[
59,
61
],
[
14,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
62,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
78,
80
],
[
14,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
81,
87
],
[
87,
88
],
[
87,
89
],
[
81,
90
],
[
90,
91
],
[
91,
92
],
[
81,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
102,
109
],
[
95,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
116,
117
],
[
116,
118
],
[
110,
119
],
[
119,
120
],
[
119,
121
],
[
14,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
12,
128
],
[
128,
129
],
[
0,
130
],
[
130,
131
],
[
130,
132
]
]
| [
"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\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint p[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tint idx =-1;\n\t\tint min = 1000;\n\t\tSet<Integer> s= new HashSet<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ts.add(p[i]);\n\t\t}\n\t\tfor(int i=-100;i<=200;i++) {\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(idx);\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\t\tint x = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint p[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tint idx =-1;\n\t\tint min = 1000;\n\t\tSet<Integer> s= new HashSet<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ts.add(p[i]);\n\t\t}\n\t\tfor(int i=-100;i<=200;i++) {\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(idx);\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 p[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tint idx =-1;\n\t\tint min = 1000;\n\t\tSet<Integer> s= new HashSet<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ts.add(p[i]);\n\t\t}\n\t\tfor(int i=-100;i<=200;i++) {\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(idx);\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 p[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tint idx =-1;\n\t\tint min = 1000;\n\t\tSet<Integer> s= new HashSet<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ts.add(p[i]);\n\t\t}\n\t\tfor(int i=-100;i<=200;i++) {\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(idx);\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 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 idx =-1;",
"idx",
"-1",
"1",
"int min = 1000;",
"min",
"1000",
"Set<Integer> s= new HashSet<Integer>();",
"s",
"new HashSet<Integer>()",
"for(int i=0;i<n;i++) {\n\t\t\ts.add(p[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts.add(p[i]);\n\t\t}",
"{\n\t\t\ts.add(p[i]);\n\t\t}",
"s.add(p[i])",
"s.add",
"s",
"p[i]",
"p",
"i",
"for(int i=-100;i<=200;i++) {\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}",
"int i=-100;",
"int i=-100;",
"i",
"-100",
"100",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}",
"if(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}",
"!s.contains(i) && Math.abs(i-x)<min",
"!s.contains(i)",
"s.contains(i)",
"s.contains",
"s",
"i",
"Math.abs(i-x)<min",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"min",
"{\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}",
"min = Math.abs(i-x)",
"min",
"Math.abs(i-x)",
"Math.abs",
"Math",
"i-x",
"i",
"x",
"idx = i",
"idx",
"i",
"System.out.println(idx)",
"System.out.println",
"System.out",
"System",
"System.out",
"idx",
"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 p[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tint idx =-1;\n\t\tint min = 1000;\n\t\tSet<Integer> s= new HashSet<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ts.add(p[i]);\n\t\t}\n\t\tfor(int i=-100;i<=200;i++) {\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(idx);\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 p[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n\t\tint idx =-1;\n\t\tint min = 1000;\n\t\tSet<Integer> s= new HashSet<Integer>();\n\t\tfor(int i=0;i<n;i++) {\n\t\t\ts.add(p[i]);\n\t\t}\n\t\tfor(int i=-100;i<=200;i++) {\n\t\t\tif(!s.contains(i) && Math.abs(i-x)<min) {\n\t\t\t\tmin = Math.abs(i-x);\n\t\t\t\tidx = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(idx);\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();
int p[] = new int[n];
for(int i=0;i<n;i++) {
p[i] = sc.nextInt();
}
int idx =-1;
int min = 1000;
Set<Integer> s= new HashSet<Integer>();
for(int i=0;i<n;i++) {
s.add(p[i]);
}
for(int i=-100;i<=200;i++) {
if(!s.contains(i) && Math.abs(i-x)<min) {
min = Math.abs(i-x);
idx = i;
}
}
System.out.println(idx);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
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,
18,
13,
13,
41,
13,
40,
17,
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,
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
],
[
122,
17
],
[
122,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
18,
27
],
[
27,
28
],
[
122,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
31,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
31,
45
],
[
45,
46
],
[
45,
47
],
[
31,
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
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
31,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
31,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
31,
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
],
[
90,
93
],
[
89,
94
],
[
94,
95
],
[
88,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
88,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
31,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
0,
121
],
[
121,
122
],
[
121,
123
]
]
| [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n public static void main(String[] args) {\n Main main = new Main();\n main.solve();\n }\n\n public void solve() {\n Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int X = scan.nextInt();\n int N = scan.nextInt();\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < N; i++) {\n set.add(scan.nextInt());\n }\n int diff = Integer.MAX_VALUE;\n int ans = -1;\n for (int i = 0; i <= 101; i++) {\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }\n System.out.println(ans);\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Main main = new Main();\n main.solve();\n }\n\n public void solve() {\n Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int X = scan.nextInt();\n int N = scan.nextInt();\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < N; i++) {\n set.add(scan.nextInt());\n }\n int diff = Integer.MAX_VALUE;\n int ans = -1;\n for (int i = 0; i <= 101; i++) {\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Main main = new Main();\n main.solve();\n }",
"main",
"{\n Main main = new Main();\n main.solve();\n }",
"Main main = new Main();",
"main",
"new Main()",
"main.solve()",
"main.solve",
"main",
"String[] args",
"args",
"public void solve() {\n Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int X = scan.nextInt();\n int N = scan.nextInt();\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < N; i++) {\n set.add(scan.nextInt());\n }\n int diff = Integer.MAX_VALUE;\n int ans = -1;\n for (int i = 0; i <= 101; i++) {\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }\n System.out.println(ans);\n }",
"solve",
"{\n Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int X = scan.nextInt();\n int N = scan.nextInt();\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < N; i++) {\n set.add(scan.nextInt());\n }\n int diff = Integer.MAX_VALUE;\n int ans = -1;\n for (int i = 0; i <= 101; i++) {\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }\n System.out.println(ans);\n }",
"Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));",
"scan",
"new Scanner(new BufferedReader(new InputStreamReader(System.in)))",
"int X = scan.nextInt();",
"X",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int i = 0; i < N; i++) {\n set.add(scan.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n set.add(scan.nextInt());\n }",
"{\n set.add(scan.nextInt());\n }",
"set.add(scan.nextInt())",
"set.add",
"set",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int diff = Integer.MAX_VALUE;",
"diff",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int ans = -1;",
"ans",
"-1",
"1",
"for (int i = 0; i <= 101; i++) {\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 101",
"i",
"101",
"i++",
"i++",
"i",
"{\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }",
"{\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }",
"if (set.contains(i)) {\n continue;\n }",
"set.contains(i)",
"set.contains",
"set",
"i",
"{\n continue;\n }",
"continue;",
"int t = Math.abs(i - X);",
"t",
"Math.abs(i - X)",
"Math.abs",
"Math",
"i - X",
"i",
"X",
"if (t < diff) {\n ans = i;\n diff = t;\n }",
"t < diff",
"t",
"diff",
"{\n ans = i;\n diff = t;\n }",
"ans = i",
"ans",
"i",
"diff = t",
"diff",
"t",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"public class Main {\n public static void main(String[] args) {\n Main main = new Main();\n main.solve();\n }\n\n public void solve() {\n Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int X = scan.nextInt();\n int N = scan.nextInt();\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < N; i++) {\n set.add(scan.nextInt());\n }\n int diff = Integer.MAX_VALUE;\n int ans = -1;\n for (int i = 0; i <= 101; i++) {\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Main main = new Main();\n main.solve();\n }\n\n public void solve() {\n Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int X = scan.nextInt();\n int N = scan.nextInt();\n Set<Integer> set = new HashSet<>();\n for (int i = 0; i < N; i++) {\n set.add(scan.nextInt());\n }\n int diff = Integer.MAX_VALUE;\n int ans = -1;\n for (int i = 0; i <= 101; i++) {\n if (set.contains(i)) {\n continue;\n }\n int t = Math.abs(i - X);\n if (t < diff) {\n ans = i;\n diff = t;\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.solve();
}
public void solve() {
Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int X = scan.nextInt();
int N = scan.nextInt();
Set<Integer> set = new HashSet<>();
for (int i = 0; i < N; i++) {
set.add(scan.nextInt());
}
int diff = Integer.MAX_VALUE;
int ans = -1;
for (int i = 0; i <= 101; i++) {
if (set.contains(i)) {
continue;
}
int t = Math.abs(i - X);
if (t < diff) {
ans = i;
diff = t;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
107,
14
],
[
107,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
17,
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
],
[
17,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
17,
57
],
[
57,
58
],
[
57,
59
],
[
17,
60
],
[
60,
61
],
[
60,
62
],
[
17,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
74,
80
],
[
65,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
65,
96
],
[
96,
97
],
[
17,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
15,
104
],
[
104,
105
],
[
0,
106
],
[
106,
107
],
[
106,
108
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n ArrayList<Integer> list = new ArrayList<>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0; i<n; i++){\n list.add(sc.nextInt());\n }\n\n Collections.sort(list);\n\n\n int i = 0;\n int ans = 0;\n while(true){\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }\n System.out.println(ans);\n\n //for(int i=0; i<list.size(); i++){\n //System.out.println(list.get(i));\n //}\n\n }\n\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"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 sc = new Scanner(System.in);\n ArrayList<Integer> list = new ArrayList<>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0; i<n; i++){\n list.add(sc.nextInt());\n }\n\n Collections.sort(list);\n\n\n int i = 0;\n int ans = 0;\n while(true){\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }\n System.out.println(ans);\n\n //for(int i=0; i<list.size(); i++){\n //System.out.println(list.get(i));\n //}\n\n }\n\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n ArrayList<Integer> list = new ArrayList<>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0; i<n; i++){\n list.add(sc.nextInt());\n }\n\n Collections.sort(list);\n\n\n int i = 0;\n int ans = 0;\n while(true){\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }\n System.out.println(ans);\n\n //for(int i=0; i<list.size(); i++){\n //System.out.println(list.get(i));\n //}\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n ArrayList<Integer> list = new ArrayList<>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0; i<n; i++){\n list.add(sc.nextInt());\n }\n\n Collections.sort(list);\n\n\n int i = 0;\n int ans = 0;\n while(true){\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }\n System.out.println(ans);\n\n //for(int i=0; i<list.size(); i++){\n //System.out.println(list.get(i));\n //}\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"ArrayList<Integer> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"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",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"int i = 0;",
"i",
"0",
"int ans = 0;",
"ans",
"0",
"while(true){\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }",
"true",
"{\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }",
"if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }",
"!(list.contains(x-i))",
"(list.contains(x-i))",
"list.contains",
"list",
"x-i",
"x",
"i",
"{\n ans = x-i;\n break;\n }",
"ans = x-i",
"ans",
"x-i",
"x",
"i",
"break;",
"if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }",
"!(list.contains(x+i))",
"(list.contains(x+i))",
"list.contains",
"list",
"x+i",
"x",
"i",
"{\n ans = x+i;\n break;\n }",
"ans = x+i",
"ans",
"x+i",
"x",
"i",
"break;",
"i++",
"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 ArrayList<Integer> list = new ArrayList<>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0; i<n; i++){\n list.add(sc.nextInt());\n }\n\n Collections.sort(list);\n\n\n int i = 0;\n int ans = 0;\n while(true){\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }\n System.out.println(ans);\n\n //for(int i=0; i<list.size(); i++){\n //System.out.println(list.get(i));\n //}\n\n }\n\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n ArrayList<Integer> list = new ArrayList<>();\n int x = sc.nextInt();\n int n = sc.nextInt();\n for(int i=0; i<n; i++){\n list.add(sc.nextInt());\n }\n\n Collections.sort(list);\n\n\n int i = 0;\n int ans = 0;\n while(true){\n if(!(list.contains(x-i))){\n ans = x-i;\n break;\n }\n\n // for(int j=0; j<list.size(); j++){\n // System.out.println(\"*\"+list.get(j));\n // }\n if(!(list.contains(x+i))){\n ans = x+i;\n break;\n }\n i++;\n }\n System.out.println(ans);\n\n //for(int i=0; i<list.size(); i++){\n //System.out.println(list.get(i));\n //}\n\n }\n\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
ArrayList<Integer> list = new ArrayList<>();
int x = sc.nextInt();
int n = sc.nextInt();
for(int i=0; i<n; i++){
list.add(sc.nextInt());
}
Collections.sort(list);
int i = 0;
int ans = 0;
while(true){
if(!(list.contains(x-i))){
ans = x-i;
break;
}
// for(int j=0; j<list.size(); j++){
// System.out.println("*"+list.get(j));
// }
if(!(list.contains(x+i))){
ans = x+i;
break;
}
i++;
}
System.out.println(ans);
//for(int i=0; i<list.size(); i++){
//System.out.println(list.get(i));
//}
}
} |
[
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,
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,
29,
14,
2,
4,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
101,
8
],
[
101,
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
],
[
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
],
[
61,
68
],
[
60,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
69,
78
],
[
60,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
80,
87
],
[
79,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
88,
97
],
[
9,
98
],
[
98,
99
],
[
0,
100
],
[
100,
101
],
[
100,
102
]
]
| [
"import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < 102; i++) {\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t}\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\t\t// TODO 自動生成されたメソッド・スタブ\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\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < 102; i++) {\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\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\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < 102; i++) {\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\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\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < 102; i++) {\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\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",
"ArrayList<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"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 < 102; i++) {\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\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(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"if(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}",
"list.contains(x-i) != true",
"list.contains(x-i)",
"list.contains",
"list",
"x-i",
"x",
"i",
"true",
"{\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.print(x-i)",
"System.out.print",
"System.out",
"System",
"System.out",
"x-i",
"x",
"i",
"return;",
"if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}",
"list.contains(x+i) != true",
"list.contains(x+i)",
"list.contains",
"list",
"x+i",
"x",
"i",
"true",
"{\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.print(x+i)",
"System.out.print",
"System.out",
"System",
"System.out",
"x+i",
"x",
"i",
"return;",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < 102; i++) {\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint x = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\t\n\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < 102; i++) {\n\t\t\tif(list.contains(x-i) != true) {\n\t\t\t\tSystem.out.print(x-i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if(list.contains(x+i) != true) {\n\t\t\t\tSystem.out.print(x+i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int n = scan.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i = 0; i < n; i++) {
list.add(scan.nextInt());
}
for(int i = 0; i < 102; i++) {
if(list.contains(x-i) != true) {
System.out.print(x-i);
return;
}
else if(list.contains(x+i) != true) {
System.out.print(x+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,
41,
13,
18,
13,
13,
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,
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,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
111,
11
],
[
111,
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
],
[
14,
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
],
[
52,
55
],
[
55,
56
],
[
56,
57
],
[
14,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
78,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
87,
96
],
[
96,
97
],
[
96,
98
],
[
14,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
14,
105
],
[
105,
106
],
[
106,
107
],
[
12,
108
],
[
108,
109
],
[
0,
110
],
[
110,
111
],
[
110,
112
]
]
| [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint seisu = scan.nextInt();\n\t\tint len = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tint min = Integer.MAX_VALUE;\n\t\tint ans = 0;\n\n\t\tfor(int i=0;i<len;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i=0;i<=110;i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tscan.close();\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\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint seisu = scan.nextInt();\n\t\tint len = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tint min = Integer.MAX_VALUE;\n\t\tint ans = 0;\n\n\t\tfor(int i=0;i<len;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i=0;i<=110;i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tscan.close();\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 seisu = scan.nextInt();\n\t\tint len = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tint min = Integer.MAX_VALUE;\n\t\tint ans = 0;\n\n\t\tfor(int i=0;i<len;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i=0;i<=110;i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tscan.close();\n\n\t}",
"main",
"{\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint seisu = scan.nextInt();\n\t\tint len = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tint min = Integer.MAX_VALUE;\n\t\tint ans = 0;\n\n\t\tfor(int i=0;i<len;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i=0;i<=110;i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tscan.close();\n\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int seisu = scan.nextInt();",
"seisu",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int len = scan.nextInt();",
"len",
"scan.nextInt()",
"scan.nextInt",
"scan",
"List<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"int min = Integer.MAX_VALUE;",
"min",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"int ans = 0;",
"ans",
"0",
"for(int i=0;i<len;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<len",
"i",
"len",
"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<=110;i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<=110",
"i",
"110",
"i++",
"i++",
"i",
"{\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"{\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"if(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\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(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}",
"if(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}",
"min > Math.abs(i-seisu)",
"min",
"Math.abs(i-seisu)",
"Math.abs",
"Math",
"i-seisu",
"i",
"seisu",
"{\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}",
"min = Math.abs(i-seisu)",
"min",
"Math.abs(i-seisu)",
"Math.abs",
"Math",
"i-seisu",
"i",
"seisu",
"ans = i",
"ans",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main{\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint seisu = scan.nextInt();\n\t\tint len = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tint min = Integer.MAX_VALUE;\n\t\tint ans = 0;\n\n\t\tfor(int i=0;i<len;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i=0;i<=110;i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tscan.close();\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 seisu = scan.nextInt();\n\t\tint len = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tint min = Integer.MAX_VALUE;\n\t\tint ans = 0;\n\n\t\tfor(int i=0;i<len;i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\n\t\tfor(int i=0;i<=110;i++) {\n\t\t\tif(!list.contains(i)) {\n\t\t\t\tif(min > Math.abs(i-seisu)) {\n\t\t\t\tmin = Math.abs(i-seisu);\n\t\t\t\tans = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tscan.close();\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) {
Scanner scan = new Scanner(System.in);
int seisu = scan.nextInt();
int len = scan.nextInt();
List<Integer> list = new ArrayList<Integer>();
int min = Integer.MAX_VALUE;
int ans = 0;
for(int i=0;i<len;i++) {
list.add(scan.nextInt());
}
for(int i=0;i<=110;i++) {
if(!list.contains(i)) {
if(min > Math.abs(i-seisu)) {
min = Math.abs(i-seisu);
ans = i;
}
}
}
System.out.println(ans);
scan.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
40,
17,
41,
13,
41,
13,
41,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
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,
13,
0,
13,
4,
13,
13,
13,
14,
2,
13,
40,
17,
30,
0,
13,
17,
42,
17,
30,
40,
13,
0,
13,
17,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
2,
13,
13,
17,
30,
0,
13,
2,
13,
13,
0,
13,
17,
30,
14,
2,
18,
13,
2,
13,
13,
2,
13,
13,
30,
30,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
30,
0,
13,
2,
13,
13,
0,
13,
17,
30,
14,
2,
18,
13,
2,
13,
13,
2,
13,
13,
30,
30,
0,
13,
2,
13,
13,
0,
13,
17,
14,
13,
30,
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,
3,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
302,
8
],
[
302,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
11,
16
],
[
16,
17
],
[
11,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
11,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
32,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
44,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
44,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
55,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
55,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
11,
73
],
[
73,
74
],
[
9,
75
],
[
75,
76
],
[
9,
77
],
[
77,
78
],
[
302,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
81,
87
],
[
87,
88
],
[
81,
89
],
[
89,
90
],
[
81,
91
],
[
91,
92
],
[
81,
93
],
[
93,
94
],
[
81,
95
],
[
95,
96
],
[
81,
97
],
[
97,
98
],
[
81,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
81,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
81,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
113,
120
],
[
120,
121
],
[
121,
122
],
[
113,
123
],
[
81,
124
],
[
124,
125
],
[
124,
126
],
[
81,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
128,
139
],
[
140,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
81,
148
],
[
148,
149
],
[
149,
150
],
[
148,
151
],
[
81,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
154,
157
],
[
81,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
158,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
172,
173
],
[
172,
174
],
[
169,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
169,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
182,
184
],
[
169,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
185,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
194,
196
],
[
191,
197
],
[
197,
198
],
[
197,
199
],
[
185,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
205,
207
],
[
202,
208
],
[
208,
209
],
[
208,
210
],
[
201,
211
],
[
201,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
215,
217
],
[
212,
218
],
[
218,
219
],
[
218,
220
],
[
169,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
221,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
230,
232
],
[
227,
233
],
[
233,
234
],
[
233,
235
],
[
221,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
241,
243
],
[
238,
244
],
[
244,
245
],
[
244,
246
],
[
237,
247
],
[
237,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
251,
253
],
[
248,
254
],
[
254,
255
],
[
254,
256
],
[
169,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
262,
265
],
[
265,
266
],
[
265,
267
],
[
261,
268
],
[
268,
269
],
[
269,
270
],
[
268,
271
],
[
271,
272
],
[
271,
273
],
[
260,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
275,
280
],
[
260,
281
],
[
281,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
282,
287
],
[
259,
288
],
[
158,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
290,
295
],
[
81,
296
],
[
296,
297
],
[
297,
298
],
[
79,
299
],
[
299,
300
],
[
0,
301
],
[
301,
302
],
[
301,
303
]
]
| [
"import java.util.*;\nimport java.lang.Math;\n\npublic class Main {\n//public static final int MIN_VALUE\n//public static final int MAX_VALUE\n\n/**\n * ソート済みの配列を2分探索し、indexを返す。\n * 見つからない場合は-1を返す\n * @param a\n * @param x\n * @return\n */\npublic static int indexOf(int[] a, int x) {\n int ret = -1;\n\n int l,m,r;\n l = 0;r = a.length - 1; \n\n while(l <= r) {\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }\n\n return ret;\n}\n\npublic static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int x,n;\n int pos,cpos;\n int lcand,rcand;\n boolean found;\n\n x = scan.nextInt();\n n = scan.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n scan.close();\n return;\n }\n\n int[] p = new int[n];\n for(int i=0;i<n;i++) {\n p[i] = scan.nextInt();\n } \n\n Arrays.sort(p);\n\n// System.out.println(x);\n// for(int i=0;i<n;i++) {\n// System.out.println(p[i]);\n// }\n\n cpos = indexOf(p,x);\n if(cpos != -1) {\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n } else {\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }\n\n scan.close();\n\n}\n\n};",
"import java.util.*;",
"util.*",
"java",
"import java.lang.Math;",
"Math",
"java.lang",
"public class Main {\n//public static final int MIN_VALUE\n//public static final int MAX_VALUE\n\n/**\n * ソート済みの配列を2分探索し、indexを返す。\n * 見つからない場合は-1を返す\n * @param a\n * @param x\n * @return\n */\npublic static int indexOf(int[] a, int x) {\n int ret = -1;\n\n int l,m,r;\n l = 0;r = a.length - 1; \n\n while(l <= r) {\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }\n\n return ret;\n}\n\npublic static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int x,n;\n int pos,cpos;\n int lcand,rcand;\n boolean found;\n\n x = scan.nextInt();\n n = scan.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n scan.close();\n return;\n }\n\n int[] p = new int[n];\n for(int i=0;i<n;i++) {\n p[i] = scan.nextInt();\n } \n\n Arrays.sort(p);\n\n// System.out.println(x);\n// for(int i=0;i<n;i++) {\n// System.out.println(p[i]);\n// }\n\n cpos = indexOf(p,x);\n if(cpos != -1) {\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n } else {\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }\n\n scan.close();\n\n}\n\n}",
"Main",
"/**\n * ソート済みの配列を2分探索し、indexを返す。\n * 見つからない場合は-1を返す\n * @param a\n * @param x\n * @return\n */\npublic static int indexOf(int[] a, int x) {\n int ret = -1;\n\n int l,m,r;\n l = 0;r = a.length - 1; \n\n while(l <= r) {\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }\n\n return ret;\n}",
"indexOf",
"{\n int ret = -1;\n\n int l,m,r;\n l = 0;r = a.length - 1; \n\n while(l <= r) {\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }\n\n return ret;\n}",
"int ret = -1;",
"ret",
"-1",
"1",
"int l",
"l",
"m",
"m",
"r;",
"r",
"l = 0",
"l",
"0",
"r = a.length - 1",
"r",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"while(l <= r) {\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }",
"l <= r",
"l",
"r",
"{\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }",
"m = (l+r) / 2",
"m",
"(l+r) / 2",
"(l+r)",
"l",
"r",
"2",
"if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }",
"a[m] == x",
"a[m]",
"a",
"m",
"x",
"{\n ret = m;\n break;\n }",
"ret = m",
"ret",
"m",
"break;",
"if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }",
"a[m] < x",
"a[m]",
"a",
"m",
"x",
"{\n l = m + 1;\n }",
"l = m + 1",
"l",
"m + 1",
"m",
"1",
"{\n r = m - 1;\n }",
"r = m - 1",
"r",
"m - 1",
"m",
"1",
"return ret;",
"ret",
"int[] a",
"a",
"int x",
"x",
"public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int x,n;\n int pos,cpos;\n int lcand,rcand;\n boolean found;\n\n x = scan.nextInt();\n n = scan.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n scan.close();\n return;\n }\n\n int[] p = new int[n];\n for(int i=0;i<n;i++) {\n p[i] = scan.nextInt();\n } \n\n Arrays.sort(p);\n\n// System.out.println(x);\n// for(int i=0;i<n;i++) {\n// System.out.println(p[i]);\n// }\n\n cpos = indexOf(p,x);\n if(cpos != -1) {\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n } else {\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }\n\n scan.close();\n\n}",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int x,n;\n int pos,cpos;\n int lcand,rcand;\n boolean found;\n\n x = scan.nextInt();\n n = scan.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n scan.close();\n return;\n }\n\n int[] p = new int[n];\n for(int i=0;i<n;i++) {\n p[i] = scan.nextInt();\n } \n\n Arrays.sort(p);\n\n// System.out.println(x);\n// for(int i=0;i<n;i++) {\n// System.out.println(p[i]);\n// }\n\n cpos = indexOf(p,x);\n if(cpos != -1) {\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n } else {\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }\n\n scan.close();\n\n}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int x",
"x",
"n;",
"n",
"int pos",
"pos",
"cpos;",
"cpos",
"int lcand",
"lcand",
"rcand;",
"rcand",
"boolean found;",
"found",
"x = scan.nextInt()",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if(n == 0) {\n System.out.println(x);\n scan.close();\n return;\n }",
"n == 0",
"n",
"0",
"{\n System.out.println(x);\n scan.close();\n return;\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"scan.close()",
"scan.close",
"scan",
"return;",
"int[] p = new int[n];",
"p",
"new int[n]",
"n",
"for(int i=0;i<n;i++) {\n p[i] = scan.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n p[i] = scan.nextInt();\n }",
"{\n p[i] = scan.nextInt();\n }",
"p[i] = scan.nextInt()",
"p[i]",
"p",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"Arrays.sort(p)",
"Arrays.sort",
"Arrays",
"p",
"cpos = indexOf(p,x)",
"cpos",
"indexOf(p,x)",
"indexOf",
"p",
"x",
"if(cpos != -1) {\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n } else {\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }",
"cpos != -1",
"cpos",
"-1",
"1",
"{\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n }",
"pos = 0",
"pos",
"0",
"while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }",
"true",
"{\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }",
"pos++",
"pos",
"found = false",
"found",
"false",
"lcand = Integer.MIN_VALUE",
"lcand",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"rcand = Integer.MAX_VALUE",
"rcand",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }",
"(cpos - pos) < 0",
"(cpos - pos)",
"cpos",
"pos",
"0",
"{\n //範囲外\n lcand = x - pos;\n found = true;\n }",
"lcand = x - pos",
"lcand",
"x - pos",
"x",
"pos",
"found = true",
"found",
"true",
"{\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }",
"if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }",
"p[cpos-pos] == (x - pos)",
"p[cpos-pos]",
"p",
"cpos-pos",
"cpos",
"pos",
"(x - pos)",
"x",
"pos",
"{\n }",
"{\n lcand = x-pos;\n found = true;\n }",
"lcand = x-pos",
"lcand",
"x-pos",
"x",
"pos",
"found = true",
"found",
"true",
"if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n }",
"(cpos + pos) >= n",
"(cpos + pos)",
"cpos",
"pos",
"n",
"{\n // 範囲外\n rcand = x + pos;\n found = true;\n }",
"rcand = x + pos",
"rcand",
"x + pos",
"x",
"pos",
"found = true",
"found",
"true",
"{\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n }",
"if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }",
"p[cpos+pos] == (x + pos)",
"p[cpos+pos]",
"p",
"cpos+pos",
"cpos",
"pos",
"(x + pos)",
"x",
"pos",
"{\n }",
"{\n rcand = x+pos;\n found = true;\n }",
"rcand = x+pos",
"rcand",
"x+pos",
"x",
"pos",
"found = true",
"found",
"true",
"if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }",
"found",
"{\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }",
"if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }",
"Math.abs(x-rcand) < Math.abs(x-lcand)",
"Math.abs(x-rcand)",
"Math.abs",
"Math",
"x-rcand",
"x",
"rcand",
"Math.abs(x-lcand)",
"Math.abs",
"Math",
"x-lcand",
"x",
"lcand",
"{\n System.out.println(rcand);\n }",
"System.out.println(rcand)",
"System.out.println",
"System.out",
"System",
"System.out",
"rcand",
"{\n System.out.println(lcand);\n }",
"System.out.println(lcand)",
"System.out.println",
"System.out",
"System",
"System.out",
"lcand",
"break;",
"{\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }",
"System.out.println(x)",
"System.out.println",
"System.out",
"System",
"System.out",
"x",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n//public static final int MIN_VALUE\n//public static final int MAX_VALUE\n\n/**\n * ソート済みの配列を2分探索し、indexを返す。\n * 見つからない場合は-1を返す\n * @param a\n * @param x\n * @return\n */\npublic static int indexOf(int[] a, int x) {\n int ret = -1;\n\n int l,m,r;\n l = 0;r = a.length - 1; \n\n while(l <= r) {\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }\n\n return ret;\n}\n\npublic static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int x,n;\n int pos,cpos;\n int lcand,rcand;\n boolean found;\n\n x = scan.nextInt();\n n = scan.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n scan.close();\n return;\n }\n\n int[] p = new int[n];\n for(int i=0;i<n;i++) {\n p[i] = scan.nextInt();\n } \n\n Arrays.sort(p);\n\n// System.out.println(x);\n// for(int i=0;i<n;i++) {\n// System.out.println(p[i]);\n// }\n\n cpos = indexOf(p,x);\n if(cpos != -1) {\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n } else {\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }\n\n scan.close();\n\n}\n\n}",
"public class Main {\n//public static final int MIN_VALUE\n//public static final int MAX_VALUE\n\n/**\n * ソート済みの配列を2分探索し、indexを返す。\n * 見つからない場合は-1を返す\n * @param a\n * @param x\n * @return\n */\npublic static int indexOf(int[] a, int x) {\n int ret = -1;\n\n int l,m,r;\n l = 0;r = a.length - 1; \n\n while(l <= r) {\n m = (l+r) / 2;\n if(a[m] == x) {\n ret = m;\n break;\n } else if(a[m] < x) {\n l = m + 1;\n } else {\n r = m - 1;\n }\n }\n\n return ret;\n}\n\npublic static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int x,n;\n int pos,cpos;\n int lcand,rcand;\n boolean found;\n\n x = scan.nextInt();\n n = scan.nextInt();\n\n if(n == 0) {\n System.out.println(x);\n scan.close();\n return;\n }\n\n int[] p = new int[n];\n for(int i=0;i<n;i++) {\n p[i] = scan.nextInt();\n } \n\n Arrays.sort(p);\n\n// System.out.println(x);\n// for(int i=0;i<n;i++) {\n// System.out.println(p[i]);\n// }\n\n cpos = indexOf(p,x);\n if(cpos != -1) {\n // 見つかった場合、そこから左右に伸びていく\n pos = 0;\n \n while(true) {\n pos++;\n found = false;\n lcand = Integer.MIN_VALUE;\n rcand = Integer.MAX_VALUE;\n //左\n if((cpos - pos) < 0) {\n //範囲外\n lcand = x - pos;\n found = true;\n } else {\n if(p[cpos-pos] == (x - pos)) {\n } else {\n lcand = x-pos;\n found = true;\n }\n }\n\n //右\n if((cpos + pos) >= n) {\n // 範囲外\n rcand = x + pos;\n found = true;\n } else {\n if(p[cpos+pos] == (x + pos)) {\n } else {\n rcand = x+pos;\n found = true;\n }\n } \n if(found) {\n if(Math.abs(x-rcand) < Math.abs(x-lcand)) {\n System.out.println(rcand);\n } else {\n System.out.println(lcand);\n }\n break;\n }\n }\n\n } else {\n \n// System.out.println(\"not found\");\n System.out.println(x);\n }\n\n scan.close();\n\n}\n\n}",
"Main"
]
| import java.util.*;
import java.lang.Math;
public class Main {
//public static final int MIN_VALUE
//public static final int MAX_VALUE
/**
* ソート済みの配列を2分探索し、indexを返す。
* 見つからない場合は-1を返す
* @param a
* @param x
* @return
*/
public static int indexOf(int[] a, int x) {
int ret = -1;
int l,m,r;
l = 0;r = a.length - 1;
while(l <= r) {
m = (l+r) / 2;
if(a[m] == x) {
ret = m;
break;
} else if(a[m] < x) {
l = m + 1;
} else {
r = m - 1;
}
}
return ret;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x,n;
int pos,cpos;
int lcand,rcand;
boolean found;
x = scan.nextInt();
n = scan.nextInt();
if(n == 0) {
System.out.println(x);
scan.close();
return;
}
int[] p = new int[n];
for(int i=0;i<n;i++) {
p[i] = scan.nextInt();
}
Arrays.sort(p);
// System.out.println(x);
// for(int i=0;i<n;i++) {
// System.out.println(p[i]);
// }
cpos = indexOf(p,x);
if(cpos != -1) {
// 見つかった場合、そこから左右に伸びていく
pos = 0;
while(true) {
pos++;
found = false;
lcand = Integer.MIN_VALUE;
rcand = Integer.MAX_VALUE;
//左
if((cpos - pos) < 0) {
//範囲外
lcand = x - pos;
found = true;
} else {
if(p[cpos-pos] == (x - pos)) {
} else {
lcand = x-pos;
found = true;
}
}
//右
if((cpos + pos) >= n) {
// 範囲外
rcand = x + pos;
found = true;
} else {
if(p[cpos+pos] == (x + pos)) {
} else {
rcand = x+pos;
found = true;
}
}
if(found) {
if(Math.abs(x-rcand) < Math.abs(x-lcand)) {
System.out.println(rcand);
} else {
System.out.println(lcand);
}
break;
}
}
} else {
// System.out.println("not found");
System.out.println(x);
}
scan.close();
}
};
|
[
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,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
41,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
2,
13,
2,
13,
13,
14,
2,
4,
18,
13,
13,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
157,
14
],
[
157,
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
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
35,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
17,
46
],
[
46,
47
],
[
17,
48
],
[
48,
49
],
[
48,
50
],
[
17,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
17,
72
],
[
72,
73
],
[
72,
74
],
[
17,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
75,
85
],
[
85,
86
],
[
86,
87
],
[
75,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
17,
96
],
[
96,
97
],
[
96,
98
],
[
17,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
99,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
114,
120
],
[
120,
121
],
[
120,
122
],
[
114,
123
],
[
123,
124
],
[
124,
125
],
[
114,
126
],
[
127,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
137,
141
],
[
136,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
143,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
15,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
]
| [
"import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\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 if (N == 0) {\n System.out.println(X);\n System.exit(0);\n }\n\n int[] p;\n p = new int [N];\n\n for (int i = 0; i < N; i++) {\n p[i] = scanner.nextInt();\n }\n\n List<Integer> list = new ArrayList<>(p.length);\n for (int i = 0; i < p.length; i++) {\n list.add(p[i]);\n }\n\n int ans = 0;\n\n for (int i = 1; i < X+1; i++) {\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }\n }\n }\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"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 scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n if (N == 0) {\n System.out.println(X);\n System.exit(0);\n }\n\n int[] p;\n p = new int [N];\n\n for (int i = 0; i < N; i++) {\n p[i] = scanner.nextInt();\n }\n\n List<Integer> list = new ArrayList<>(p.length);\n for (int i = 0; i < p.length; i++) {\n list.add(p[i]);\n }\n\n int ans = 0;\n\n for (int i = 1; i < X+1; i++) {\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\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 if (N == 0) {\n System.out.println(X);\n System.exit(0);\n }\n\n int[] p;\n p = new int [N];\n\n for (int i = 0; i < N; i++) {\n p[i] = scanner.nextInt();\n }\n\n List<Integer> list = new ArrayList<>(p.length);\n for (int i = 0; i < p.length; i++) {\n list.add(p[i]);\n }\n\n int ans = 0;\n\n for (int i = 1; i < X+1; i++) {\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }\n }\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int X = scanner.nextInt();\n int N = scanner.nextInt();\n\n if (N == 0) {\n System.out.println(X);\n System.exit(0);\n }\n\n int[] p;\n p = new int [N];\n\n for (int i = 0; i < N; i++) {\n p[i] = scanner.nextInt();\n }\n\n List<Integer> list = new ArrayList<>(p.length);\n for (int i = 0; i < p.length; i++) {\n list.add(p[i]);\n }\n\n int ans = 0;\n\n for (int i = 1; i < X+1; i++) {\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\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",
"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;",
"p",
"p = new int [N]",
"p",
"new int [N]",
"N",
"for (int i = 0; i < N; i++) {\n p[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n p[i] = scanner.nextInt();\n }",
"{\n p[i] = scanner.nextInt();\n }",
"p[i] = scanner.nextInt()",
"p[i]",
"p",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"List<Integer> list = new ArrayList<>(p.length);",
"list",
"new ArrayList<>(p.length)",
"for (int i = 0; i < p.length; i++) {\n list.add(p[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < p.length",
"i",
"p.length",
"p",
"p.length",
"i++",
"i++",
"i",
"{\n list.add(p[i]);\n }",
"{\n list.add(p[i]);\n }",
"list.add(p[i])",
"list.add",
"list",
"p[i]",
"p",
"i",
"int ans = 0;",
"ans",
"0",
"for (int i = 1; i < X+1; i++) {\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < X+1",
"i",
"X+1",
"X",
"1",
"i++",
"i++",
"i",
"{\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }\n }",
"{\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }\n }",
"for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }",
"int j = -1;",
"int j = -1;",
"j",
"-1",
"1",
"j < 2",
"j",
"2",
"j++",
"j++",
"j",
"{\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }",
"{\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }",
"ans = X + j * i",
"ans",
"X + j * i",
"X",
"j * i",
"j",
"i",
"if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }",
"Collections.frequency(list,ans) == 0",
"Collections.frequency(list,ans)",
"Collections.frequency",
"Collections",
"list",
"ans",
"0",
"{\n System.out.println(ans);\n System.exit(0);\n }",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"System.exit(0)",
"System.exit",
"System",
"0",
"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 if (N == 0) {\n System.out.println(X);\n System.exit(0);\n }\n\n int[] p;\n p = new int [N];\n\n for (int i = 0; i < N; i++) {\n p[i] = scanner.nextInt();\n }\n\n List<Integer> list = new ArrayList<>(p.length);\n for (int i = 0; i < p.length; i++) {\n list.add(p[i]);\n }\n\n int ans = 0;\n\n for (int i = 1; i < X+1; i++) {\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\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 if (N == 0) {\n System.out.println(X);\n System.exit(0);\n }\n\n int[] p;\n p = new int [N];\n\n for (int i = 0; i < N; i++) {\n p[i] = scanner.nextInt();\n }\n\n List<Integer> list = new ArrayList<>(p.length);\n for (int i = 0; i < p.length; i++) {\n list.add(p[i]);\n }\n\n int ans = 0;\n\n for (int i = 1; i < X+1; i++) {\n for (int j = -1; j < 2; j++) {\n ans = X + j * i;\n if (Collections.frequency(list,ans) == 0) {\n System.out.println(ans);\n System.exit(0);\n }\n }\n }\n }\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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();
if (N == 0) {
System.out.println(X);
System.exit(0);
}
int[] p;
p = new int [N];
for (int i = 0; i < N; i++) {
p[i] = scanner.nextInt();
}
List<Integer> list = new ArrayList<>(p.length);
for (int i = 0; i < p.length; i++) {
list.add(p[i]);
}
int ans = 0;
for (int i = 1; i < X+1; i++) {
for (int j = -1; j < 2; j++) {
ans = X + j * i;
if (Collections.frequency(list,ans) == 0) {
System.out.println(ans);
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,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
13,
4,
18,
13,
17,
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,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
2,
40,
13,
40,
13,
30,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
17,
0,
13,
2,
13,
13,
14,
40,
4,
18,
13,
2,
13,
13,
30,
0,
13,
17,
0,
13,
2,
13,
13,
40,
13,
14,
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
],
[
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
],
[
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,
40
],
[
40,
41
],
[
40,
42
],
[
8,
43
],
[
43,
44
],
[
43,
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
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
63,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
8,
68
],
[
68,
69
],
[
68,
70
],
[
8,
71
],
[
71,
72
],
[
71,
73
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
74,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
83,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
80,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
103,
104
],
[
103,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
80,
115
],
[
115,
116
],
[
8,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
117,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
6,
133
],
[
133,
134
],
[
0,
135
],
[
135,
136
],
[
135,
137
]
]
| [
"import java.util.*;\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\tint ans1=0;\n\t\tint ans2=0;\n\t\tList<Integer> l = new ArrayList<Integer>();\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tl.add(sc.nextInt());\n\t\t}\n\t\tint count = 0;\n\t\tboolean flg1 = false;\n\t\tboolean flg2 = false;\n\t\twhile(!flg1&&!flg2){\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}\n\t\tif(flg2){\n\t\t\tSystem.out.println(ans2);\n\t\t}else{\n\t\t\tSystem.out.println(ans1);\n\t\t}\t\t\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\tif(n==0){\n\t\t\tSystem.out.println(x);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tint ans1=0;\n\t\tint ans2=0;\n\t\tList<Integer> l = new ArrayList<Integer>();\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tl.add(sc.nextInt());\n\t\t}\n\t\tint count = 0;\n\t\tboolean flg1 = false;\n\t\tboolean flg2 = false;\n\t\twhile(!flg1&&!flg2){\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}\n\t\tif(flg2){\n\t\t\tSystem.out.println(ans2);\n\t\t}else{\n\t\t\tSystem.out.println(ans1);\n\t\t}\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\tint ans1=0;\n\t\tint ans2=0;\n\t\tList<Integer> l = new ArrayList<Integer>();\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tl.add(sc.nextInt());\n\t\t}\n\t\tint count = 0;\n\t\tboolean flg1 = false;\n\t\tboolean flg2 = false;\n\t\twhile(!flg1&&!flg2){\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}\n\t\tif(flg2){\n\t\t\tSystem.out.println(ans2);\n\t\t}else{\n\t\t\tSystem.out.println(ans1);\n\t\t}\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\tint ans1=0;\n\t\tint ans2=0;\n\t\tList<Integer> l = new ArrayList<Integer>();\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tl.add(sc.nextInt());\n\t\t}\n\t\tint count = 0;\n\t\tboolean flg1 = false;\n\t\tboolean flg2 = false;\n\t\twhile(!flg1&&!flg2){\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}\n\t\tif(flg2){\n\t\t\tSystem.out.println(ans2);\n\t\t}else{\n\t\t\tSystem.out.println(ans1);\n\t\t}\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",
"int ans1=0;",
"ans1",
"0",
"int ans2=0;",
"ans2",
"0",
"List<Integer> l = new ArrayList<Integer>();",
"l",
"new ArrayList<Integer>()",
"for(int i = 0;i<n;i++){\n\t\t\tl.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tl.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tl.add(sc.nextInt());\n\t\t}",
"l.add(sc.nextInt())",
"l.add",
"l",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"boolean flg1 = false;",
"flg1",
"false",
"boolean flg2 = false;",
"flg2",
"false",
"while(!flg1&&!flg2){\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}",
"!flg1&&!flg2",
"!flg1",
"flg1",
"!flg2",
"flg2",
"{\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}",
"if(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}",
"!l.contains(x+count)",
"l.contains(x+count)",
"l.contains",
"l",
"x+count",
"x",
"count",
"{\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}",
"flg1 = true",
"flg1",
"true",
"ans1 = x+count",
"ans1",
"x+count",
"x",
"count",
"if(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}",
"!l.contains(x-count)",
"l.contains(x-count)",
"l.contains",
"l",
"x-count",
"x",
"count",
"{\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}",
"flg2 = true",
"flg2",
"true",
"ans2 = x-count",
"ans2",
"x-count",
"x",
"count",
"count++",
"count",
"if(flg2){\n\t\t\tSystem.out.println(ans2);\n\t\t}else{\n\t\t\tSystem.out.println(ans1);\n\t\t}",
"flg2",
"{\n\t\t\tSystem.out.println(ans2);\n\t\t}",
"System.out.println(ans2)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans2",
"{\n\t\t\tSystem.out.println(ans1);\n\t\t}",
"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 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\tint ans1=0;\n\t\tint ans2=0;\n\t\tList<Integer> l = new ArrayList<Integer>();\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tl.add(sc.nextInt());\n\t\t}\n\t\tint count = 0;\n\t\tboolean flg1 = false;\n\t\tboolean flg2 = false;\n\t\twhile(!flg1&&!flg2){\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}\n\t\tif(flg2){\n\t\t\tSystem.out.println(ans2);\n\t\t}else{\n\t\t\tSystem.out.println(ans1);\n\t\t}\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\tint ans1=0;\n\t\tint ans2=0;\n\t\tList<Integer> l = new ArrayList<Integer>();\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tl.add(sc.nextInt());\n\t\t}\n\t\tint count = 0;\n\t\tboolean flg1 = false;\n\t\tboolean flg2 = false;\n\t\twhile(!flg1&&!flg2){\n\n\t\t\tif(!l.contains(x+count)){\n\t\t\t\tflg1 = true;\n\t\t\t\tans1 = x+count;\n\t\t\t}\n\t\t\tif(!l.contains(x-count)){\n\t\t\t\tflg2 = true;\n\t\t\t\tans2 = x-count;\n\t\t\t}\n count++;\n\t\t}\n\t\tif(flg2){\n\t\t\tSystem.out.println(ans2);\n\t\t}else{\n\t\t\tSystem.out.println(ans1);\n\t\t}\t\t\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();
if(n==0){
System.out.println(x);
System.exit(0);
}
int ans1=0;
int ans2=0;
List<Integer> l = new ArrayList<Integer>();
for(int i = 0;i<n;i++){
l.add(sc.nextInt());
}
int count = 0;
boolean flg1 = false;
boolean flg2 = false;
while(!flg1&&!flg2){
if(!l.contains(x+count)){
flg1 = true;
ans1 = x+count;
}
if(!l.contains(x-count)){
flg2 = true;
ans2 = x-count;
}
count++;
}
if(flg2){
System.out.println(ans2);
}else{
System.out.println(ans1);
}
}
}
|
[
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,
40,
17,
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,
40,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
4,
18,
13,
13,
30,
9,
14,
2,
4,
18,
13,
2,
13,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
13,
0,
13,
13,
14,
2,
2,
4,
18,
13,
2,
13,
13,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
125,
8
],
[
125,
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
],
[
30,
31
],
[
11,
32
],
[
32,
33
],
[
32,
34
],
[
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
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
11,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
57,
63
],
[
63,
64
],
[
63,
65
],
[
57,
66
],
[
66,
67
],
[
67,
68
],
[
57,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
71,
76
],
[
76,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
83,
85
],
[
79,
86
],
[
78,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
87,
96
],
[
96,
97
],
[
96,
98
],
[
78,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
105,
106
],
[
105,
107
],
[
101,
108
],
[
100,
109
],
[
109,
110
],
[
109,
111
],
[
99,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
11,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
9,
122
],
[
122,
123
],
[
0,
124
],
[
124,
125
],
[
124,
126
]
]
| [
"import java.util.HashSet;\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 = sc.nextInt();\n int min = 114514893;\n int ans = -1;\n HashSet<Integer> set = new HashSet<Integer>();\n for(int i=0;i<N;i++){\n int temp = sc.nextInt();\n set.add(temp);\n }\n for(int i=-200;i<=200;i++){\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }\n }\n System.out.println(ans);\n\n }\n}",
"import java.util.HashSet;",
"HashSet",
"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 = sc.nextInt();\n int min = 114514893;\n int ans = -1;\n HashSet<Integer> set = new HashSet<Integer>();\n for(int i=0;i<N;i++){\n int temp = sc.nextInt();\n set.add(temp);\n }\n for(int i=-200;i<=200;i++){\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\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 int X = sc.nextInt(),N = sc.nextInt();\n int min = 114514893;\n int ans = -1;\n HashSet<Integer> set = new HashSet<Integer>();\n for(int i=0;i<N;i++){\n int temp = sc.nextInt();\n set.add(temp);\n }\n for(int i=-200;i<=200;i++){\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }\n }\n System.out.println(ans);\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int X = sc.nextInt(),N = sc.nextInt();\n int min = 114514893;\n int ans = -1;\n HashSet<Integer> set = new HashSet<Integer>();\n for(int i=0;i<N;i++){\n int temp = sc.nextInt();\n set.add(temp);\n }\n for(int i=-200;i<=200;i++){\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\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",
"N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int min = 114514893;",
"min",
"114514893",
"int ans = -1;",
"ans",
"-1",
"1",
"HashSet<Integer> set = new HashSet<Integer>();",
"set",
"new HashSet<Integer>()",
"for(int i=0;i<N;i++){\n int temp = sc.nextInt();\n set.add(temp);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int temp = sc.nextInt();\n set.add(temp);\n }",
"{\n int temp = sc.nextInt();\n set.add(temp);\n }",
"int temp = sc.nextInt();",
"temp",
"sc.nextInt()",
"sc.nextInt",
"sc",
"set.add(temp)",
"set.add",
"set",
"temp",
"for(int i=-200;i<=200;i++){\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }\n }",
"int i=-200;",
"int i=-200;",
"i",
"-200",
"200",
"i<=200",
"i",
"200",
"i++",
"i++",
"i",
"{\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }\n }",
"{\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }\n }",
"if(set.contains(i)){\n continue;\n }",
"set.contains(i)",
"set.contains",
"set",
"i",
"{\n continue;\n }",
"continue;",
"if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }",
"Math.abs(i-X)<min",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"min",
"{\n min = Math.abs(i-X);\n ans = i;\n }",
"min = Math.abs(i-X)",
"min",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"ans = i",
"ans",
"i",
"if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }",
"Math.abs(i-X)==min&&i<ans",
"Math.abs(i-X)==min",
"Math.abs(i-X)",
"Math.abs",
"Math",
"i-X",
"i",
"X",
"min",
"i<ans",
"i",
"ans",
"{\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }",
"ans = i",
"ans",
"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 int X = sc.nextInt(),N = sc.nextInt();\n int min = 114514893;\n int ans = -1;\n HashSet<Integer> set = new HashSet<Integer>();\n for(int i=0;i<N;i++){\n int temp = sc.nextInt();\n set.add(temp);\n }\n for(int i=-200;i<=200;i++){\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }\n }\n System.out.println(ans);\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 = sc.nextInt();\n int min = 114514893;\n int ans = -1;\n HashSet<Integer> set = new HashSet<Integer>();\n for(int i=0;i<N;i++){\n int temp = sc.nextInt();\n set.add(temp);\n }\n for(int i=-200;i<=200;i++){\n if(set.contains(i)){\n continue;\n }\n if(Math.abs(i-X)<min){\n min = Math.abs(i-X);\n ans = i;\n }else if(Math.abs(i-X)==min&&i<ans){\n //System.out.println(ans+\"ss\"+i);\n ans = i;\n }\n }\n System.out.println(ans);\n\n }\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 X = sc.nextInt(),N = sc.nextInt();
int min = 114514893;
int ans = -1;
HashSet<Integer> set = new HashSet<Integer>();
for(int i=0;i<N;i++){
int temp = sc.nextInt();
set.add(temp);
}
for(int i=-200;i<=200;i++){
if(set.contains(i)){
continue;
}
if(Math.abs(i-X)<min){
min = Math.abs(i-X);
ans = i;
}else if(Math.abs(i-X)==min&&i<ans){
//System.out.println(ans+"ss"+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,
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,
29,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
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,
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
],
[
367,
11
],
[
367,
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
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
54,
61
],
[
14,
62
],
[
62,
63
],
[
62,
64
],
[
14,
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
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
77,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
14,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
12,
114
],
[
114,
115
],
[
0,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
116,
123
],
[
123,
124
],
[
123,
125
],
[
116,
127
],
[
127,
128
],
[
127,
129
],
[
116,
130
],
[
130,
131
],
[
130,
132
],
[
116,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
141,
142
],
[
136,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
147,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
143,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
166,
167
],
[
135,
168
],
[
168,
169
],
[
116,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
173,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
173,
181
],
[
181,
182
],
[
182,
183
],
[
116,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
188,
192
],
[
192,
193
],
[
192,
194
],
[
184,
195
],
[
195,
196
],
[
116,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
207,
209
],
[
200,
210
],
[
210,
211
],
[
199,
212
],
[
212,
213
],
[
213,
214
],
[
116,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
218,
222
],
[
222,
223
],
[
217,
224
],
[
224,
225
],
[
224,
226
],
[
217,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
217,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
231,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
236,
239
],
[
235,
240
],
[
240,
241
],
[
240,
242
],
[
242,
243
],
[
217,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
116,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
251,
255
],
[
255,
256
],
[
250,
257
],
[
257,
258
],
[
257,
259
],
[
250,
260
],
[
260,
261
],
[
260,
262
],
[
250,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
250,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
267,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
250,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
281,
283
],
[
280,
284
],
[
284,
285
],
[
284,
286
],
[
279,
287
],
[
287,
288
],
[
288,
289
],
[
250,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
293,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
298,
299
],
[
298,
300
],
[
293,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
301,
305
],
[
305,
306
],
[
305,
307
],
[
307,
308
],
[
307,
309
],
[
293,
310
],
[
310,
311
],
[
311,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
311,
316
],
[
316,
317
],
[
317,
318
],
[
317,
319
],
[
310,
320
],
[
320,
321
],
[
321,
322
],
[
322,
323
],
[
322,
324
],
[
324,
325
],
[
322,
326
],
[
310,
327
],
[
327,
328
],
[
328,
329
],
[
292,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
116,
334
],
[
334,
335
],
[
334,
336
],
[
336,
337
],
[
337,
338
],
[
337,
339
],
[
339,
340
],
[
336,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
345,
346
],
[
345,
347
],
[
342,
348
],
[
348,
349
],
[
348,
350
],
[
350,
351
],
[
350,
352
],
[
341,
353
],
[
353,
354
],
[
336,
355
],
[
355,
356
],
[
116,
357
],
[
357,
358
],
[
357,
359
],
[
359,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
361,
364
],
[
364,
365
],
[
0,
366
],
[
366,
367
],
[
366,
368
]
]
| [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n List<Integer> inputList = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n inputList.add(scanner.nextInt());\n }\n // N = 0 の場合\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int min = 999;\n for (int i = 0; i <= 150; i++) {\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }\n System.out.println(min);\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() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n 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())\n 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)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\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 public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n List<Integer> inputList = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n inputList.add(scanner.nextInt());\n }\n // N = 0 の場合\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int min = 999;\n for (int i = 0; i <= 150; i++) {\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }\n System.out.println(min);\n }\n}",
"Main",
"public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n List<Integer> inputList = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n inputList.add(scanner.nextInt());\n }\n // N = 0 の場合\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int min = 999;\n for (int i = 0; i <= 150; i++) {\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }\n System.out.println(min);\n }",
"main",
"{\n FastScanner scanner = new FastScanner();\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n List<Integer> inputList = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n inputList.add(scanner.nextInt());\n }\n // N = 0 の場合\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int min = 999;\n for (int i = 0; i <= 150; i++) {\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }\n System.out.println(min);\n }",
"FastScanner scanner = new FastScanner();",
"scanner",
"new FastScanner()",
"int x = scanner.nextInt();",
"x",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"List<Integer> inputList = new ArrayList<>();",
"inputList",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n inputList.add(scanner.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n inputList.add(scanner.nextInt());\n }",
"{\n inputList.add(scanner.nextInt());\n }",
"inputList.add(scanner.nextInt())",
"inputList.add",
"inputList",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"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 min = 999;",
"min",
"999",
"for (int i = 0; i <= 150; i++) {\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i <= 150",
"i",
"150",
"i++",
"i++",
"i",
"{\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }",
"{\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }",
"if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }",
"!inputList.contains(x - i)",
"inputList.contains(x - i)",
"inputList.contains",
"inputList",
"x - i",
"x",
"i",
"{\n min = x - i;\n break;\n }",
"min = x - i",
"min",
"x - i",
"x",
"i",
"break;",
"if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }",
"!inputList.contains(x + i)",
"inputList.contains(x + i)",
"inputList.contains",
"inputList",
"x + i",
"x",
"i",
"{\n min = x + i;\n break;\n }",
"min = x + i",
"min",
"x + i",
"x",
"i",
"break;",
"System.out.println(min)",
"System.out.println",
"System.out",
"System",
"System.out",
"min",
"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() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n 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())\n 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)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"hasNextByte",
"{\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr < buflen",
"ptr",
"buflen",
"{\n return true;\n }",
"return true;",
"true",
"{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr = 0",
"ptr",
"0",
"try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }",
"readByte",
"{\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }",
"if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }",
"isPrintableChar",
"{\n return 33 <= c && c <= 126;\n }",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }",
"hasNext",
"{\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }",
"while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n 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())\n 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())\n 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())\n 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())\n 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())\n 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())\n 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)\n throw new NumberFormatException();\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n 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() {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n List<Integer> inputList = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n inputList.add(scanner.nextInt());\n }\n // N = 0 の場合\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int min = 999;\n for (int i = 0; i <= 150; i++) {\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }\n System.out.println(min);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int x = scanner.nextInt();\n int n = scanner.nextInt();\n List<Integer> inputList = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n inputList.add(scanner.nextInt());\n }\n // N = 0 の場合\n if (n == 0) {\n System.out.println(x);\n return;\n }\n int min = 999;\n for (int i = 0; i <= 150; i++) {\n if (!inputList.contains(x - i)) {\n min = x - i;\n break;\n }\n if (!inputList.contains(x + i)) {\n min = x + i;\n break;\n }\n }\n System.out.println(min);\n }\n}",
"Main"
]
| import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int x = scanner.nextInt();
int n = scanner.nextInt();
List<Integer> inputList = new ArrayList<>();
for (int i = 0; i < n; i++) {
inputList.add(scanner.nextInt());
}
// N = 0 の場合
if (n == 0) {
System.out.println(x);
return;
}
int min = 999;
for (int i = 0; i <= 150; i++) {
if (!inputList.contains(x - i)) {
min = x - i;
break;
}
if (!inputList.contains(x + i)) {
min = x + i;
break;
}
}
System.out.println(min);
}
}
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,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
40,
13,
0,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
18,
13,
13,
2,
13,
17,
30,
40,
13,
0,
13,
40,
17,
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
],
[
139,
5
],
[
139,
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
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
98,
100
],
[
91,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
113,
115
],
[
109,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
119,
121
],
[
108,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
108,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
6,
136
],
[
136,
137
],
[
0,
138
],
[
138,
139
],
[
138,
140
]
]
| [
"import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n \tint n = sc.nextInt();\n\t\tint[] p = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n \tint ans = x;\n \tint num = x;\n \tfor(int i=0; i<n; i++){\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }\n \tfor(int i=0; i<n; i++){\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }\n \tif(Math.abs(ans-x)>=Math.abs(num-x)) {\n\t\t System.out.println(num);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n \tint n = sc.nextInt();\n\t\tint[] p = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n \tint ans = x;\n \tint num = x;\n \tfor(int i=0; i<n; i++){\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }\n \tfor(int i=0; i<n; i++){\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }\n \tif(Math.abs(ans-x)>=Math.abs(num-x)) {\n\t\t System.out.println(num);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n \tint n = sc.nextInt();\n\t\tint[] p = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n \tint ans = x;\n \tint num = x;\n \tfor(int i=0; i<n; i++){\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }\n \tfor(int i=0; i<n; i++){\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }\n \tif(Math.abs(ans-x)>=Math.abs(num-x)) {\n\t\t System.out.println(num);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n \tint n = sc.nextInt();\n\t\tint[] p = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n \tint ans = x;\n \tint num = x;\n \tfor(int i=0; i<n; i++){\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }\n \tfor(int i=0; i<n; i++){\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }\n \tif(Math.abs(ans-x)>=Math.abs(num-x)) {\n\t\t System.out.println(num);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\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[] 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",
"int num = x;",
"num",
"x",
"for(int i=0; i<n; i++){\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }",
"{\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }",
"if(ans==p[i]){\n ans++;\n i=-1;\n }",
"ans==p[i]",
"ans",
"p[i]",
"p",
"i",
"{\n ans++;\n i=-1;\n }",
"ans++",
"ans",
"i=-1",
"i",
"-1",
"1",
"for(int i=0; i<n; i++){\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }",
"{\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }",
"if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }",
"num==p[i]&&ans>0",
"num==p[i]",
"num",
"p[i]",
"p",
"i",
"ans>0",
"ans",
"0",
"{\n num--;\n i=-1;\n }",
"num--",
"num",
"i=-1",
"i",
"-1",
"1",
"if(Math.abs(ans-x)>=Math.abs(num-x)) {\n\t\t System.out.println(num);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}",
"Math.abs(ans-x)>=Math.abs(num-x)",
"Math.abs(ans-x)",
"Math.abs",
"Math",
"ans-x",
"ans",
"x",
"Math.abs(num-x)",
"Math.abs",
"Math",
"num-x",
"num",
"x",
"{\n\t\t System.out.println(num);\n\t\t}",
"System.out.println(num)",
"System.out.println",
"System.out",
"System",
"System.out",
"num",
"{\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) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n \tint n = sc.nextInt();\n\t\tint[] p = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n \tint ans = x;\n \tint num = x;\n \tfor(int i=0; i<n; i++){\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }\n \tfor(int i=0; i<n; i++){\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }\n \tif(Math.abs(ans-x)>=Math.abs(num-x)) {\n\t\t System.out.println(num);\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) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n \tint n = sc.nextInt();\n\t\tint[] p = new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tp[i] = sc.nextInt();\n\t\t}\n \tint ans = x;\n \tint num = x;\n \tfor(int i=0; i<n; i++){\n if(ans==p[i]){\n ans++;\n i=-1;\n }\n }\n \tfor(int i=0; i<n; i++){\n if(num==p[i]&&ans>0){\n num--;\n i=-1;\n }\n }\n \tif(Math.abs(ans-x)>=Math.abs(num-x)) {\n\t\t System.out.println(num);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.*;
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();
int[] p = new int[n];
for(int i=0; i<n; i++){
p[i] = sc.nextInt();
}
int ans = x;
int num = x;
for(int i=0; i<n; i++){
if(ans==p[i]){
ans++;
i=-1;
}
}
for(int i=0; i<n; i++){
if(num==p[i]&&ans>0){
num--;
i=-1;
}
}
if(Math.abs(ans-x)>=Math.abs(num-x)) {
System.out.println(num);
}else {
System.out.println(ans);
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.