buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <iostream> #include <vector> using namespace std; int main() { int X, N, q, P_ANSWER, i, j, M = 500, flag = 0; cin >> X >> N; vector<int> P(N); for (i = 0; i < N; i++) { cin >> q; P[i] = q; } /* for (i = 0; i < N-1; i ++){ cout << P.at(i) << " "; } cout << P.at(N - 1) << endl;*/ for...
#include <iostream> #include <vector> using namespace std; int main() { int X, N, q, P_ANSWER, i, j, M = 500, flag = 0; cin >> X >> N; vector<int> P(N); for (i = 0; i < N; i++) { cin >> q; P[i] = q; } /* for (i = 0; i < N-1; i ++){ cout << P.at(i) << " "; } cout << P.at(N - 1) << endl;*/ for...
[["-", 0, 7, 15, 23, 0, 16, 31, 16, 17, 18], ["+", 0, 7, 15, 23, 0, 16, 31, 16, 17, 19]]
1
239
#include <bits/stdc++.h> #define ll long long #define pb push_back #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); using namespace std; bool ar[105]; int main() { int a, b, c; memset(ar, ...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); using namespace std; bool ar[105]; int main() { int a, b, c; memset(ar, ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
233
a = input().split() if a[1] == "0": print(a[0]) else: number_list = input().split() n = 1 number = int(a[0]) while True: num = number + n num2 = number - n if str(num) not in number_list or str(num2) not in number_list: if str(num) not in number_list and str(num2) not in number_list: ...
a = input().split() if a[1] == "0": print(a[0]) else: number_list = input().split() n = 0 number = int(a[0]) while True: num = number + n num2 = number - n if str(num) not in number_list or str(num2) not in number_list: if str(num) not in number_list and str(num2) not in number_list: ...
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
123
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { #ifdef LOCAL_EXEC #else ios_base::sync_with_stdio(false); cin.tie(NULL); #endif // LOCAL_EXEC long long int x, n, i, j; map<long long int, long long int> mt; cin >> x >> n; long long int A[n]; for (i = 0; i < n; i++) { c...
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { #ifdef LOCAL_EXEC #else ios_base::sync_with_stdio(false); cin.tie(NULL); #endif // LOCAL_EXEC long long int x, n, i, j; map<long long int, long long int> mt; cin >> x >> n; long long int A[n]; for (i = 0; i < n; i++) { ci...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 57, 64, 1, 0, 16, 12, 16, 17, 72], ["+", 0, 57, 64, 1, 0, 16, 12, 16, 17, 33], ["-", 75, 76, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 75, 76, 0, 1, 0, 16, 12, 16, 17, 72]]
1
175
num = list(map(int,input().split())) if num[1] ==0: print(num[0]) else: num_list = list(map(int,input().split())) flg = True ans = num[0] distance = 1 while flg: ch_1 = ans-distance ch_2 = ans+distance if ch_1 not in num_list: print(ch_1) flg = False elif ch_2 not in num_list: ...
num = list(map(int,input().split())) if num[1] ==0: print(num[0]) else: num_list = list(map(int,input().split())) flg = True ans = num[0] distance = 0 while flg: ch_1 = ans-distance ch_2 = ans+distance if ch_1 not in num_list: print(ch_1) flg = False elif ch_2 not in num_list:...
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
107
X,N = map(int,input().split()) if N > 0: p = list(map(int,input().split())) a = 102 ans = 0 for i in range(-1,101): if N == 0: ans = X break if p.count(i) == 0 and a > abs(X - i): a = abs(X - i) ans = i print(ans)
X,N = map(int,input().split()) if N > 0: p = list(map(int,input().split())) a = 102 ans = 0 for i in range(-1,200): if N == 0: ans = X break if p.count(i) == 0 and a > abs(X - i): a = abs(X - i) ans = i print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
98
X,N = map(int,input().split()) if N > 0: A = list(map(int,input().split())) d = {} for i in range(101): d[i] = 0 for a in A: d[a] = 1 for i in range(0,100): x = X - i y = X + i if d[x] == 0: print(x) quit() if d[y] == 0: ...
X,N = map(int,input().split()) if N > 0: A = list(map(int,input().split())) d = {} for i in range(102): d[i] = 0 for a in A: d[a] = 1 for i in range(0,100): x = X - i y = X + i if d[x] == 0: print(x) quit() if d[y] == 0: ...
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
123
import math X, N = map(int,input().split()) d = int(999) d1 = int() ans = int(999) if 0 < N: P = list(map(int,input().split())) for i in range(1,max(P)): if P.count(i) == 0: d1 = abs(X-i) if d1 < d and 0 <= d1: d = d1 ans = i print(ans) else: ...
import math X, N = map(int,input().split()) d = int(999) d1 = int() ans = int(999) if 0 < N: P = list(map(int,input().split())) for i in range(999): if P.count(i) == 0: d1 = abs(X-i) if d1 < d and 0 <= d1: d = d1 ans = i print(ans) else: p...
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
113
#include <bits/stdc++.h> using namespace std; using ll = long long; using vec = vector<ll>; using mat = vector<vec>; #define INF (1LL << 60) #define MOD 1000000007 #define PI 3.14159265358979323846 #define REP(i, m, n) for (ll(i) = (m), (i_len) = (n); (i) < (i_len); ++(i)) #define FORR(i, v) for (auto(i) : v) #defin...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vec = vector<ll>; using mat = vector<vec>; #define INF (1LL << 60) #define MOD 1000000007 #define PI 3.14159265358979323846 #define REP(i, m, n) for (ll(i) = (m), (i_len) = (n); (i) < (i_len); ++(i)) #define FORR(i, v) for (auto(i) : v) #defin...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
314
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int X, N; cin >> X >> N; vector<int> p(N); if (N != 0) { for (int i = 0; i < N; i++) cin >> p.at(i); } else { int dust; // cin >> dust; } int candidate = 0; for (int i = 0; i <= 100; i++) { bool fla...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int X, N; cin >> X >> N; vector<int> p(N); if (N != 0) { for (int i = 0; i < N; i++) cin >> p.at(i); } else { int dust; // cin >> dust; } int candidate = 0; for (int i = 0; i <= 101; i++) { bool fla...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
168
#include <assert.h> #include <stdio.h> #include <stdio.h> #include <string.h> /* 入力例: 3 1 1 3 */ int main() { int iDataNum, st, sx, sy, i; int ct, cx, cy; int strInput[2]; for (int i = 0; i < 2; i++) { scanf("%d", &strInput[i]); } if (strInput[1] == 0) { printf("%d", strInpu...
#include <assert.h> #include <stdio.h> #include <stdio.h> #include <string.h> /* 入力例: 3 1 1 3 */ int main() { int iDataNum, st, sx, sy, i; int ct, cx, cy; int strInput[2]; for (int i = 0; i < 2; i++) { scanf("%d", &strInput[i]); } if (strInput[1] == 0) { printf("%d", strInpu...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
0
394
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define pai 3.14159265358979323846 const int INF = 1001001001; typedef long long ll; int A[3][3], N; bool punched[3][3]; bool ok[3][3]; int a[3][3], n; using Graph = vector<vector<int>>; vec...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define pai 3.14159265358979323846 const int INF = 1001001001; typedef long long ll; int A[3][3], N; bool punched[3][3]; bool ok[3][3]; int a[3][3], n; using Graph = vector<vector<int>>; vec...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33]]
1
510
function Main(input) { var X = parseInt(input.split(/\n| /)[0]); var N = parseInt(input.split(/\n| /)[1]); var p = input.split("\n")[1].split(" ").map(n => parseInt(n)); if (N === 0) { console.log(X); } else { for (i = X - 1; i >= -100; i--) { if (p.indexOf(i) === -1) { console.log(i); ...
function Main(input) { var X = parseInt(input.split(/\n| /)[0]); var N = parseInt(input.split(/\n| /)[1]); var p = input.split("\n")[1].split(" ").map(n => parseInt(n)); if (N === 0) { console.log(X); } else { for (i = X; i >= -100; i--) { if (p.indexOf(i) === -1) { console.log(i); ...
[["-", 0, 7, 10, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 7, 10, 1, 0, 11, 12, 16, 12, 555]]
2
187
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } int kotae = 1000000; int sa = 1000000; bool isOK = false; for (int i = -100; i <= 100; i++) { isOK = true; if (abs(X - i) < sa) { fo...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } int kotae = 1000000; int sa = 1000000; bool isOK = false; for (int i = 0; i <= 200; i++) { isOK = true; if (abs(X - i) < sa) { for (...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
167
x, n = map(int, input().split()) if n == 0: print(x) exit() else: ps = list(map(int, input().split())) counters = [0 for _ in range(len(ps))] counters[0] = 1 for i,p in enumerate(ps): distance = abs(x - p) if distance < len(ps): counters[distance] += 1 print(counters) for i,counter in enumerate(counters...
x, n = map(int, input().split()) if n == 0: print(x) exit() else: ps = list(map(int, input().split())) counters = [0 for _ in range(len(ps)+1)] counters[0] = 1 for i,p in enumerate(ps): distance = abs(x - p) if distance < len(ps): counters[distance] += 1 for i,counter in enumerate(counters): if counte...
[["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
153
def resolve(): X, N = [int(i) for i in input().split()] if N == 0: print(X) return p_list = [int(i) for i in input().split()] min_len_with_X = 200 min_len_i = 0 for i in range(101): if i in p_list: continue if abs(i - X) < min_len_with_X: m...
def resolve(): X, N = [int(i) for i in input().split()] if N == 0: print(X) return p_list = [int(i) for i in input().split()] min_len_with_X = 200 min_len_i = 0 for i in range(102): if i in p_list: continue if abs(i - X) < min_len_with_X: m...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
101
import math input_a= input().split(" ") X=int(input_a[0]) N=int(input_a[1]) dis=X+3 if N!=0: array= input().split(" ") else: array=[0,0] num=X num2=-100 for i in range(N+1): if str(num) not in array: dis=abs(X-num) num2=X-dis num1=num if str(num2) not in array: numa=min([num,num2]) e...
import math input_a= input().split(" ") X=int(input_a[0]) N=int(input_a[1]) dis=X+3 dis2=100 if N!=0: array= input().split(" ") else: array=[0,0] num=X num2=-100 for i in range(N+1): if str(num) not in array: dis=abs(X-num) num2=X-dis num1=num if str(num2) not in array: numa=min([num,num...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
225
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int A, B; cin >> X >> N; vector<int> vec(N); if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { cin >> vec.at(i); } map<int, int> a; for (int j = 0; j <= 100; j++) { a[j] = j; } for (i...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int A, B; cin >> X >> N; vector<int> vec(N); if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { cin >> vec.at(i); } map<int, int> a; for (int j = 0; j <= 101; j++) { a[j] = j; } for (i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13]]
1
242
x, n = map(int, input().split()) lst = [] x1 = x x2 = x def minus(num): return int(num) - 1 def plus(num): return int(num) + 1 if n != 0: lst = list(map(int, input().split())) for j in range(5): count = 0 for i in lst: if x1 == i: x1 = minus(x1) ...
x, n = map(int, input().split()) lst = [] x1 = x x2 = x def minus(num): return int(num) - 1 def plus(num): return int(num) + 1 if n != 0: lst = list(map(int, input().split())) for j in range(n): count = 0 for i in lst: if x1 == i: x1 = minus(x1) ...
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
225
x, n = map(int, input().split()) not_p = [] if n != 0: p = list(map(int, input().split())) not_p = [i for i in range(101) if i not in p] else: not_p = [i for i in range(101)] mn = 101 ans = 100 for i in not_p: d = abs(x - i) if mn > d: mn = d ans = i print(ans)
x, n = map(int, input().split()) not_p = [] if n != 0: p = list(map(int, input().split())) not_p = [i for i in range(201) if i not in p] else: not_p = [i for i in range(201)] mn = 101 ans = 100 for i in not_p: d = abs(x - i) if mn > d: mn = d ans = i print(ans)
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
107
//競技プログラミング用のテンプレート #include <algorithm> #include <iostream> #include <limits> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define repr(i, n) for (int i = n - 1; i >= 0; i--) using namespace s...
//競技プログラミング用のテンプレート #include <algorithm> #include <iostream> #include <limits> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define repr(i, n) for (int i = n - 1; i >= 0; i--) using namespace s...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
264
#include <bits/stdc++.h> using namespace std; int x, n; int not_in(int p[], int num) { for (int i = 0; i < n; i++) { if (num == p[i]) return 0; } return 1; } int main() { scanf("%d %d", &x, &n); int p[n], a[100]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } for (int i = 1; i <= 10...
#include <bits/stdc++.h> using namespace std; int x, n; int not_in(int p[], int num) { for (int i = 0; i < n; i++) { if (num == p[i]) return 0; } return 1; } int main() { scanf("%d %d", &x, &n); int p[n], a[110]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } for (int i = 1; i <= 11...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
271
#include <algorithm> #include <iostream> int main() { int X, N, *p, dif = 1, num = -1; std::cin >> X >> N; p = new int[N + 2]; for (int i = 0; i < N; i++) { std::cin >> p[i]; } p[N] = -1000; p[N + 1] = 1000; std::sort(p, p + N + 2); for (int i = 0; i < N; i++) { if (p[i] == X) num = i; ...
#include <algorithm> #include <iostream> int main() { int X, N, *p, dif = 1, num = -1; std::cin >> X >> N; p = new int[N + 2]; for (int i = 0; i < N; i++) { std::cin >> p[i]; } p[N] = -1000; p[N + 1] = 1000; std::sort(p, p + N + 2); for (int i = 1; i < N + 1; i++) { if (p[i] == X) num =...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
206
x,n=list(map(int,input().split(' '))) if n == 0: print (x) else: p=list(map(int,input().split(' '))) chk_x = False pmax = 0 pmin = 101 for pr in p: if pmax < pr: pmax = pr if pmin > pr: pmin = pr if pr == x: chk_x = True all_i = ...
x,n=list(map(int,input().split(' '))) if n == 0: print (x) else: p=list(map(int,input().split(' '))) chk_x = False pmax = 0 pmin = 101 for pr in p: if pmax < pr: pmax = pr if pmin > pr: pmin = pr if pr == x: chk_x = True all_i = ...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
172
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[110]; bool ok[110]; int main() { int x, n; cin >> x >> n; for (int i = 0; i < n; i++) { cin >> a[i]; ok[a[i]] = 1; } int ans = 110; int mi = 110; for (int i = 0; i <= 100; i++) { if (!ok[i]) { if (abs(i - x) < mi) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[110]; bool ok[110]; int main() { int x, n; cin >> x >> n; for (int i = 0; i < n; i++) { cin >> a[i]; ok[a[i]] = 1; } int ans = 110; int mi = 110; for (int i = 0; i <= 101; i++) { if (!ok[i]) { if (abs(i - x) < mi) ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
144
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; } else { vector<int> p; vector<int> ans; int ans1 = 1000, ans2 = 1000; for (int i = 0; i < n; i++) { int a; cin >> a; p.push_back(a); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; } else { vector<int> p; vector<int> ans; int ans1 = 1000, ans2 = 1000; for (int i = 0; i < n; i++) { int a; cin >> a; p.push_back(a); ...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 31, 22], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
251
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int X, N; cin >> X >> N; set<int> ps; int cns; rep(i, N) { cin >> cns; ps.insert(cns); } int min_val = 0; int min_deff = 1000; for (int i = 100; i >= 0; i--) { if (!ps.count(i)...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int X, N; cin >> X >> N; set<int> ps; int cns; rep(i, N) { cin >> cns; ps.insert(cns); } int min_val = 0; int min_deff = 1000; for (int i = 101; i > -3; i--) { if (!ps.count(i)...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
162
#include <stdio.h> #include <stdlib.h> int main(void) { int x, n; scanf("%d%d", &x, &n); if (n == 0) { printf("%d", x); return 0; } int p[n]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } // int seek = 0; for (int l = 1; l <= 51; l++) { for (int i = 0; i < n; i++) { if (...
#include <stdio.h> #include <stdlib.h> int main(void) { int x, n; scanf("%d%d", &x, &n); if (n == 0) { printf("%d", x); return 0; } int p[n]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } int seek = 0; for (int l = 0; l <= 51; l++) { for (int i = 0; i < n; i++) { if (x - l...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
0
222
#include <bits/stdc++.h> #include <string> using namespace std; int X, N; int p[4000]; int main() { cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } sort(p, p + N); int soe = 0; int ans = 1000; for (int i = 1; i < 101; i++) { bool flag = true; for (int j = 0; j < 101; j++) { ...
#include <bits/stdc++.h> #include <string> using namespace std; int X, N; int p[4000]; int main() { cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } sort(p, p + N); int soe = 0; int ans = 0; for (int i = 1; i < 102; i++) { bool flag = true; for (int j = 0; j < 101; j++) { if ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
156
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; if (N != 0) { std::vector<int> v(N); for (int i = 0; i < N; i++) { cin >> v.at(i); } std::vector<int> w; w.push_back(0); for (int i = 1; i < 101; i++) { bool check = false; for (int j ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; if (N != 0) { std::vector<int> v(N); for (int i = 0; i < N; i++) { cin >> v.at(i); } std::vector<int> w; w.push_back(0); for (int i = 1; i < 101; i++) { bool check = false; for (int j = ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
334
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll x, n; cin >> x >> n; ll q; vector<ll> p; ll y = 101; ll ans = 101; if (n == 0) { y = x; } else { for (ll i = 0; i < n; i++) { cin >> q; p.push_back(q); } for (ll i = -1; i < 102; i++) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll x, n; cin >> x >> n; ll q; vector<ll> p; ll y = 101; ll ans = 101; if (n == 0) { y = x; } else { for (ll i = 0; i < n; i++) { cin >> q; p.push_back(q); } for (ll i = -1; i < 102; i++) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
177
#include <bits/stdc++.h> using namespace std; // typedef typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; // define #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) int main() { int x, n, p, a = 1000, f, d; cin >> x >> n; vi s(n); vi ans; rep(i, n) ...
#include <bits/stdc++.h> using namespace std; // typedef typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; // define #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) int main() { int x, n, p, a = 1000, f, d; cin >> x >> n; vi s(n); vi ans; rep(i, n) ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
239
x, n = map(int, input().split()) if n != 0: p = list(map(int, input().split())) q = [] for i in range(101): if i in p: q.append(150) else: q.append(abs(i-x)) list_indexMin = [i for i, v in enumerate(q) if v == min(q)] print(min(list_indexMin)) else: print(x)
x, n = map(int, input().split()) if n != 0: p = list(map(int, input().split())) q = [] for i in range(102): if i in p: q.append(150) else: q.append(abs(i-x)) list_indexMin = [i for i, v in enumerate(q) if v == min(q)] print(min(list_indexMin)) else: print(x)
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
108
#include <stdio.h> int check(int *p, int n, int a) { int i; for (i = 0; i < n; i++) { if (a == p[i]) { return 0; } } return 1; } int main() { int x, n, i; int p[100] = {-1}; int min = 10000000, tmp, result; scanf("%d %d", &x, &n); if (n == 0) { printf("%d", x); return 0; }...
#include <stdio.h> int check(int *p, int n, int a) { int i; for (i = 0; i < n; i++) { if (a == p[i]) { return 0; } } return 1; } int main() { int x, n, i; int p[100] = {-1}; int min = 10000000, tmp, result; scanf("%d %d", &x, &n); if (n == 0) { printf("%d", x); return 0; }...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
0
212
#include <bits/stdc++.h> #include <stdio.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FOR(i, a, b) for (int i = a; i < (b); i++) #define range(a) a.begin(), a.end() #define endl "\n" #define Yes() cout << "Yes" << endl #define No() cout << "No" << endl u...
#include <bits/stdc++.h> #include <stdio.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FOR(i, a, b) for (int i = a; i < (b); i++) #define range(a) a.begin(), a.end() #define endl "\n" #define Yes() cout << "Yes" << endl #define No() cout << "No" << endl u...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
322
function Main(input) { const arr = input.trim().split('\n'); const XN = arr[0].split(' ').map(Number); if (XN[1] == 0) { console.log(XN[0]); return; } const pn = arr[1].split(' ').map(Number); let diff = 999; let answer = 0; for (i = -100; i <= 100; i++) { if (pn.indexOf(i) >= 0) conti...
function Main(input) { const arr = input.trim().split('\n'); const XN = arr[0].split(' ').map(Number); if (XN[1] == 0) { console.log(XN[0]); return; } const pn = arr[1].split(' ').map(Number); let diff = 999; let answer = 0; for (i = 0; i <= 101; i++) { if (pn.indexOf(i) >= 0) continue...
[["-", 0, 7, 10, 1, 0, 11, 12, 91, 17, 33], ["-", 0, 7, 10, 1, 0, 11, 12, 91, 28, 555], ["+", 8, 556, 0, 7, 10, 1, 0, 11, 12, 555], ["-", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555], ["+", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555]]
2
184
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m - 1; i >= n; i--) #define ALL(v) v.begin(), v.end() #define itn int #define Yes() cout << ...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m - 1; i >= n; i--) #define ALL(v) v.begin(), v.end() #define itn int #define Yes() cout << ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
586
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) typedef long long ll; typedef pair<int, int> P; int main() { int X, N; string S; cin >> X >> N; map<int, int> nums; rep(i, 1, 101) { nums[i]++; } /...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) typedef long long ll; typedef pair<int, int> P; int main() { int X, N; string S; cin >> X >> N; map<int, int> nums; rep(i, -101, 102) { nums[i]++; } ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
177
#include <bits/stdc++.h> using namespace std; int a[110]; int b[110]; int q = 1000000; int main() { int m, n, res; cin >> m >> n; for (int i = 0; i < n; i++) { cin >> a[n]; b[a[n]] = 1; } for (int j = 0; j < 101; j++) { if (b[j] != 1 && abs(m - j) < q) { res = j; q = m - j; } } ...
#include <bits/stdc++.h> using namespace std; int a[110]; int b[110]; int q = 1000000; int main() { int m, n, res; cin >> m >> n; for (int i = 0; i < n; i++) { cin >> a[n]; b[a[n]] = 1; } for (int j = 0; j < 202; j++) { if (b[j] != 1 && abs(m - j) < q) { res = j; q = m - j; } } ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
128
import sys def main(): X, N = list(map(int, input().split())); ans = X; min_value = 101 if N == 0: print(ans) else: p = list(map(int, input().split())) a = [i for i in range(0, 101)] for v in p: a[v] = -1 for i in range(0, 101): if a[i] != -1: d = abs(X - a[i]) ...
def main(): X, N = list(map(int, input().split())) ans = X; min_value = 202 if N == 0: print(ans) else: p = list(map(int, input().split())) a = [i for i in range(0, 202)] for v in p: a[v] = -1 for i in range(0, 202): if a[i] != -1: d = abs(X - a[i]) if(min_...
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 36, 36, 0, 656, 0, 14, 8, 196, 0, 35], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 6...
5
146
from sys import stdin X,N = map(int,input().split()) p = list(map(int,stdin.readline().split())) def solve(): i = 1 if N == 0: print(X) return if not X in p: print(X) return while i < 10: if not X-i in p: print(X-i) return if not ...
from sys import stdin X,N = map(int,input().split()) p = list(map(int,stdin.readline().split())) def solve(): i = 1 if N == 0: print(X) return if not X in p: print(X) return while True: if not X-i in p: print(X-i) return if not X+...
[["-", 0, 14, 8, 196, 0, 52, 15, 666, 0, 22], ["-", 0, 14, 8, 196, 0, 52, 15, 666, 667, 18], ["-", 0, 14, 8, 196, 0, 52, 15, 666, 0, 612], ["+", 0, 656, 0, 14, 8, 196, 0, 52, 15, 146]]
5
109
x, n = map(int, input().split()) if n == 0: print(x) exit() p = list(map(int, input().split())) unique = set(range(-100, 101)) - set(p) ans = {} ans2 = [] for i in unique: calc = abs(x-i) if calc in ans.keys(): ans[calc] = min(ans[calc], i) else: ans[calc] = i ans2.append(calc) print(ans[min(ans2)])
x, n = map(int, input().split()) if n == 0: print(x) exit() p = list(map(int, input().split())) unique = set(range(0, 102)) - set(p) ans = {} ans2 = [] for i in unique: calc = abs(x-i) if calc in ans.keys(): ans[calc] = min(ans[calc], i) else: ans[calc] = i ans2.append(calc) print(ans[min(ans2)])
[["-", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["-", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
130
#include <bits/stdc++.h> using namespace std; int n, x; int f[1000]; int main() { cin >> x >> n; for (int i = 0; i < n; ++i) { int a; cin >> a; a += 105; f[a]++; } if (n == 0) { cout << x << endl; return 0; } int A = -1, B = -1; x += 105; for (int i = 0; i <= 205; ++i) { if...
#include <bits/stdc++.h> using namespace std; int n, x; int f[1000]; int main() { cin >> x >> n; for (int i = 0; i < n; ++i) { int a; cin >> a; a += 105; f[a]++; } if (n == 0) { cout << x << endl; return 0; } int A = -1, B = -1; x += 105; for (int i = 0; i <= 210; ++i) { if...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
194
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define PI 3.141592653589793 using namespace std; using ll = unsigned long long; i...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <string> #include <unordered_map> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define PI 3.141592653589793 using namespace std; using ll = unsigned long long; i...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
210
#include <cmath> #include <iostream> using namespace std; int main(void) { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int val_list[N] = {}; for (int i = 0; i < N; i++) { cin >> val_list[i]; } int small = 0; int big = 0; int val_low; int val_high; for (i...
#include <cmath> #include <iostream> using namespace std; int main(void) { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int val_list[N] = {}; for (int i = 0; i < N; i++) { cin >> val_list[i]; } int small = 0; int big = 0; int val_low; int val_high; for (i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 51, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 51, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 16, 12, 2, 3, 4, 0, 16, 12, 22]]
1
270
#include <algorithm> #include <cassert> #include <cmath> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> p;...
#include <algorithm> #include <cassert> #include <cmath> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> p;...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
302
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REPS(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REPS(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33]]
1
316
#include <cmath> #include <iostream> using namespace std; #define f(i, a, b) for (int i = a; i <= b; ++i) int dot[105]; int main() { int n, x; cin >> x >> n; for (int i = 1; i <= n; ++i) { int y; cin >> y; dot[y] = 1; } int ans = 0x7fffffff, k; for (int i = 1; i <= 100; ++i) if (!dot[i] && a...
#include <cmath> #include <iostream> using namespace std; #define f(i, a, b) for (int i = a; i <= b; ++i) int dot[105]; int main() { int n, x; cin >> x >> n; for (int i = 1; i <= n; ++i) { int y; cin >> y; dot[y] = 1; } int ans = 0x7fffffff, k; for (int i = 0; i <= 105; ++i) if (!dot[i] && a...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
129
#include <algorithm> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> arr(n); unordered_map<int, int> m; for (int i = 0; i < n; i++) { cin >> arr[i]; m[arr[i]] = 1; } int ans = x; while (m.count(ans) > 0) { ...
#include <algorithm> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> arr(n); unordered_map<int, int> m; for (int i = 0; i < n; i++) { cin >> arr[i]; m[arr[i]] = 1; } int ans = x; while (m.count(ans) > 0) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
160
#include <algorithm> #include <iostream> #include <vector> using namespace std; bool vector_finder(vector<int> vec, int number) { auto itr = find(vec.begin(), vec.end(), number); size_t index = distance(vec.begin(), itr); if (index != vec.size()) { return true; } else { return false; } } int main() ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; bool vector_finder(vector<int> vec, int number) { auto itr = find(vec.begin(), vec.end(), number); size_t index = distance(vec.begin(), itr); if (index != vec.size()) { return true; } else { return false; } } int main() ...
[["-", 51, 91, 28, 2, 3, 4, 0, 16, 31, 22], ["+", 51, 91, 28, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22]]
1
199
#include <bits/stdc++.h> using namespace std; int main() { // cin>>str; // cout<<str<<endl;] int X, N; cin >> X >> N; int a[X] = {0}; for (int i = 0; i < N; i++) { cin >> a[i]; } int Ns = N - 1; int Nl = N + 1; int issmall = 0; int islarge = 0; for (int j = 0; j < 100; j++) { Ns = X - j...
#include <bits/stdc++.h> using namespace std; int main() { // cin>>str; // cout<<str<<endl;] int X, N; cin >> X >> N; int a[N] = {0}; for (int i = 0; i < N; i++) { cin >> a[i]; } int Ns = N - 1; int Nl = N + 1; int issmall = 0; int islarge = 0; for (int j = 0; j < 100; j++) { Ns = X - j...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 22], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 22]]
1
209
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; i++) int main() { int N, X, inp, x; cin >> X >> N; vector<int> list(105); rep(i, 105) { list[i] = i - 4; } rep(i, N) { cin >> inp; rep(j, list.size()) { if (list[j] == inp) { list....
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < n; i++) int main() { int N, X, inp, x; cin >> X >> N; vector<int> list(120); rep(i, 120) { list[i] = i - 10; } rep(i, N) { cin >> inp; rep(j, list.size()) { if (list[j] == inp) { list...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
266
F = input().split() X = int(F[0]) N = int(F[1]) k = 0 L = -1 if N == 0: q = [N] else: p = list(map(int, input().split())) p.sort() q = list(set(p)) while k == 0: L += 1 deka = X+L tibi = X-L for i in range(len(q)): if q[i] == deka: deka = 0 if q[i] == tibi: tibi = 0 if deka != 0 or tibi != 0: ...
F = input().split() X = int(F[0]) N = int(F[1]) k = 0 L = -1 if N == 0: q = [N] else: p = list(map(int, input().split())) p.sort() q = list(set(p)) while k == 0: L += 1 deka = X+L tibi = X-L for i in range(len(q)): if q[i] == deka: deka = 999 if q[i] == tibi: tibi = 999 if deka != 999 or tibi !=...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 66...
5
155
X,N=map(int,input().split()) if N==0: print(X) exit() p=list(map(int,input().split())) if X not in p: print(X) exit() tmp=101 for i in range(101): if i not in p: if tmp>abs(X-i): ans=i tmp=abs(X-i) print(ans)
X,N=map(int,input().split()) if N==0: print(X) exit() p=list(map(int,input().split())) if X not in p: print(X) exit() tmp=101 for i in range(200): if i not in p: if tmp>abs(X-i): ans=i tmp=abs(X-i) print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
100
#include <algorithm> #include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cin; cout << x << endl; return 0; } int p[110]; bool exist = false; bool existA, existB; for (int i = 0; i < n; i++) { cin >> p[i]; } // sort(p, p + n); for (int ...
#include <algorithm> #include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cin; cout << x << endl; return 0; } int p[110]; bool exist = false; bool existA, existB; for (int i = 0; i < n; i++) { cin >> p[i]; } // sort(p, p + n); for (int ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13]]
1
289
def main(): x,n=map(int,input().split()) p=[] try: p=list(map(int,input().split())) except: print(str(x)) return p=set(p) ans=0 ansc=x for i in range(1,101): if not(i in p): a=min(abs(x-i),ansc) if(a!=ansc): ans=i ansc=a print(ans) main()
def main(): x,n=map(int,input().split()) p=[] try: p=list(map(int,input().split())) except: print(str(x)) return p=set(p) ans=0 ansc=x for i in range(1,102): if not(i in p): a=min(abs(x-i),ansc) if(a!=ansc): ans=i ansc=a print(ans) main()
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
117
#include <bits/stdc++.h> #define MOD 1000000007 #define PI 3.141592653589793 typedef unsigned long long ull; typedef long long ll; using namespace std; void testCase() { int x, n; cin >> x >> n; vector<int> vals(n); for (int &i : vals) cin >> i; if (n == 0 || find(vals.begin(), vals.end(), x) == vals.e...
#include <bits/stdc++.h> #define MOD 1000000007 #define PI 3.141592653589793 typedef unsigned long long ull; typedef long long ll; using namespace std; void testCase() { int x, n; cin >> x >> n; vector<int> vals(n); for (int &i : vals) cin >> i; if (n == 0 || find(vals.begin(), vals.end(), x) == vals.e...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
263
#include <bits/stdc++.h> typedef long long ll; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define fr f...
#include <bits/stdc++.h> typedef long long ll; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define fr f...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
250
# -*- coding: utf-8 -*- X, N= map(int, input().split()) if N == 0: print(X) else: p = input().split() i = 1 while True: if (str(X-i) in p) == False: print(X-i) break elif (str(X+i) in p) == False: print(X+i) break else: i += 1
# -*- coding: utf-8 -*- X, N= map(int, input().split()) if N == 0: print(X) else: p = input().split() i = 0 while True: if (str(X-i) in p) == False: print(X-i) break elif (str(X+i) in p) == False: print(X+i) break else: i += 1
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
90
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << "\n"; return 0; } set<int> a; for (int i = 0; i < n; i++) { int temp; cin >> temp; a.insert(temp); } int ans = 100; int index = 0; for (int i = 1; i <= 1000; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << "\n"; return 0; } set<int> a; for (int i = 0; i < n; i++) { int temp; cin >> temp; a.insert(temp); } int ans = 100; int index = 0; for (int i = 0; i <= 101; i++) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
160
#include <bits/stdc++.h> using namespace std; int main() { int x, n, i; cin >> x >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; a[i] = a[i] - x; } for (i = 0;; ++i) { int ans1 = 0, ans2 = 0; for (int j = 0; j < n; ++j) { if (a[j] == i) ans1 = 1; else if (a[j]...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, i; cin >> x >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; a[i] = a[i] - x; } for (i = 0;; ++i) { int ans1 = 0, ans2 = 0; for (int j = 0; j < n; ++j) { if (a[j] == i) ans1 = 1; if (a[j] == -...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
181
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define PI 3.14159265358979323846264338327950 int main() { int x; int n; cin >> x >> n; vector<int> p(n); rep(i, n) { cin >> p[i]; } sort(p.begin(),...
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; #define PI 3.14159265358979323846264338327950 int main() { int x; int n; cin >> x >> n; vector<int> p(n); rep(i, n) { cin >> p[i]; } sort(p.begin(),...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
264
#include <bits/stdc++.h> using namespace std; int solve(long long X, long long N, std::vector<long long> p) { long long index = 0; long long q_index = 0; long long absx; long long mina = 9999999999; long long ans; vector<long long> q; sort(p.begin(), p.end()); if (N == 0) { cout << X << endl; ...
#include <bits/stdc++.h> using namespace std; int solve(long long X, long long N, std::vector<long long> p) { long long index = 0; long long q_index = 0; long long absx; long long mina = 9999999999; long long ans; vector<long long> q; sort(p.begin(), p.end()); if (N == 0) { cout << X << endl; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
292
x,n=map(int,input().split()) import sys if n>=1: p=list(map(int,input().split())) else: print(x) sys.exit() s=[] d={} l={} for i in range(-101,101): if i not in p: s.append(i) for k in s: d[k]=abs(x-k) l=[m[0] for m in d.items() if m[1]==min(d.values())] print(min(l))
x,n=map(int,input().split()) import sys if n>=1: p=list(map(int,input().split())) else: print(x) sys.exit() s=[] d={} l={} for i in range(-105,200): if i not in p: s.append(i) for k in s: d[k]=abs(x-k) l=[m[0] for m in d.items() if m[1]==min(d.values())] print(min(l))
[["-", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
139
X,N=map(int, input().split()) ans=0 flag=0 if N!=0: P=sorted(list(map(int, input().split()))) pabs=[] for p in P: pabs.append(abs(X-p)) pabs.sort() if 0 in pabs: for i in range(1,max(pabs)+1): if i in pabs: if pabs.count(i)==1: if X-i not in P: ans=X-i flag=1 break el...
X,N=map(int, input().split()) ans=0 flag=0 if N!=0: P=sorted(list(map(int, input().split()))) pabs=[] for p in P: pabs.append(abs(X-p)) pabs.sort() if 0 in pabs: for i in range(1,max(pabs)+1): if i in pabs: if pabs.count(i)==1: if X-i not in P: ans=X-i flag=1 break ...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
178
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using ll = long long; using namespace std; constexpr int MOD = 1e9 + 7; constexpr ll ...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using ll = long long; using namespace std; constexpr int MOD = 1e9 + 7; constexpr ll ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
261
X, N = map(int, input().split(" ")) if N == 0: print(X) exit() else: p = list(map(int, input().split(" "))) c = 0 for i in range(100): if i+1 not in p: if abs(X-(i+1)) < abs(X-c): c = i+1 print(c)
X, N = map(int, input().split(" ")) if N == 0: print(X) exit() else: p = list(map(int, input().split(" "))) c = 0 for i in range(200): if i+1 not in p: if abs(X-(i+1)) < abs(X-c): c = i+1 else: print(c) exit()
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 57, 64, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 64, 196, 0, 57, 75, 76, 0, 102], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
100
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> vec(n); int a = 0; for (int i = 0; i < n; i++) cin >> vec.at(i); for (int i = 0; i >= 0; i++) { for (int j = 0; j < n; j++) { if (x - i == vec.at(j)) { a++; } } if (a == 0)...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> vec(n); int a = 0; for (int i = 0; i < n; i++) cin >> vec.at(i); for (int i = 0; i >= 0; i++) { a = 0; for (int j = 0; j < n; j++) { if (x - i == vec.at(j)) { a++; } } ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
184
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #defi...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #defi...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
369
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; #define fast_io() \ ios_base ::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; // #include "prettyprint.hpp" typedef long long ll; typedef double db; #define fast_io() \ ios_base ::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68]]
1
340
#include <bits/stdc++.h> using namespace std; #define REP(i, n) FOR(i, 0, (n)) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define LAR(a, b) ((a) = max((a), (b))) #define SML(a, b) ((a) = min((a), (b))) using ll = long long; using ld = long double; using vi = vector<int>; using vl = vector<ll>; using pii = pai...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) FOR(i, 0, (n)) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define LAR(a, b) ((a) = max((a), (b))) #define SML(a, b) ((a) = min((a), (b))) using ll = long long; using ld = long double; using vi = vector<int>; using vl = vector<ll>; using pii = pai...
[["+", 0, 43, 49, 50, 51, 41, 15, 16, 17, 60], ["+", 0, 43, 49, 50, 51, 41, 15, 16, 12, 13]]
1
270
XN = list(map(int, input().split())) if XN[1] == 0: print(XN[0]) else: p = list(map(int, input().split())) for d in range(XN[1] + 1): if not XN[0] - d in p: print(XN[0] - d) elif not XN[0] + d in p: print(XN[0] + d)
XN = list(map(int, input().split())) if XN[1] == 0: print(XN[0]) else: p = list(map(int, input().split())) for d in range(XN[1] + 1): if not XN[0] - d in p: print(XN[0] - d) break if not XN[0] + d in p: print(XN[0] + d) break
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121]]
5
104
x, n = map(int, input().split()) if n != 0: n = list(map(int, input().split())) ans = [] for i in range(1, 101): if n.count(x + i) == 0: ans.append(x + i) if n.count(x - i) == 0: ans.append(x - i) if ans != []: break print(min(ans)) else: print(x)
x, n = map(int, input().split()) if n != 0: n = list(map(int, input().split())) ans = [] for i in range(101): if n.count(x + i) == 0: ans.append(x + i) if n.count(x - i) == 0: ans.append(x - i) if ans != []: break print(min(ans)) else: print(x)
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
112
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; int p[n + 1]; for (int i = 1; i <= n; ++i) cin >> p[i]; sort(p + 1, p + n + 1); int minx = INT_MAX; for (int i = -100; i <= 100; ++i) { if (!b...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; int p[n + 1]; for (int i = 1; i <= n; ++i) cin >> p[i]; sort(p + 1, p + n + 1); int minx = INT_MAX; for (int i = -200; i <= 200; ++i) { if (!b...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
181
<?php fscanf(STDIN, "%d %d", $x, $n); $array = explode(' ', trim(fgets(STDIN))); if (!isset($array)) { echo $x;exit; } $nums = range(0, 100); foreach ($array as $v) { unset($nums[$v]); } $array = array_values($nums); $lef = -1; $rig = count($array); while ($rig - $lef > 1) { $mid = ceil($lef + ($rig - $lef) ...
<?php fscanf(STDIN, "%d %d", $x, $n); $array = explode(' ', trim(fgets(STDIN))); if (!isset($array)) { echo $x;exit; } $nums = range(0, 101); foreach ($array as $v) { unset($nums[$v]); } $array = array_values($nums); $lef = -1; $rig = count($array); while ($rig - $lef > 1) { $mid = ceil($lef + ($rig - $lef) ...
[["-", 0, 11, 12, 613, 3, 3, 0, 28, 0, 612], ["+", 0, 11, 12, 613, 3, 3, 0, 28, 0, 612]]
6
225
#include <bits/stdc++.h> using namespace std; int main(void) { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } int num = 0; int mn = 500; sort(p.begin(), p.end()); if (n == 0) { cout << x << endl; return 0; } for (int i = 1; i <= 500; i++) { ...
#include <bits/stdc++.h> using namespace std; int main(void) { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } int num = 0; int mn = 500; sort(p.begin(), p.end()); if (n == 0) { cout << x << endl; return 0; } for (int i = -100; i <= 500; i++) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
192
#include <iostream> using namespace std; int main(void) { int x, n; cin >> x >> n; int p; bool pn[101]; for (int i = 0; i < 101; i++) { pn[i] = true; } for (int i = 0; i < n; i++) { cin >> p; pn[p] = false; } if (n == 0) { cout << x << endl; return 0; } // 入力されたpiがpn[pi] = f...
#include <iostream> using namespace std; int main(void) { int x, n; cin >> x >> n; int p; bool pn[102]; for (int i = 0; i < 102; i++) { pn[i] = true; } for (int i = 0; i < n; i++) { cin >> p; pn[p] = false; } if (n == 0) { cout << x << endl; return 0; } // 入力されたpiがpn[pi] = f...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
202
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; int main() { int X, N; int ans = 1000; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } vector<int> vec(N); for (int i = 0; i < N; ++i) { cin >> vec.at(i); } for (int i = 100; i >= 0; i -= 1) { bool ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; int main() { int X, N; int ans = 1000; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } vector<int> vec(N); for (int i = 0; i < N; ++i) { cin >> vec.at(i); } for (int i = 101; i >= 0; i -= 1) { bool ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
177
X, N = list(map(int, input().split())) if N == 0: print(X) else: p = list(map(int, input().split())) not_p = set(range(101)) - set(p) arg_min = 10000 value_min = 10000 for i in not_p: tmp = abs(X - i) if tmp < value_min or (tmp == value_min and i < arg_min): value_mi...
X, N = list(map(int, input().split())) if N == 0: print(X) else: p = list(map(int, input().split())) not_p = set(range(-100, 110)) - set(p) arg_min = 10000 value_min = 10000 for i in not_p: tmp = abs(X - i) if tmp < value_min or (tmp == value_min and i < arg_min): va...
[["-", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
105
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ll x, n; cin >> x >> n; vector<ll> p; p.resize(n); for (ll i = 0; i < n; i++) { cin >> p[i]; } sort(p.begin(), p.end()); ll dis = -1; ll minnum = 0; for (ll i = 1; i <= 100; i++) { if (fi...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ll x, n; cin >> x >> n; vector<ll> p; p.resize(n); for (ll i = 0; i < n; i++) { cin >> p[i]; } sort(p.begin(), p.end()); ll dis = -1; ll minnum = 0; for (ll i = 0; i <= 101; i++) { if (fi...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
208
x, n = map(int,input().split()) if n != 0: p = list(map(int,input().split())) else: print(x) quit() p.sort() d = 10 ** 9 for i in range(-1000,1000): if d > abs(i-x) and i not in p: d = abs(i-x) ans = i print(i) print(ans)
x, n = map(int,input().split()) if n != 0: p = list(map(int,input().split())) else: print(x) quit() p.sort() d = 10 ** 9 for i in range(-1000,1000): if d > abs(i-x) and i not in p: d = abs(i-x) ans = i print(ans)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
102
x_n = input() x_n_list = x_n.split() x = int(x_n_list[0]) n = int(x_n_list[1]) if n == 0: print(x) else: allp = input() p_list = allp.split() p_l = [int(n) for n in p_list] if x not in p_l: print(x) else: for i in range(len(p_l)): if x - i in p_l: print(x - i - 1) break e...
x_n = input() x_n_list = x_n.split() x = int(x_n_list[0]) n = int(x_n_list[1]) if n == 0: print(x) else: allp = input() p_list = allp.split() p_l = [int(n) for n in p_list] if x not in p_l: print(x) else: for i in range(len(p_l)): if x - i - 1 not in p_l: print(x - i - 1) break...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 699], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 17, 72], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 699]]
5
123
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p; if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { int temp; cin >> temp; p.push_back(temp); } sort(p.begin(), p.end()); int...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p; if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { int temp; cin >> temp; p.push_back(temp); } sort(p.begin(), p.end()); int...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
222
#include <bits/stdc++.h> using namespace std; int main() { int X, N, Min = 100, res; cin >> X >> N; int Q[101]; for (int i = 1; i <= 100; i++) { Q[i] = 0; } for (int i = 0; i < N; i++) { int p; cin >> p; Q[p]++; } for (int i = 100; i > 0; i--) { if (Q[i] != 1) { if (abs(i - X)...
#include <bits/stdc++.h> using namespace std; int main() { int X, N, Min = 100, res; cin >> X >> N; int Q[103]; for (int i = -1; i <= 101; i++) { Q[i] = 0; } for (int i = 0; i < N; i++) { int p; cin >> p; Q[p]++; } for (int i = 101; i > -2; i--) { if (Q[i] != 1) { if (abs(i - ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
149
X, N = map(int, input().split()) if N!=0: p=list(map(int,input().split())) checkNum=[0 for j in range(101)] for i in range(len(p)): checkNum[p[i]]=1 i=0 while(X-i>=0 or X+i<=100): if X-i>=0: if checkNum[X-i]==0: print(X-i) break if ...
X, N = map(int, input().split()) if N!=0: p=list(map(int,input().split())) checkNum=[0 for j in range(102)] for i in range(len(p)): checkNum[p[i]]=1 i=0 while(X-i>=0 or X+i<=101): if X-i>=0: if checkNum[X-i]==0: print(X-i) break if ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["-", 0, 52, 15, 23, 0, 679, 12, 666, 0, 612], ["+", 0, 52, 15, 23, 0, 679, 12, 666, 0, 612], ["-", 0, 52, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 612]]
5
145
#include <bits/stdc++.h> using namespace std; bool check[110]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int x, n, p; int res = 1e9; int diff = 1e9; cin >> x >> n; memset(check, true, sizeof(check)); for (int i = 0; i < n; i++) { cin >> p; check[p] = false; } for (int ...
#include <bits/stdc++.h> using namespace std; bool check[110]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int x, n, p; int res = 1e9; int diff = 1e9; cin >> x >> n; memset(check, true, sizeof(check)); for (int i = 0; i < n; i++) { cin >> p; check[p] = false; } for (int ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
157
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<int, null_type, less<int>, rb_tree_tag, \ ...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set \ tree<int, null_type, less<int>, rb_tree_tag, \ ...
[["-", 0, 7, 10, 43, 49, 50, 51, 91, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 91, 28, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
460
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define fi first #define se second...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define fi first #define se second...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
427
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define watch(x) cout << (#x) << " is " << (x) << endl #define debug cout << "hi" << endl using namespace std; typedef long long ll; typedef long double ld; typedef p...
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define watch(x) cout << (#x) << " is " << (x) << endl #define debug cout << "hi" << endl using namespace std; typedef long long ll; typedef long double ld; typedef p...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
247
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; // vector<int> a; bool flag[101]; for (int i = 0; i < 101; i++) { flag[i] = false; } if (n == 0) { cout << x << '\n'; return 0; } for (int i = 0; i < n; i++) { int y; cin >> y; // a.push_back(y)...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; // vector<int> a; bool flag[102]; for (int i = 0; i < 102; i++) { flag[i] = false; } if (n == 0) { cout << x << '\n'; return 0; } for (int i = 0; i < n; i++) { int y; cin >> y; // a.push_back(y)...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
165
X, N = [int(i) for i in input().split()] if N == 0: # if False: print(X) else: Ps = set([int(i) for i in input().split()]) # 間違い。なぜ...??? if X not in Ps: print(X) # print(f'{X} {sorted(Ps)}') diff = 0 while True: a = X - diff if a not in Ps: print(a) ...
X, N = [int(i) for i in input().split()] if N == 0: print(X) else: Ps = set([int(i) for i in input().split()]) # 間違い。なぜ...??? if X not in Ps: print(X) exit(0) # print(f'{X} {sorted(Ps)}') diff = 0 while True: a = X - diff if a not in Ps: print(a)...
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
106
#include <bits/stdc++.h> typedef long long int lli; using namespace std; int main() { lli a, b, ans; cin >> a >> b; lli num[102] = {0}; for (lli i = 0; i < b; i++) { cin >> ans; num[ans] = 1; } if (b == 0) cout << a - 1 << endl; else { for (lli i = a + 1, j = a - 1;; i++, j--) { if ...
#include <bits/stdc++.h> typedef long long int lli; using namespace std; int main() { lli a, b, ans; cin >> a >> b; lli num[102] = {0}; for (lli i = 0; i < b; i++) { cin >> ans; num[ans] = 1; } if (b == 0) cout << a << endl; else { for (lli i = a, j = a;; i++, j--) { if (num[j] == 0...
[["-", 64, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33]]
1
151
// int a = stoi(c); 文字列をintへ //小文字から大文字 // transform(a.begin(), a.end(), a.begin(), ::toupper); //数値計算 個数以外はdouble // map 全探索 // auto begin = p.begin(), end = p.end(); // for (auto it = begin; it != end; it++) {} // mapのキー:it->first mapのバリュー:it->second //大文字判定 isupper(文字) 小文字判定 islower(文字) // do{}while(next_permutation...
// int a = stoi(c); 文字列をintへ //小文字から大文字 // transform(a.begin(), a.end(), a.begin(), ::toupper); //数値計算 個数以外はdouble // map 全探索 // auto begin = p.begin(), end = p.end(); // for (auto it = begin; it != end; it++) {} // mapのキー:it->first mapのバリュー:it->second //大文字判定 isupper(文字) 小文字判定 islower(文字) // do{}while(next_permutation...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
649
#include <bits/stdc++.h> #include <cstdlib> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } int ans = 100; for (int i = 100; - 1 <= i; i--) { int count = 0; for (int j = 0; j < n; j++) { if (vec.at(j) ==...
#include <bits/stdc++.h> #include <cstdlib> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } int ans = 101; for (int i = 101; - 1 <= i; i--) { int count = 0; for (int j = 0; j < n; j++) { if (vec.at(j) ==...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
155
x, n = map(int, input().split()) if n == 0: print(x) exit() p = list(map(int, input().split())) l = [] for i in range(0,101): l.append(i) L = [] for i in l: if i not in p: L.append(i) l = [] for i in L: l.append([i, abs(x-i)]) a = min(l, key = lambda t: t[1]) print(list(a)[0])
x, n = map(int, input().split()) if n == 0: print(x) exit() p = list(map(int, input().split())) l = [] for i in range(-100,102): l.append(i) L = [] for i in l: if i not in p: L.append(i) l = [] for i in L: l.append([i, abs(x-i)]) a = min(l, key = lambda t: t[1]) print(list(a)[0])
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
136
#include <iostream> #define N_MAX 200 int P[N_MAX]; int main() { int N, X; std::cin >> X >> N; for (int i = 0; i < N; i++) { int tmp; std::cin >> tmp; P[tmp] = 1; } for (int i = 0; i <= 100; i++) { if (X - i >= 0 && P[X - i] == 0) { printf("%d\n", X - i); break; } else if (X + ...
#include <iostream> #define N_MAX 200 int P[N_MAX]; int main() { int N, X; std::cin >> X >> N; for (int i = 0; i < N; i++) { int tmp; std::cin >> tmp; P[tmp] = 1; } for (int i = 0; i <= 100; i++) { if (X - i >= 0 && P[X - i] == 0) { printf("%d\n", X - i); break; } else if (X + ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
148
x,n=map(int,input().split()) if n==0: print(x) else: a=list(map(int,input().split())) ans=-1 for i in range(0,101): if i not in a and abs(i-x)<abs(ans-x): ans=i print(ans)
x,n=map(int,input().split()) if n==0: print(x) else: a=list(map(int,input().split())) ans=-1 for i in range(0,102): if i not in a and abs(i-x)<abs(ans-x): ans=i print(ans)
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
85
#include <bits/stdc++.h> #include <cassert> #define rep(i, n) for (int i = 0; i < (n); i++) #define PI 3.14159265358979 using namespace std; using ll = long long; using P = pair<int, int>; struct Edge { int to; int weight; Edge(int t, int w) : to(t), weight(w) {} }; // using Graph = vector<vector<Edge>>; using Gr...
#include <bits/stdc++.h> #include <cassert> #define rep(i, n) for (int i = 0; i < (n); i++) #define PI 3.14159265358979 using namespace std; using ll = long long; using P = pair<int, int>; struct Edge { int to; int weight; Edge(int t, int w) : to(t), weight(w) {} }; // using Graph = vector<vector<Edge>>; using Gr...
[["+", 0, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
355
def main(): import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) x, n = map(int, readline().split()) p = list(map(int, readline().split())) p.sort() check = float('inf') ans = 0 for...
def main(): import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) x, n = map(int, readline().split()) p = list(map(int, readline().split())) check = float('inf') ans = 0 for i in range(1...
[["-", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
140
#include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i > (n); --i) #define arep(i, x) for (auto &&i : (x)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) //降順はgreater<T>() #define all...
#include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (a); i > (n); --i) #define arep(i, x) for (auto &&i : (x)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) //降順はgreater<T>() #define all...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
556