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 <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; long long MOD = 1000000007LL; const double PI = 3.14159265358979323846; #undef INT_MIN #undef INT_MAX #define INT_MIN -21474...
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; long long MOD = 1000000007LL; const double PI = 3.14159265358979323846; #undef INT_MIN #undef INT_MAX #define INT_MIN -21474...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 22]]
1
172
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int i, res, d; bool p[101]; cin >> X >> N; int t; for (i = 0; i < 101; i++) p[i] = true; for (i = 0; i < N; i++) { cin >> t; p[t] = false; } d = 100; res = 0; for (i = 1; i < 101; i++) { if (p[i]) if (abs...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int i, res, d; bool p[102]; cin >> X >> N; int t; for (i = 0; i < 102; i++) p[i] = true; for (i = 0; i < N; i++) { cin >> t; p[t] = false; } d = 200; res = 0; for (i = 0; i < 102; i++) { if (p[i]) if (abs...
[["-", 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], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, ...
1
147
#include <bits/stdc++.h> using namespace std; int main() { int N, num; cin >> N >> num; int number[101] = {0}; int now; for (int i = 0; i < num; i++) { cin >> now; number[now + 1] = 1; } int width = 0; int ans; while (true) { if (num == 0) { ans = N; break; } if (num...
#include <bits/stdc++.h> using namespace std; int main() { int N, num; cin >> N >> num; int number[103] = {0}; int now; for (int i = 0; i < num; i++) { cin >> now; number[now + 1] = 1; } int width = 0; int ans; while (true) { if (num == 0) { ans = N; break; } if (num...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
1
149
X, N = map(int, input().split()) if int(N) == 0: print(X) else: Y = list(map(int, input().split())) x = int(X) for i in range(100): if x - i not in Y: print(x + i) break elif x + i not in Y: print(x - i) break
X, N = map(int, input().split()) if int(N) == 0: print(X) else: Y = list(map(int, input().split())) x = int(X) for i in range(100): if x - i not in Y: print(x - i) break elif x + i not in Y: print(x + i) break
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
91
#include <bits/stdc++.h> using namespace std; int main() { long long t, n, i, ans, cnt, j, k, x, p = 0, q = 0; cin >> x >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } i = x; j = x; while (i<101, j> 0) { p = 0; q = 0; for (k = 0; k < n; k++) { if (a[k] != j) { p++...
#include <bits/stdc++.h> using namespace std; int main() { long long t, n, i, ans, cnt, j, k, x, p = 0, q = 0; cin >> x >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } i = x; j = x; while (i < 101, j >= 0) { p = 0; q = 0; for (k = 0; k < n; k++) { if (a[k] != j) { ...
[["-", 0, 52, 15, 339, 51, 34, 12, 16, 17, 47], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 20]]
1
181
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> #define rep(i, N) for (int i = 0; i < N; i++) using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); rep(i, N) { cin >> p.at(i); } int ans = ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> #define rep(i, N) for (int i = 0; i < N; i++) using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); rep(i, N) { cin >> p.at(i); } int ans = ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
168
a = input() t, c = int(a.split(" ")[0]), int(a.split(" ")[1]) if not c: print(t) else: b = input() lst = [int(x) for x in b.split(" ")] for i in range(1, c): if t - i not in lst: print(t - i) break if t + i not in lst: print(t + i) break...
a = input() t, c = int(a.split(" ")[0]), int(a.split(" ")[1]) if not c: print(t) else: b = input() lst = [int(x) for x in b.split(" ")] for i in range(c+2): if t - i not in lst: print(t - i) break if t + i not in lst: print(t + i) break
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
112
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, a, n) for (int i = (a); i < (n); i++) #define all(vec) vec.begin(), vec.end() using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; int main() { int X, N; cin >> X >> N...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, a, n) for (int i = (a); i < (n); i++) #define all(vec) vec.begin(), vec.end() using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; int main() { int X, N; cin >> X >> N...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
213
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod107 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) using Graph = vector<vector<int>>; #define grepq priority_queue<double, std::vector<double>, std::greater<double>> #define all(v) v.begin(), v.end() #define PI acos(-1) const ll IN...
#include <bits/stdc++.h> using namespace std; #define ll long long #define mod107 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) using Graph = vector<vector<int>>; #define grepq priority_queue<double, std::vector<double>, std::greater<double>> #define all(v) v.begin(), v.end() #define PI acos(-1) const ll IN...
[["-", 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
272
#include <bits/stdc++.h> #include <numeric> using namespace std; #define ll long long #define mod107 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) using Graph = vector<vector<int>>; #define grepq priority_queue<double, std::vector<double>, std::greater<double>> #define all(v) v.begin(), v.end() #define PI ac...
#include <bits/stdc++.h> #include <numeric> using namespace std; #define ll long long #define mod107 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) using Graph = vector<vector<int>>; #define grepq priority_queue<double, std::vector<double>, std::greater<double>> #define all(v) v.begin(), v.end() #define PI ac...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
253
#include <bits/stdc++.h> using namespace std; int main() { int x, n, c = 0, ans = 0, m = 100; cin >> x >> n; int a[n]; vector<int> v; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < 101; i++) { if (a[c] == i) c++; else v.push_back(i); } for (i...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, c = 0, ans = 0, m = 100; cin >> x >> n; int a[101]; vector<int> v; for (int i = 0; i <= 101; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i <= 101; i++) { if (a[c] == i) c++; else v.push_back(i); } ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
172
#include <bits/stdc++.h> using namespace std; int main() { int x, n, flag = 0, num = 100, ans = 0; int a[105]; vector<int> vec; cin >> x >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 1; i <= 100; i++) { if (a[flag] == i) { flag++; } else { vec.push_...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, flag = 0, num = 100, ans = 0; int a[105]; vector<int> vec; cin >> x >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i <= 101; i++) { if (a[flag] == i) { flag++; } else { vec.push_...
[["-", 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
#include <bits/stdc++.h> using namespace std; int main() { int x, n, flag = 0, num = 100, ans = 0, a = 0; int an[105]; int nu[105]; cin >> x >> n; for (int i = 0; i < n; i++) cin >> an[i]; sort(an, an + n); for (int i = 1; i <= 100; i++) { if (an[flag] == i) { flag++; } else { n...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, flag = 0, num = 100, ans = 0, a = 0; int an[105]; int nu[105]; cin >> x >> n; for (int i = 0; i < n; i++) cin >> an[i]; sort(an, an + n); for (int i = 0; i <= 101; i++) { if (an[flag] == i) { flag++; } else { 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
184
x, n = map(int, input().split()) if n == 0: print(x) else : pn = [int(num) for num in input().split()] answers = {} for i in range(0,100): if not i in pn: answers[i] = abs(i-x) print(min(answers, key=answers.get))
x, n = map(int, input().split()) if n == 0: print(x) else : pn = [int(num) for num in input().split()] answers = {} for i in range(102): if not i in pn: answers[i] = abs(i-x) print(min(answers, key=answers.get))
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
89
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int x, n; cin >> x >> n; set<int> p; rep(i, n) { int a; cin >> a; p.insert(a); } int ans = x; int mindif = 1e9; rep(i, 101) { if (n ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int x, n; cin >> x >> n; set<int> p; rep(i, n) { int a; cin >> a; p.insert(a); } int ans = x; int mindif = 1e9; rep(i, 150) { if (n ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
146
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1000000007; #define pll pair<ll, ll> #define pii pair<int32_t, int32_t> #define loop(i, n) for (int64_t i = 0; i < n; i++) #define loop1(i, a, b) for (int64_t i = a; i <= b; i++) #define rloop(i, n) for (int64_t i = n - 1; i >= 0; i--) #define...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mod = 1000000007; #define pll pair<ll, ll> #define pii pair<int32_t, int32_t> #define loop(i, n) for (int64_t i = 0; i < n; i++) #define loop1(i, a, b) for (int64_t i = a; i <= b; i++) #define rloop(i, n) for (int64_t i = n - 1; i >= 0; i--) #define...
[["-", 64, 9, 0, 1, 0, 11, 12, 41, 15, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 41, 0, 101], ["+", 64, 9, 0, 1, 0, 11, 12, 41, 0, 101], ["+", 64, 9, 0, 1, 0, 11, 12, 41, 64, 22]]
1
238
def solve(): x, n = map(int, input().split()) if not n: print(x) return ps = list(map(int, input().split())) flgs = [1] * 101 for p in ps: flgs[p] = 0 ansr = 101 ansl = 101 index = x while 1: if flgs[index] == 1: ansr = index ...
def solve(): x, n = map(int, input().split()) if not n: print(x) return ps = list(map(int, input().split())) flgs = [1] * 102 for p in ps: flgs[p] = 0 ansr = 101 ansl = 101 index = x while 1: if flgs[index] == 1: ansr = index ...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
145
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double lld; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> ii; typedef vector<ii> vii; typedef set<int> si; typedef map<string, int> msi; typedef pair<ll, ll> pll; typedef pair<ll, pair<ll, ll>> plll; void solve() ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double lld; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> ii; typedef vector<ii> vii; typedef set<int> si; typedef map<string, int> msi; typedef pair<ll, ll> pll; typedef pair<ll, pair<ll, ll>> plll; void solve() ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
273
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; long long MOD = 10000000000 + 7; int main() { cout << setprecision(10); int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p[i]; } sort(p.begin(), p.end()); int min_val = ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; long long MOD = 10000000000 + 7; int main() { cout << setprecision(10); int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p[i]; } sort(p.begin(), p.end()); int min_val = ...
[["-", 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, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
185
//コンパイラ最適化用 #pragma GCC optimize("Ofast") //インクルード(アルファベット順) #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <chrono> //実行時間計測 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #i...
//コンパイラ最適化用 #pragma GCC optimize("Ofast") //インクルード(アルファベット順) #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <chrono> //実行時間計測 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #i...
[["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 72]]
1
241
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define endl "\n" int main() { faster; int x, n; cin >> x >> n; map<int, int> a; for (int i = 0; i < n; i++) { int input; cin >> input; a[input]++; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define endl "\n" int main() { faster; int x, n; cin >> x >> n; map<int, int> a; for (int i = 0; i < n; i++) { int input; cin >> input; a[input]++; ...
[["-", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 79], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
156
#include "bits/stdc++.h" using namespace std; typedef long long int ll; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int x, n; cin >> x >> n; set<int> distinct; for (int i = 0; i < n; i++) { int y; cin >> y; distinct.insert(y); } int mini = 0; for (int i = 0; i <= 100...
#include "bits/stdc++.h" using namespace std; typedef long long int ll; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int x, n; cin >> x >> n; set<int> distinct; for (int i = 0; i < n; i++) { int y; cin >> y; distinct.insert(y); } int mini = 0; for (int i = 0; i <= 101...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(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
1,074
x,n = map(int, input().split()) if n==0: print(x) quit() p = list(map(int, input().split())) ans = 0 for i in range(1,x+1): x1,x2 = x+i,x-i if (x1 in p) and (x2 in p): continue elif not((x1 in p) or (x2 in p)): ans = min(x1,x2) break elif not(x1 in p): ans = x1 break else: ans = x2...
x,n = map(int, input().split()) if n==0: print(x) quit() p = list(map(int, input().split())) ans = 0 for i in range(x+1): x1,x2 = x+i,x-i if (x1 in p) and (x2 in p): continue elif not((x1 in p) or (x2 in p)): ans = min(x1,x2) break elif not(x1 in p): ans = x1 break else: ans = x2 ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
132
#include <bits/stdc++.h> using namespace std; int a[105], n; bool esta(int k) { bool b = true; for (int i = 0; i < n; i++) { if (k == a[i]) b = false; } if (b) return true; else return false; } int main() { int x; cin >> x >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int...
#include <bits/stdc++.h> using namespace std; int a[105], n; bool esta(int k) { bool b = true; for (int i = 0; i < n; i++) { if (k == a[i]) b = false; } if (b) return true; else return false; } int main() { int x; cin >> x >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int...
[["-", 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
198
n, m = map(int, input().split()) if m == 0: lst = [] else: lst = [int(i) for i in input().split()] nums = [] min_l = 1000 for i in range(1, 101): if i in lst: continue l = abs(i - n) if l < min_l: min_l = l min_num = i elif l >= min_l: break print(min_num)
n, m = map(int, input().split()) if m == 0: lst = [] else: lst = [int(i) for i in input().split()] nums = [] min_l = 1000 for i in range(103): if i in lst: continue l = abs(i - n) if l < min_l: min_l = l min_num = i elif l >= min_l: break print(min_num)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
97
#include <bits/stdc++.h> using namespace std; #define fast_IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl '\...
#include <bits/stdc++.h> using namespace std; #define fast_IO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define endl '\...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
216
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define fi first #define se second #define pb push_back #define all(v) v.begin(), v.end() #define repf(i, a, b) for (ll i = a; i < b; i++) #define repb(i, a, b) for (ll i = ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define fi first #define se second #define pb push_back #define all(v) v.begin(), v.end() #define repf(i, a, b) for (ll i = a; i < b; i++) #define repb(i, a, b) for (ll i = ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
582
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { map<int, int> m; int x, n, ar[2000]; cin >> x >> n; for (int i = 1; i <= n; i++) { cin >> ar[i]; m[ar[i]]++; } int left = -1, right = -1; for (int i = x - 1; i >= 1; i--) { if (m[i] == 0) { left = i; ...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { map<int, int> m; int x, n, ar[2000]; cin >> x >> n; for (int i = 1; i <= n; i++) { cin >> ar[i]; m[ar[i]]++; } int left = -1, right = -1; for (int i = x - 1; i >= 0; i--) { if (m[i] == 0) { left = i; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
212
X,N=map(int,input().split()) if N==0: print(X) else: p=list(map(int,input().split())) q=[i-X for i in p] qs=set(q) print(q) for i in range(N): if -i not in qs: print(X-i) break elif i not in qs: print(X+i) break
X,N=map(int,input().split()) if N==0: print(X) else: p=list(map(int,input().split())) q=[i-X for i in p] qs=set(q) for i in range(N+1): if -i not in qs: print(X-i) break elif i not in qs: print(X+i) break
[["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
100
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X; cin >> N; vector<int> p(N); unordered_set<int> exist; if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { cin >> p[i]; exist.insert(p[i]); } int mindiff = 1000; int minnum = 100...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X; cin >> N; vector<int> p(N); unordered_set<int> exist; if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { cin >> p[i]; exist.insert(p[i]); } int mindiff = 1000; int minnum = 100...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 15, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 15, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
188
x,n=map(int,input().split()) if n==0: print(x) else: a=list(map(int,input().split())) for i in range(100): if x-i not in a: ans=x-1 break elif x+i not in a: ans=x+i break print(ans)
x,n=map(int,input().split()) if n==0: print(x) else: a=list(map(int,input().split())) for i in range(100): if x-i not in a: ans=x-i break elif x+i not in a: ans=x+i break print(ans)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
84
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long #define pb push_back #define mp make_pair bool isPrime(ll n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (ll i = 5; i * i <= n; i = i + 6) if (n %...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long #define pb push_back #define mp make_pair bool isPrime(ll n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (ll i = 5; i * i <= n; i = i + 6) if (n %...
[["-", 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, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
616
#include <bits/stdc++.h> #define endl '\n' #define F first #define S second #define PB push_back #define MP make_pair #define mod 1000000007 #define FASTIO \ ios::sync_with_stdio(0); \ cin.tie(0); #de...
#include <bits/stdc++.h> #define endl '\n' #define F first #define S second #define PB push_back #define MP make_pair #define mod 1000000007 #define FASTIO \ ios::sync_with_stdio(0); \ cin.tie(0); #de...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
218
#include "bits/stdc++.h" using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \ c i) { sim > ...
#include "bits/stdc++.h" using namespace std; #define sim template <class c #define ris return *this #define dor > debug &operator<< #define eni(x) \ sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \ c i) { sim > ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
649
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]]
1
1,244
x, len = gets.split.map(&:to_i) min = 100 result = 0 if len == 0 puts x else arr = gets.split.map(&:to_i) (0..99).reverse_each do |i| if arr.include?(i) next end if (x-i).abs <= min then min = (x-i).abs result = i end end puts result end
x, len = gets.split.map(&:to_i) min = 100 result = 0 if len == 0 puts x else arr = gets.split.map(&:to_i) (0..101).reverse_each do |i| if arr.include?(i) next end if (x-i).abs <= min then min = (x-i).abs result = i end end puts result end
[["-", 75, 95, 0, 652, 486, 739, 0, 475, 444, 612], ["+", 75, 95, 0, 652, 486, 739, 0, 475, 444, 612]]
4
85
#include <math.h> #include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main(void) { int x, n, m, up, down; cin >> x >> n; int check[101]; for (int i = 0; i <= 100; i++) { check[i] = 0; } if (n == 0) { cout << x << endl; goto coco; } else { f...
#include <math.h> #include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main(void) { int x, n, m, up = 101, down = -1; cin >> x >> n; int check[101]; for (int i = 0; i <= 100; i++) { check[i] = 0; } if (n == 0) { cout << x << endl; goto coco; } e...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
244
if __name__=="__main__": X,N = list(map(int,input().split(" "))) p = list(map(int,input().split(" "))) for i in range(X+1): for j in [-1,1]: a = X + i*j if not (a in p): print(a) exit()
if __name__=="__main__": X,N = list(map(int,input().split())) p = list(map(int,input().split())) for i in range(X+1): for j in [-1,1]: a = X + i*j if not (a in p): print(a) exit(0)
[["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
91
#include <iostream> using namespace std; bool arr[10001]; int x, n, a, i; int main() { cin >> x >> n; for (i = 0; i < n; i++) { cin >> a; arr[a] = true; } if (n == 0) { cout << x << endl; } else { for (i = 1; i <= 1000; i++) { if (arr[x - i] == false) { cout << x - i << endl; ...
#include <iostream> using namespace std; bool arr[10001]; int x, n, a, i; int main() { cin >> x >> n; for (i = 0; i < n; i++) { cin >> a; arr[a] = true; } if (n == 0) { cout << x << endl; } else { for (i = 0; i <= 100; i++) { if (arr[x - i] == false) { cout << x - i << endl; ...
[["-", 75, 76, 0, 9, 0, 7, 10, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 10, 11, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
138
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int p[201]; int main() { int x, n; cin >> x >> n; for (int i = 0; i < n; i++) { int a; cin >> a; p[a] = 1; } int ok = -1; for (int i = x; i >= 0; i--) { if (!p[i]) { ok = i; break; } } // ...
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int p[201]; int main() { int x, n; cin >> x >> n; for (int i = 0; i < n; i++) { int a; cin >> a; p[a] = 1; } int ok = -1; for (int i = x; i >= 0; i--) { if (!p[i]) { ok = i; break; } } // ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
192
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int x, n; int p[100]; int i, j; int ans, mans, flag; scanf("%d %d", &x, &n); for (i = 0; i < n; i++) scanf("%d", &p[i]); ans = 1000; mans = 1000; if (n == 0) { printf("%d\n", x); return 0; } for ...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int x, n; int p[100]; int i, j; int ans, mans, flag; scanf("%d %d", &x, &n); for (i = 0; i < n; i++) scanf("%d", &p[i]); ans = 1000; mans = 1000; if (n == 0) { printf("%d\n", x); return 0; } for ...
[["-", 8, 9, 0, 7, 10, 11, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 10, 11, 12, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 11, 12, 16, 17, 33]]
0
300
from bisect import bisect_left x, n = map(int, input().split()) if n != 0: P = list(map(int, input().split())) P = sorted(P) else: P = [] flag = False ans = [] if x not in P or n == 0: ans.append(x) else: idx = bisect_left(P, x) for i in range(n): for_num = P[idx] + 1 bac_num = ...
from bisect import bisect_left x, n = map(int, input().split()) if n != 0: P = list(map(int, input().split())) P = sorted(P) else: P = [] flag = False ans = [] if x not in P or n == 0: ans.append(x) else: idx = bisect_left(P, x) for i in range(1, 110): for_num = P[idx] + i bac_n...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
152
#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); } if (N == 0) { cout << X << endl; } for (int i = 1; i < N; i++) { int T1 = X - i; int T2 = X + i; int cnt1 = 0; int cnt2 = 0; ...
#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); } if (N == 0) { cout << X << endl; } for (int i = 1; i <= N; i++) { int T1 = X - i; int T2 = X + i; int cnt1 = 0; int cnt2 = 0;...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
235
x,n = map(int,input().split()) if n == 0: print(x) quit() a = list(map(int,input().split())) k = 1 while(True): if not x-k in a: print(x-k) quit() if not x+k in a: print(x+k) quit() k += 1
x,n = map(int,input().split()) if n == 0: print(x) quit() a = list(map(int,input().split())) k = 0 while(True): if not x-k in a: print(x-k) quit() if not x+k in a: print(x+k) quit() k += 1
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
90
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { int i, j, sa, a = 100, c, judge = 0; int X, N; scanf("%d", &X); scanf("%d", &N); int data[N]; for (i = 0; i < N; i++) { scanf("%d", &data[i]); } for (i = 0; i <= 100; i++) { for (j = 0; j < N; j++) { if (i == data...
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { int i, j, sa, a = 100, c, judge = 0; int X, N; scanf("%d", &X); scanf("%d", &N); int data[N]; for (i = 0; i < N; i++) { scanf("%d", &data[i]); } for (i = 0; i <= 120; i++) { for (j = 0; j < N; j++) { if (i == data...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
0
189
/* karmany evadhikaras te ma phalesu kadacana ma karma-phala-hetur bhur ma re sango'stv akarmani (B.G.-2.47) Translation: Lord Krsna to Arjuna. You have a right to perform your prescribed duty, but you are not entitled to the fruits of action. Never consider yourself the cause o...
/* karmany evadhikaras te ma phalesu kadacana ma karma-phala-hetur bhur ma re sango'stv akarmani (B.G.-2.47) Translation: Lord Krsna to Arjuna. You have a right to perform your prescribed duty, but you are not entitled to the fruits of action. Never consider yourself the cause o...
[["-", 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
#include <algorithm> #include <iostream> using namespace std; int P[100]; int main(void) { int X, N; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> P[i]; } if (N == 0) { cout << X << endl; return 0; } sort(P, P + N); int m = 0; int ans = 1; for (int i = 1; i <= 100; i++) { bool...
#include <algorithm> #include <iostream> using namespace std; int P[100]; int main(void) { int X, N; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> P[i]; } if (N == 0) { cout << X << endl; return 0; } sort(P, P + N); int m = 0; int ans = 0; for (int i = 1; i <= 101; i++) { bool...
[["-", 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
175
x,n = gets.split.map(&:to_i) if n == 0 puts x exit end a = gets.split.map(&:to_i) b = (1..100).to_a ans = 0 cnt = 10**10 (b - a).each do |i| diff = (x-i).abs if diff < cnt ans = i cnt = diff end end puts ans
x,n = gets.split.map(&:to_i) if n == 0 puts x exit end a = gets.split.map(&:to_i) b = (0..101).to_a ans = 0 cnt = 10**10 (b - a).each do |i| diff = (x-i).abs if diff < cnt ans = i cnt = diff end end puts ans
[["-", 0, 662, 12, 652, 486, 739, 0, 475, 756, 612], ["+", 0, 662, 12, 652, 486, 739, 0, 475, 756, 612], ["-", 0, 662, 12, 652, 486, 739, 0, 475, 444, 612], ["+", 0, 662, 12, 652, 486, 739, 0, 475, 444, 612]]
4
83
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define arep(x, n) for (int x : n) using namespace std; int main() { int x, n; cin >> x >> n; set<int> s; int tmp; rep(i, n) { cin >> tmp; s.insert(tmp); } int ans_p = 0, ans_m = 0; for (int i = x; i <= 100; i++) { if ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define arep(x, n) for (int x : n) using namespace std; int main() { int x, n; cin >> x >> n; set<int> s; int tmp; rep(i, n) { cin >> tmp; s.insert(tmp); } int ans_p = 0, ans_m = 0; for (int i = x; i <= 101; i++) { if ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
185
package main import ( "fmt" "math" "sort" ) func main() { var X, N, number, Result, A int fmt.Scanf("%d %d", &X, &N) if N == 0 { fmt.Println(X) } else { p := make([]int, N) for i := 0; i < N; i++ { fmt.Scanf("%d", &p[i]) } sort.Ints(p) number = 0 Result = X A = 0 for i := 0; i < 100; i...
package main import ( "fmt" "math" "sort" ) func main() { var X, N, number, Result, A int fmt.Scanf("%d %d", &X, &N) if N == 0 { fmt.Println(X) } else { p := make([]int, N) for i := 0; i < N; i++ { fmt.Scanf("%d", &p[i]) } sort.Ints(p) number = 0 Result = X A = 0 for i := 0; i < 102; i...
[["-", 75, 196, 0, 7, 0, 430, 15, 16, 12, 433], ["+", 75, 196, 0, 7, 0, 430, 15, 16, 12, 433], ["+", 36, 36, 36, 36, 36, 36, 0, 434, 0, 165]]
7
217
#include <bits/stdc++.h> #define yes cout << "YES" << endl #define no cout << "NO" << endl #define fff(i, a, b) for (int(i) = (a); (i) <= (b); i++) #define pb push_back #define len(a) (a).length() #define all(a) (a).begin(), (a).end() #define sz(a) (a).size() #define mp make_pair using namespace std; typedef long lo...
#include <bits/stdc++.h> #define yes cout << "YES" << endl #define no cout << "NO" << endl #define fff(i, a, b) for (int(i) = (a); (i) <= (b); i++) #define pb push_back #define len(a) (a).length() #define all(a) (a).begin(), (a).end() #define sz(a) (a).size() #define mp make_pair using namespace std; typedef long lo...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
248
import sys X,N=map(int,input().split()) if N==0: print(X) sys.exit() else: P=list(map(int,input().split())) L=[] A=[] A_1=[] for i in range(-100,200): L.append(i) for i in P: L[i+100]=200 for i in L: A.append(abs(X-i)) A_1=sorted(A) a=A_1[0] for i in L: if i==X-a: print(i) sys.exit() elif i==X+a...
import sys X,N=map(int,input().split()) if N==0: print(X) sys.exit() else: P=list(map(int,input().split())) L=[] A=[] A_1=[] for i in range(-100,200): L.append(i) for i in P: L[i+100]=200 for i in L: A.append(abs(X-i)) A_1=sorted(A) a=A_1[0] for i in L: if i==X-a: print(i) sys.exit() elif i==X+a...
[["-", 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
160
x,n = map(int,input().split()) li = [] if n != 0: li = list(map(int,input().split())) answer = -10000 for i in range(0, 101): if (i in li): continue if abs(i-x) < abs(answer - x): answer = i print(answer)
x,n = map(int,input().split()) li = [] if n != 0: li = list(map(int,input().split())) answer = 0 for i in range(0, 102): if (i in li): continue if abs(i-x) < abs(answer - x): answer = i print(answer)
[["-", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
86
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) cnt = 0 if x in p: print(x) else: while True: cnt += 1 if x - cnt not in p: print(x - cnt) break if x + cnt not in p: ...
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) cnt = 0 if x not in p: print(x) else: while True: cnt += 1 if x - cnt not in p: print(x - cnt) break if x + cnt not in p...
[["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 699]]
5
94
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
302
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { // int x1, x2, x3, x4, x5 = 0; // int a = 0; // cin >> x1 >> x2 >> x3 >> x4 >> x5; // if (x1 == 0)a = x2 - 1; // if (x2 == 0)a = x1 + 1; // if (x3 == 0)a = x2 + 1; // if (x4 == 0)a = x3 + 1; // ...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { // int x1, x2, x3, x4, x5 = 0; // int a = 0; // cin >> x1 >> x2 >> x3 >> x4 >> x5; // if (x1 == 0)a = x2 - 1; // if (x2 == 0)a = x1 + 1; // if (x3 == 0)a = x2 + 1; // if (x4 == 0)a = x3 + 1; // ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72]]
1
254
x,n = list(map(int,input().split())) ans = 0 if n != 0: p_list = list(map(int,input().split())) for i in range(0,101): if i not in p_list: if abs(x - i) < abs(x - ans): ans = i elif abs(x - i) == abs(x - ans) and i < ans: ans = i else: ans = x print(ans)
x,n = list(map(int,input().split())) ans = 0 if n != 0: p_list = list(map(int,input().split())) for i in range(0,102): if i not in p_list: if abs(x - i) < abs(x - ans): ans = i elif abs(x - i) == abs(x - ans) and i < ans: ans = i else: ans = x print(ans)
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
109
x, n = map(int, input().split()) x1 = x x2 = x if n == 0: print(x) else: p = list(map(int, input().split())) if x not in p: print(x) while True: x1 -= 1 x2 += 1 if x1 not in p: print(x1) exit() if x2 not in p: ...
x, n = map(int, input().split()) x1 = x x2 = x if n == 0: print(x) else: p = list(map(int, input().split())) if x not in p: print(x) else: while True: x1 -= 1 x2 += 1 if x1 not in p: print(x1) exit() ...
[["+", 75, 76, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 8, 196, 0, 57, 75, 76, 0, 102]]
5
95
#include <algorithm> #include <iostream> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; int main() { int x, n; cin >> x >> n; int p[102] = {0}; int tmp; rep(i, n) { cin >> tmp; ++p[tmp]; } if (0 == n) { cout << x << endl; return 0; } int ans; int left = 0, ...
#include <algorithm> #include <iostream> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; int main() { int x, n; cin >> x >> n; int p[102] = {0}; int tmp; rep(i, n) { cin >> tmp; ++p[tmp]; } if (0 == n) { cout << x << endl; return 0; } int ans; int left = 0, ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
206
#include <iostream> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; int ans = X; int i, j; for (i = 0; i < N; i++) { cin >> p[i]; } for (i = 1; i <= N; i++) { for (j = 0; j < N; j++) { if (p[j] == X - i) { break; } } if (j == N) { an...
#include <iostream> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; int ans = X; int i, j; for (i = 0; i < N; i++) { cin >> p[i]; } for (i = 0; i <= N; i++) { for (j = 0; j < N; j++) { if (p[j] == X - i) { break; } } if (j == N) { an...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
174
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define repi(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(x) (...
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define repi(i, s, n) for (int i = (s); i < (int)(n); i++) #define all(x) (...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
328
#ifdef __GNUC__ #pragma GCC target("avx2") #pragma GCC optimize("O25") #pragma GCC optimize("tree-vectorize") #pragma GCC optimize("unroll-loops") #define iss std::cin #endif #include "bits/stdc++.h" //#include <boost/multiprecision/cpp_int.hpp> //#include <boost/multiprecision/cpp_dec_float.hpp> #define rep(i, times) ...
#ifdef __GNUC__ #pragma GCC target("avx2") #pragma GCC optimize("O25") #pragma GCC optimize("tree-vectorize") #pragma GCC optimize("unroll-loops") #define iss std::cin #endif #include "bits/stdc++.h" //#include <boost/multiprecision/cpp_int.hpp> //#include <boost/multiprecision/cpp_dec_float.hpp> #define rep(i, times) ...
[["-", 0, 171, 0, 43, 49, 50, 51, 377, 0, 378], ["+", 0, 171, 0, 43, 49, 50, 51, 377, 0, 378], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
231
X, N = map(int,input().split()) if N == 0: print(X) exit() a = list(map(int,input().split())) cnt = 1 while 1: b,c = X-cnt,X+cnt if b not in a: print(b) break elif c not in a: print(c) break else: cnt += 1
X, N = map(int,input().split()) if N == 0: print(X) exit() a = list(map(int,input().split())) cnt = 0 while 1: b,c = X-cnt,X+cnt if b not in a: print(b) break elif c not in a: print(c) break else: cnt += 1
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
89
x, n = map(int, input().split()) if n: p = list(map(int, input().split())) for i in range(n+1): if x - i in p: print(x-1) break if x + i in p: print(x+1) break else: print(x)
x, n = map(int, input().split()) if n: p = list(map(int, input().split())) for i in range(n+1): if not x - i in p: print(x-i) break if not x + i in p: print(x+i) break else: print(x)
[["+", 0, 7, 8, 196, 0, 57, 15, 681, 0, 372], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
80
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll x, n; cin >> x >> n; ll arr[101] = {0}; for (ll i = 0; i < n; ++i) { ll tmp; cin >> tmp; arr[tmp] = 1; } ll ans = 38259, kanta = 335893; for (ll i = -200; i < 120; ++i) { if (i >= 0) { if (arr[i] =...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll x, n; cin >> x >> n; ll arr[101] = {0}; for (ll i = 0; i < n; ++i) { ll tmp; cin >> tmp; arr[tmp] = 1; } ll ans = 38259, kanta = 335893; for (ll i = -200; i < 120; ++i) { if (i >= 0) { if (arr[i] =...
[["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
185
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MOD (ll)(1e9 + 7) int main() { ll x, n; cin >> x >> n; vector<ll> vec; ll xx; if (n == 0) { cout << x << "\n"; } else { for (int i = 0; i < n; i++) { cin >> xx; vec.push_back(xx); } sort(vec.begin(), vec....
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MOD (ll)(1e9 + 7) int main() { ll x, n; cin >> x >> n; vector<ll> vec; ll xx; if (n == 0) { cout << x << "\n"; } else { for (int i = 0; i < n; i++) { cin >> xx; vec.push_back(xx); } sort(vec.begin(), vec....
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
191
x, n = map(int, input().split()) if n == 0: print(x) else: p_l = list(map(int, input().split())) p_x_l = [ x-i for i in p_l ] for i in range(1,101): if i not in p_x_l: print(x-i) break if -i not in p_x_l: print(x+i) break
x, n = map(int, input().split()) if n == 0: print(x) else: p_l = list(map(int, input().split())) p_x_l = [ x-i for i in p_l ] for i in range(101): if i not in p_x_l: print(x-i) break if -i not in p_x_l: print(x+i) break
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
92
#include <bits/stdc++.h> #define int long long #define pb push_back #define mp make_pair #define endl "\n" #define pii pair<int, int> #define ff first #define ss second #define N 10000005 #define INF 10000000000000 using namespace std; const int mod = 1e9 + 7; void need_for_speed() { ios_base::sync_with_stdio(fals...
#include <bits/stdc++.h> #define int long long #define pb push_back #define mp make_pair #define endl "\n" #define pii pair<int, int> #define ff first #define ss second #define N 10000005 #define INF 10000000000000 using namespace std; const int mod = 1e9 + 7; void need_for_speed() { ios_base::sync_with_stdio(fals...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
196
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typede...
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typede...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
233
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int nr, n, rez; int v[101], fr[101]; int main() { cin >> nr >> n; for (int i = 1; i <= n; i++) { cin >> v[i]; fr[v[i]]++; } if (n == 0) { cout << nr; return 0; } else { int mini = 102; for (int i = -100; i <...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int nr, n, rez; int v[101], fr[101]; int main() { cin >> nr >> n; for (int i = 1; i <= n; i++) { cin >> v[i]; fr[v[i]]++; } if (n == 0) { cout << nr; return 0; } else { int mini = 102; for (int i = -100; i <...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
155
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define F first #define S second #define mod 1000000007 #define dbg(n) cout << #n << ' ' << n << endl; int main() { int x, n; cin >> x >> n; int a[101] = {0}; for (int i = 0; i < n; i++) { int y;...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define mp make_pair #define pb push_back #define F first #define S second #define mod 1000000007 #define dbg(n) cout << #n << ' ' << n << endl; int main() { int x, n; cin >> x >> n; int a[102] = {0}; for (int i = 0; i < n; i++) { int y;...
[["-", 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
148
# C Forbidden List x, n = map(int, input().split()) if n != 0: p = list(map(int, input().split())) for i in range(1, 100): if x-i not in p: print(x-i) break elif x+i not in p: print(x+i) break else: print(x)
# C Forbidden List x, n = map(int, input().split()) if n != 0: p = list(map(int, input().split())) for i in range(100): if x-i not in p: print(x-i) break elif x+i not in p: print(x+i) break else: print(x)
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
85
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int cnt = 0; int small, large; cin >> X >> N; small = X - 1; large = X + 1; if (N == 0) { cout << X << endl; return 0; } vector<int> p(N); for (int i = 0; i < N; i++) cin >> p.at(i); for (int i = 0; i < N; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int cnt = 0; int small, large; cin >> X >> N; small = X - 1; large = X + 1; if (N == 0) { cout << X << endl; return 0; } vector<int> p(N); for (int i = 0; i < N; i++) cin >> p.at(i); for (int i = 0; i < N; i++) { ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
268
// Never stop chasing!-MdSourav. #include <bits/stdc++.h> #define yes cout << "YES" << endl #define no cout << "NO" << endl #define sz(x) x.size() #define ll long long int #define ls long int #define start \ ios_base::sync_with_stdio(0); ...
// Never stop chasing!-MdSourav. #include <bits/stdc++.h> #define yes cout << "YES" << endl #define no cout << "NO" << endl #define sz(x) x.size() #define ll long long int #define ls long int #define start \ ios_base::sync_with_stdio(0); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
422
[X, N] = list(map(int, input().split())) A = [] try: P = list(map(int, input().split())) list_int = [x for x in range(1, 102)] list_int_d = list(set(list_int) - set(P)) list_int_d.sort() for i in list_int_d: A.append(abs(X - i)) if 0 in A: print(X) else: Index = A.index(min(A)) print(list_...
[X, N] = list(map(int, input().split())) A = [] try: P = list(map(int, input().split())) list_int = [x for x in range(0, 102)] list_int_d = list(set(list_int) - set(P)) list_int_d.sort() for i in list_int_d: A.append(abs(X - i)) if 0 in A: print(X) else: Index = A.index(min(A)) print(list_...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
129
package main import "fmt" func main() { var x, n int fmt.Scan(&x, &n) list := make([]int, n) for i := 0; i < n; i++ { fmt.Scan(&list[i]) } if n == 0 { fmt.Println(x) return } min := 0 diff := 100 for i := x - 1; i >= 0; i-- { flag := false for j := 0; j < n; j++ { if i == list[j] { flag =...
package main import "fmt" func main() { var x, n int fmt.Scan(&x, &n) list := make([]int, n) for i := 0; i < n; i++ { fmt.Scan(&list[i]) } if n == 0 { fmt.Println(x) return } min := 0 diff := 100 for i := x - 1; i >= 0; i-- { flag := false for j := 0; j < n; j++ { if i == list[j] { flag =...
[["-", 0, 430, 10, 431, 12, 432, 0, 16, 17, 72], ["-", 0, 430, 10, 431, 12, 432, 0, 16, 12, 433]]
7
282
#include <iostream> #include <iterator> #include <math.h> #include <vector> using namespace std; bool find(int target, vector<int> p) { for (size_t i = 0; i < p.size(); i++) { if (target == p.at(i)) return true; } return false; } int main() { int x, n; cin >> x >> n; vector<int> p(n); int min...
#include <iostream> #include <iterator> #include <math.h> #include <vector> using namespace std; bool find(int target, vector<int> p) { for (size_t i = 0; i < p.size(); i++) { if (target == p.at(i)) return true; } return false; } int main() { int x, n; cin >> x >> n; vector<int> p(n); int min...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
183
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <map> #include <math.h> #include <set> #include <string> #include <utility> #define INF 1000000000000 #define MOD 1000000007 // 10^9+7:合同式の法 using namespace std; typedef long long ll; //マクロ #define REP(i, n) ...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <cmath> #include <cstring> #include <map> #include <math.h> #include <set> #include <string> #include <utility> #define INF 1000000000000 #define MOD 1000000007 // 10^9+7:合同式の法 using namespace std; typedef long long ll; //マクロ #define REP(i, n) ...
[["-", 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], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
242
//#include <stdio.h> #include <iostream> #include <math.h> using namespace std; #define PI 3.14159265359; class Hoge { public: long int i0; int i1, N0; int iX; string s0; int *iarray0, *iarray1; Hoge(int); void func0(); void array0(); void printarray0(); void lostnumber(); ~Hoge(); private: vo...
//#include <stdio.h> #include <iostream> #include <math.h> using namespace std; #define PI 3.14159265359; class Hoge { public: long int i0; int i1, N0; int iX; string s0; int *iarray0, *iarray1; Hoge(int); void func0(); void array0(); void printarray0(); void lostnumber(); ~Hoge(); private: vo...
[["-", 0, 1, 0, 11, 12, 350, 49, 367, 368, 13], ["+", 0, 1, 0, 11, 12, 350, 49, 367, 368, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
637
// please refer from line no. 207 /////*31022618*///// //_MONU KUMAR #include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
// please refer from line no. 207 /////*31022618*///// //_MONU KUMAR #include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
1,124
#include <bits/stdc++.h> using namespace std; #define fo(i, a, n) for (i = a; i < n; i++) #define ll long long #define deb(x) cout << #x << "=" << x << endl #define pb push_back #define mp make_pair #define ff first #define ss second #define all(x) x.begin(), x.end() #define clr(x) memset(x, 0, sizeof(x)) #define sorta...
#include <bits/stdc++.h> using namespace std; #define fo(i, a, n) for (i = a; i < n; i++) #define ll long long #define deb(x) cout << #x << "=" << x << endl #define pb push_back #define mp make_pair #define ff first #define ss second #define all(x) x.begin(), x.end() #define clr(x) memset(x, 0, sizeof(x)) #define sorta...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
330
#include <bits/stdc++.h> using namespace std; int main() { int x, n, t, minv = 10000, s; bool a[1005]; cin >> x >> n; memset(a, 0, sizeof(0)); for (int i = 1; i <= n; i++) { cin >> t; a[t] = 1; } for (int i = -100; i <= 100; i++) { if (a[i] == 0) if (fabs(x - i) < minv) { min...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, t, minv = 10000, s; bool a[1005]; cin >> x >> n; memset(a, 0, sizeof(a)); for (int i = 1; i <= n; i++) { cin >> t; a[t] = 1; } for (int i = 0; i <= 1000; i++) { if (a[i] == 0) if (fabs(x - i) < minv) { minv ...
[["-", 0, 2, 3, 4, 0, 105, 51, 23, 0, 13], ["+", 0, 2, 3, 4, 0, 105, 51, 23, 0, 22], ["-", 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], ["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 1...
1
134
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; const ll LongINF = 1e13 + 7; const int INF = 1e9 + 7; const int dx[] = {0, 1, 0, -1}; const int dy[] = {1, 0, -1, 0}; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; const ll LongINF = 1e13 + 7; const int INF = 1e9 + 7; const int dx[] = {0, 1, 0, -1}; const int dy[] = {1, 0, -1, 0}; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
466
#include <bits/stdc++.h> #define MAX 100005 #define MOD 1e9 #define pb push_back #define pairs pair<int, int> #define vi vector<int> #define vb vector<bool> #define vii vector<pairs> #define lb lower_bound #define ub upper_bound #define ll long long #define endl '\n' using namespace std; /* ----------------------------...
#include <bits/stdc++.h> #define MAX 100005 #define MOD 1e9 #define pb push_back #define pairs pair<int, int> #define vi vector<int> #define vb vector<bool> #define vii vector<pairs> #define lb lower_bound #define ub upper_bound #define ll long long #define endl '\n' using namespace std; /* ----------------------------...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
478
// Problem : C - Forbidden List // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define endl '\...
// Problem : C - Forbidden List // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define endl '\...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47]]
1
776
#include <bits/stdc++.h> #define deb(x) cout << #x << " --> " << x << endl; #define print(x) \ for (auto _x : x) \ cout << _x << " "; \ ...
#include <bits/stdc++.h> #define deb(x) cout << #x << " --> " << x << endl; #define print(x) \ for (auto _x : x) \ cout << _x << " "; \ ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
175
#include <bits/stdc++.h> #define int long long #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) using namespac...
#include <bits/stdc++.h> #define int long long #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) using namespac...
[["-", 51, 91, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 91, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["-", 51, 91, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 91, 28, 2, 3, 4, 0, 16, 17, 72], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 64, 9, 0, 1,...
1
143
#include <algorithm> #include <iostream> #include <iterator> #include <set> int main() { int X; int N; std::set<int> p; std::set<int> motherSet; std::set<int> diffSet; std::cin >> X >> N; for (int i = 0; i < N; i++) { int val; std::cin >> val; p.insert(val); } for (int i = -1; i <= 100;...
#include <algorithm> #include <iostream> #include <iterator> #include <set> int main() { int X; int N; std::set<int> p; std::set<int> motherSet; std::set<int> diffSet; std::cin >> X >> N; for (int i = 0; i < N; i++) { int val; std::cin >> val; p.insert(val); } for (int i = -1; i <= 101;...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
240
#include <iostream> #include <stdio.h> //#include <bits/stdc++.h> #include <algorithm> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <float.h> #include <iomanip> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> ...
#include <iostream> #include <stdio.h> //#include <bits/stdc++.h> #include <algorithm> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <float.h> #include <iomanip> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 72]]
1
265
#include <bits/stdc++.h> #define VI vector<int> #define SI set<int> #define QI queue<int> #define PII pair<int, int> #define MP make_pair #define PB push_back #define REP(i, a, b) for (int i = a; i < b; ++i) #define F for (int i = 0; i < n; ++i) #define FIO ...
#include <bits/stdc++.h> #define VI vector<int> #define SI set<int> #define QI queue<int> #define PII pair<int, int> #define MP make_pair #define PB push_back #define REP(i, a, b) for (int i = a; i < b; ++i) #define F for (int i = 0; i < n; ++i) #define FIO ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 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, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
201
import sys x,N=list(map(int, input().split())) if N==0: print(x) sys.exit() p=list(map(int, input().split())) z=float("inf") ans_temp=[0,0] ans=[0,0] y=[i for i in range(101) if i not in p] for i in y: if z>abs(x-i): ans[0]=abs(x-i) ans[1]=i elif z==abs(x-i): ans_temp[0]=abs(x-i) ans_temp[1]...
import sys x,N=list(map(int, input().split())) if N==0: print(x) sys.exit() p=list(map(int, input().split())) z=float("inf") ans_temp=[0,0] ans=[0,0] y=[i for i in range(-1,102) if i not in p] for i in y: if z>abs(x-i): ans[0]=abs(x-i) ans[1]=i elif z==abs(x-i): ans_temp[0]=abs(x-i) ans_temp...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 0, 659, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 659, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
185
#include <algorithm> #include <iostream> #include <string> #include <vector> //#include <stack> //#include <queue> //#include <cstdio> #include <cmath> #include <iterator> #include <map> //#include <list> #include <iomanip> using namespace std; #define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #defin...
#include <algorithm> #include <iostream> #include <string> #include <vector> //#include <stack> //#include <queue> //#include <cstdio> #include <cmath> #include <iterator> #include <map> //#include <list> #include <iomanip> using namespace std; #define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #defin...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
860
#!/usr/bin/env python3 X,N = map(int, input().split()) if N == 0: print(X) exit() A = list(map(int, input().split())) Min = 101 cnt = -100 for i in range(1,202): if cnt in A: cnt += 1 continue if abs(cnt-X) < Min: ans = cnt Min = abs(cnt-X) cnt += 1 print(ans)
#!/usr/bin/env python3 #!/usr/bin/env python3 X,N = map(int, input().split()) if N == 0: print(X) exit() A = list(map(int, input().split())) Min = 101 cnt = -200 for i in range(1,400): #print(cnt) if cnt in A: cnt += 1 continue if abs(cnt-X) < Min: ans = cnt Min =...
[["-", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
100
X,N=map(int,input().split()) if N==0: print(X) exit() P=list(map(int,input().split())) nP=[] min=10**15 for i in range(-100,101): if i not in P: nP.append(i) anlist=[] for i in nP: if min>abs(i-X): min=abs(i-X) anlist.append(i) print(anlist[-1])
X,N=map(int,input().split()) if N==0: print(X) exit() P=list(map(int,input().split())) nP=[] min=10**15 for i in range(-200,200): if i not in P: nP.append(i) anlist=[] for i in nP: if min>abs(i-X): min=abs(i-X) anlist.append(i) print(anlist[-1])
[["-", 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
118
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #defin...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #defin...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
2,682
x, n = map(int, input().split()) if n: p = {int(i) for i in input().split()} if n == 0: print(x) else: if x not in p: print(x) else: flag = True abs_diff = 1 while flag: for i in range(1, 3): ans = x + (-1)**i * abs_diff if ans ...
x, n = map(int, input().split()) if n: p = {int(i) for i in input().split()} if n == 0: print(x) else: if x not in p: print(x) else: flag = True abs_diff = 1 while flag: for i in range(1, 3): ans = x + (-1)**i * abs_diff if ans ...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
108
x, n = map(int, input().split()) if n == 0: print(x) else: list_ = list(map(int, input().split())) diff = 0 while True: if x-diff not in list_: print(x-diff) break if x+diff not in list_: print(x-diff) break diff+=1
x, n = map(int, input().split()) if n == 0: print(x) else: list_ = list(map(int, input().split())) diff = 0 while True: if x-diff not in list_: print(x-diff) break if x+diff not in list_: print(x+diff) break diff+=1
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
83
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right x,n=map(int,stdin.readline().split()) a=set(map(int,stdin.readline().split())) if(x not in a): print(x) else: diff=1 while(True): if(x-diff not in a): ...
import math import time from collections import defaultdict, deque from sys import stdin, stdout from bisect import bisect_left, bisect_right x,n=map(int,stdin.readline().split()) a=set(map(int,stdin.readline().split())) if(x not in a): print(x) else: diff=1 while(True): if(x-diff not in a): ...
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
116
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b; cin >> a >> b; ll c[b]; map<ll, ll> mp; for (ll i = 0; i < b; i++) { cin >> c[i]; mp[c[i]]++; } ll maxm = 1000, ans; if (b == 0) cout << a << endl; else { for (ll i = 1; i <= 100; i++) { if ...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b; cin >> a >> b; ll c[b]; map<ll, ll> mp; for (ll i = 0; i < b; i++) { cin >> c[i]; mp[c[i]]++; } ll maxm = 1000, ans; if (b == 0) cout << a << endl; else { for (ll i = -2; i <= 103; i++) { if...
[["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
153