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 <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define all(x) (x).begin(), (x).end()...
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define all(x) (x).begin(), (x).end()...
[["-", 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
562
#include <bits/stdc++.h> using namespace std; ////////////////////////////// Begin Macros #define all(x) (x).begin(), (x).end() #define rep(i, N) for (int i = 0; i < (int)(N); i++) #define reprev(i, N) for (int i = (int)(N)-1; i >= 0; i--) #define rep1(i, N) for (int i = 1; i <= (int)(N); i++) #define rep1rev(i, N)...
#include <bits/stdc++.h> using namespace std; ////////////////////////////// Begin Macros #define all(x) (x).begin(), (x).end() #define rep(i, N) for (int i = 0; i < (int)(N); i++) #define reprev(i, N) for (int i = (int)(N)-1; i >= 0; i--) #define rep1(i, N) for (int i = 1; i <= (int)(N); i++) #define rep1rev(i, N)...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
1
1,427
#include <iostream> #include <set> using namespace std; int main() { int n, x, i, an = 0, k = 0; cin >> x >> n; int m[n]; for (i = 0; i < n; i++) { cin >> m[i]; } an = x; k = 0; set<int> st; for (i = 0; i < n; i++) { st.insert(m[i]); } /*if(n==0) { cout<<x<<endl; return 0; ...
#include <iostream> #include <set> using namespace std; int main() { int n, x, i, an = 0, k = 0; cin >> x >> n; int m[n]; for (i = 0; i < n; i++) { cin >> m[i]; } an = x; k = 0; set<int> st; for (i = 0; i < n; i++) { st.insert(m[i]); } /*if(n==0) { cout<<x<<endl; return 0; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
174
#include <bits/stdc++.h> #define ll long long int using namespace std; bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.second < b.second); } int main() { ll t, i, j, k, n, l, x, y; cin >> x >> n; map<ll, ll> m; if (n == 0) { cout << x << endl; return 0; } vector<pair<ll, ...
#include <bits/stdc++.h> #define ll long long int using namespace std; bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.second < b.second); } int main() { ll t, i, j, k, n, l, x, y; cin >> x >> n; map<ll, ll> m; if (n == 0) { cout << x << endl; return 0; } vector<pair<ll, ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
211
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int x, n; int p; int q[111]; int i; int main() { scanf("%d %d", &x, &n); int ans = -100000; for (i = 0; i < n; i++) { scanf("%d", &p); q[p]++; } for (i = 0; i < 101; i++) { if (!q[i] && abs(x - ans) > abs(x - i)) ...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int x, n; int p; int q[111]; int i; int main() { scanf("%d %d", &x, &n); int ans = -100000; for (i = 0; i < n; i++) { scanf("%d", &p); q[p]++; } for (i = 0; i <= 101; i++) { if (!q[i] && abs(x - ans) > abs(x - i)) ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
133
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int X, N; unordered_set<int> s; cin >> X >> N; while (N > 0) { int num; cin >> num; s.insert(num); N--; } int diff = 1; int X_is = s.count(X); if (!X_is) { cout << 0; return 0...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int X, N; unordered_set<int> s; cin >> X >> N; while (N > 0) { int num; cin >> num; s.insert(num); N--; } int diff = 1; int X_is = s.count(X); if (!X_is) { cout << X; return 0...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
152
#include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000001 #define r(i, a, b) for (i = a; i < b; i++) #define...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000001 #define r(i, a, b) for (i = a; i < b; i++) #define...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13]]
1
425
#include <bits/stdc++.h> using namespace std; using ll = long long; #define debug(a) cerr << #a << ": " << a << endl #define sz(a) int(a.size()) #define rep(i, n) for (int i = 0; i < n; i++) #define forr(i, st, en) for (int i = st; i <= en; i++) #define all(v) (v).begin(), (v).end() #define X first #define Y second #de...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define debug(a) cerr << #a << ": " << a << endl #define sz(a) int(a.size()) #define rep(i, n) for (int i = 0; i < n; i++) #define forr(i, st, en) for (int i = st; i <= en; i++) #define all(v) (v).begin(), (v).end() #define X first #define Y second #de...
[["-", 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
255
X, N = [int(i) for i in input().split(" ")] if N == 0: print(X) exit() p = {int(i) for i in input().split(" ")} all_p = {i for i in range(max(p) + 1)} ranges = all_p - p diff = 1e9 for i in ranges: if diff > abs(i - X): diff = abs(i - X) ans_1 = X + diff ans_2 = X - diff for i in ranges: i...
X, N = [int(i) for i in input().split(" ")] if N == 0: print(X) exit() p = {int(i) for i in input().split(" ")} all_p = {i for i in range(1000)} ranges = all_p - p diff = 1e9 for i in ranges: if diff > abs(i - X): diff = abs(i - X) ans_1 = X + diff ans_2 = X - diff for i in ranges: if i ==...
[["-", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 12, 689, 0, 659, 12, 652, 3, 4, 0, 612]]
5
135
#include <bits/stdc++.h> using namespace std; int NEGMIN = -100; int POSMAX = 100; void solver() { int x, n; cin >> x >> n; vector<bool> posps(101); vector<bool> negps(101); for (int i = 0; i < n; i++) { int p; cin >> p; if (p < 0) { negps[-p] = true; } else { posps[p] = true; ...
#include <bits/stdc++.h> using namespace std; int NEGMIN = -101; int POSMAX = 101; void solver() { int x, n; cin >> x >> n; vector<bool> posps(101); vector<bool> negps(101); for (int i = 0; i < n; i++) { int p; cin >> p; if (p < 0) { negps[-p] = true; } else { posps[p] = true; ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
283
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)((x).size()) #define debug(x) cout << #x << ":" << x << ' '; #define debugg(x) cout << #x << ":" << x << ' ' << "\n"; #define endl "\n" #define L(X) ((X) << 1) #define R(X) (((X) << 1) | 1) #define...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)((x).size()) #define debug(x) cout << #x << ":" << x << ' '; #define debugg(x) cout << #x << ":" << x << ' ' << "\n"; #define endl "\n" #define L(X) ((X) << 1) #define R(X) (((X) << 1) | 1) #define...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
1
687
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; map<int, bool> mp; int a; for (int i = 0; i < n; i++) { cin >> a; mp[a] = 1; } int distance = -1; while (1) { distance++; if (mp[x + distance] == 0) { cout << x + distance << endl; return 0...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; map<int, bool> mp; int a; for (int i = 0; i < n; i++) { cin >> a; mp[a] = 1; } int distance = -1; while (1) { distance++; if (mp[x - distance] == 0) { cout << x - distance << endl; return 0...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, ...
1
124
<?php list($x, $n) = explode(" ", trim(fgets(STDIN))); if($n == 0){ echo $x; } else { $arr = explode(" ", trim(fgets(STDIN))); $tmp = 100; $ans = 0; for($i = 0; $x + $i <= 100; $i++){ if(!in_array($x + $i, $arr)){ $tmp = $i; $ans = $x + $i; break; } } ...
<?php list($x, $n) = explode(" ", trim(fgets(STDIN))); if($n == 0){ echo $x; } else { $arr = explode(" ", trim(fgets(STDIN))); $tmp = 100; $ans = 0; for($i = 0; $x + $i <= 101; $i++){ if(!in_array($x + $i, $arr)){ $tmp = $i; $ans = $x + $i; break; } } ...
[["-", 75, 76, 8, 9, 0, 7, 0, 16, 12, 612], ["+", 75, 76, 8, 9, 0, 7, 0, 16, 12, 612]]
6
191
// e4 - e5 - f4 //#include <boost/multiprecision/cpp_int.hpp> #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" typedef long long int ll; typedef double db; // __int128 s128; // __uint128_t u128; typedef unsigned long long u64; #define int long long int #define P 100...
// e4 - e5 - f4 //#include <boost/multiprecision/cpp_int.hpp> #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" typedef long long int ll; typedef double db; // __int128 s128; // __uint128_t u128; typedef unsigned long long u64; #define int long long int #define P 100...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
292
/*input */ // assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) // is(65-90) and 32 for space #pragma GCC target ("avx2") #pragma GCC // optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hp...
/*input */ // assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) // is(65-90) and 32 for space #pragma GCC target ("avx2") #pragma GCC // optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hp...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
379
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL) #define trace(x) cerr << #x << ": " << x << endl; typedef long long ll; typedef long double ld; ...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(NULL) #define trace(x) cerr << #x << ": " << x << endl; typedef long long ll; typedef long double ld; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
206
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<bool> p(101, true); for (int i = 0; i < n; i++) { int t; cin >> t; p[t] = false; } int ans = 0; for (int i = 0; i < 100; i++) { if (x - i >= 0 && p[x - i]) { ans = x - i; break; } ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<bool> p(102, true); for (int i = 0; i < n; i++) { int t; cin >> t; p[t] = false; } int ans = 0; for (int i = 0; i <= 100; i++) { if (x - i >= 0 && p[x - i]) { ans = x - i; break; }...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
141
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<long long, long long> #define ii pair<int, int> #define mod 1000000007 #define endl '\n' #define IOS \ std::ios::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<long long, long long> #define ii pair<int, int> #define mod 1000000007 #define endl '\n' #define IOS \ std::ios::sync_with_stdio(false); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
347
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long int lld; #define sq(x) x *x #define fr(i, m, n) for (i = m; i < n; i++) #define vec vector<int> #define sint set<int> #define qint queue<int> #define mip map<int, int> #define pint priority_queue<int> #define pb push_back #defin...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long int lld; #define sq(x) x *x #define fr(i, m, n) for (i = m; i < n; i++) #define vec vector<int> #define sint set<int> #define qint queue<int> #define mip map<int, int> #define pint priority_queue<int> #define pb push_back #defin...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
201
#include <cmath> #include <iostream> #include <string> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; int ans = X; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int i = 0; i < 5; i++) { if (X - i == 0) { ans = 0; break; } bool flag = true; for (i...
#include <cmath> #include <iostream> #include <string> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; int ans = X; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int i = 0; i < 51; i++) { if (X - i == 0) { ans = 0; break; } else { bool flag = true; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 75, 76, 0, 9, 0, 57, 64, 9, 0, 46]]
1
225
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int x, n; cin >> x >> n; vector<int> arr(n); map<int, int> counter; for (int &i : arr) cin >> i, counter[i]++; int ans = x, ab = INT_MAX; for (int i = 1; i <= 200; i++) { if (counter[i] == 0 and a...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int x, n; cin >> x >> n; vector<int> arr(n); map<int, int> counter; for (int &i : arr) cin >> i, counter[i]++; int ans = x, ab = INT_MAX; for (int i = 0; i <= 200; i++) { if (counter[i] == 0 and a...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
132
x, n = map(int, input().split()) if n==0: print(x) import sys sys.exit() P = list(map(int, input().split())) P.sort() notP = [i for i in range(1, 101) if i not in P] ans = notP[0] min_delta = abs(x - ans) for p in notP: delta = abs(x - p) if delta<min_delta: ans = p min_delta = abs(x - ans) ...
x, n = map(int, input().split()) import sys if n==0: print(x) sys.exit() P = list(map(int, input().split())) P.sort() notP = [i for i in range(0, 102) if i not in P] ans = notP[0] min_delta = abs(x - ans) for p in notP: delta = abs(x - p) if delta<min_delta: ans = p min_delta = abs(x - ans) ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 0, 656, 0, 57, 64, 196, 0, 596, 0, 487], ["-", 0, 57, 64, 196, 0, 596, 141, 673, 0, 22], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
120
#include <bits/stdc++.h> using namespace std; // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); typedef long long ll; #define FIN \ ios::sync_with_stdio(0); \ cin.tie(0);...
#include <bits/stdc++.h> using namespace std; // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); typedef long long ll; #define FIN \ ios::sync_with_stdio(0); \ cin.tie(0);...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
261
#include <bits/stdc++.h> #define debug(x) cout << '>' << #x << ':' << x << endl; #define nitro ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); const int mod = 1e9 + 7; using namespace std; using ll = long long int; const ll invmod = 998244353; const int N = 5 * (int)(1e5) + 1; const int MAXN = 1e5 + ...
#include <bits/stdc++.h> #define debug(x) cout << '>' << #x << ':' << x << endl; #define nitro ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); const int mod = 1e9 + 7; using namespace std; using ll = long long int; const ll invmod = 998244353; const int N = 5 * (int)(1e5) + 1; const int MAXN = 1e5 + ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
360
#ifdef _DEBUG #include ".vscode/debug_print.hpp" #else #define debug(...) #endif #include <bits/stdc++.h> using ll = long long; using ld = long double; using namespace std; constexpr int INF32 = 1050000000; constexpr long long INF64 = 4000000000000000000; constexpr int MOD7 = 1000000007; constexpr int MOD53 = 99824435...
#ifdef _DEBUG #include ".vscode/debug_print.hpp" #else #define debug(...) #endif #include <bits/stdc++.h> using ll = long long; using ld = long double; using namespace std; constexpr int INF32 = 1050000000; constexpr long long INF64 = 4000000000000000000; constexpr int MOD7 = 1000000007; constexpr int MOD53 = 99824435...
[["-", 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
735
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } vector<int> P; vector<int> not_P; for (int i = 0; i < N; i++) { int p; cin >> p; P.push_back(p); } sort(P.begin(), P.end()); i...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } vector<int> P; vector<int> not_P; for (int i = 0; i < N; i++) { int p; cin >> p; P.push_back(p); } sort(P.begin(), P.end()); i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
202
X, N = map(int, input().split()) if(N != 0): p = set(list(map(int, input().split()))) else: print(X) exit() result = [] for i in range(max(p)): result.append(i) ans = set(result)-p ans1 = 1*10**50 for count, i in enumerate(ans): if (ans1 > abs(i-X)): ans1 = abs(i-X) index = coun...
X, N = map(int, input().split()) if(N != 0): p = set(list(map(int, input().split()))) else: print(X) exit() result = [] for i in range(102): result.append(i) ans = set(result)-p ans1 = 1*10**50 for count, i in enumerate(ans): if (ans1 > abs(i-X)): ans1 = abs(i-X) index = count ...
[["-", 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], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
131
X, N = map(int, input().split()) if not N: print(X) exit() p = set(map(int, input().split())) n = set(range(-100, 101)) l = n - p ans = 10000 a = 10000 for i in l: tmp = abs(X - i) if a > tmp: a = tmp ans = i elif a == tmp: ans = min(ans, i) print(ans)
X, N = map(int, input().split()) if not N: print(X) exit() p = set(map(int, input().split())) n = set(range(102)) l = n - p ans = 10000 a = 10000 for i in l: tmp = abs(X - i) if a > tmp: a = tmp ans = i elif a == tmp: ans = min(ans, i) print(ans)
[["-", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
108
#include <bits/stdc++.h> #include <cassert> #include <numeric> using namespace std; typedef long long ll; typedef long double ld; using graph = vector<vector<int>>; using pii = pair<int, int>; using pll = pair<ll, ll>; using qi = queue<int>; using qpii = queue<pii>; using pqi = priority_queue<int>; using pqr = priorit...
#include <bits/stdc++.h> #include <cassert> #include <numeric> using namespace std; typedef long long ll; typedef long double ld; using graph = vector<vector<int>>; using pii = pair<int, int>; using pll = pair<ll, ll>; using qi = queue<int>; using qpii = queue<pii>; using pqi = priority_queue<int>; using pqr = priorit...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
1,328
#include <bits/stdc++.h> #define fr first #define se second #define r_0 return 0; #define ll long long #define pb push_back #define TIME ios_base::sync_with_stdio(0) using namespace std; vector<int> V, L; vector<string> Ans; map<int, int> M; set<ll> S; set<char>::iterator it; ll n, m, a, b, c, d, e, f, x, y, z, t, l = ...
#include <bits/stdc++.h> #define fr first #define se second #define r_0 return 0; #define ll long long #define pb push_back #define TIME ios_base::sync_with_stdio(0) using namespace std; vector<int> V, L; vector<string> Ans; map<int, int> M; set<ll> S; set<char>::iterator it; ll n, m, a, b, c, d, e, f, x, y, z, t, l = ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
225
#include <iostream> #include <map> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> a(n); map<int, int> m; for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]] = 1; } int ans = 0, mn = 1e9; for (int i = -100; i <= 100; i++) { if (m[i] != 1) { if ...
#include <iostream> #include <map> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> a(n); map<int, int> m; for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]] = 1; } int ans = 0, mn = 1e9; for (int i = -100; i <= 103; i++) { if (m[i] != 1) { if ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
148
import sys from math import floor,ceil,sqrt # import bisect # from collections import deque # from types import GeneratorType # def bootstrap(func, stack=[]): # def wrapped_function(*args, **kwargs): # if stack: # return func(*args, **kwargs) # else: # call = func(*args, **k...
import sys from math import floor,ceil,sqrt # import bisect # from collections import deque # from types import GeneratorType # def bootstrap(func, stack=[]): # def wrapped_function(*args, **kwargs): # if stack: # return func(*args, **kwargs) # else: # call = func(*args, **k...
[["-", 0, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 0, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
415
// hmmmm ...coool #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define int long long #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define pb push_back #def...
// hmmmm ...coool #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define int long long #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define pb push_back #def...
[["-", 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
389
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define M_PIl 3.141592653589793238462643383279502884 using namespace std; typedef long long ll; typedef long double ld; int main() { ll x, n; cin >> x >> ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define M_PIl 3.141592653589793238462643383279502884 using namespace std; typedef long long ll; typedef long double ld; int main() { ll x, n; cin >> x >> ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
181
#include <bits/stdc++.h> using namespace std; typedef long long int li; typedef long double ld; typedef vector<li> vi; typedef pair<li, li> pi; #define PB push_back #define MP make_pair #define F first #define S second #define B begin() #define E end() #define f(i, l, r) for (li i = l; i <= r; ++i) #define fr(i, l, r...
#include <bits/stdc++.h> using namespace std; typedef long long int li; typedef long double ld; typedef vector<li> vi; typedef pair<li, li> pi; #define PB push_back #define MP make_pair #define F first #define S second #define B begin() #define E end() #define f(i, l, r) for (li i = l; i <= r; ++i) #define fr(i, l, r...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 13]]
1
347
import sys from bisect import bisect_left x, n = [int(i) for i in sys.stdin.readline().split()] p_s = [int(i) for i in sys.stdin.readline().split()] candidate = [i for i in range(1,101) if i not in p_s] ind = bisect_left(candidate, x) if ind == len(candidate): print(candidate[-1]) elif x - candidate[ind-1] <= candi...
import sys from bisect import bisect_left x, n = [int(i) for i in sys.stdin.readline().split()] p_s = [int(i) for i in sys.stdin.readline().split()] candidate = [i for i in range(-1000,1000) if i not in p_s] ind = bisect_left(candidate, x) if ind == len(candidate): print(candidate[-1]) elif x - candidate[ind-1] <= ...
[["-", 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, 612]]
5
130
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #in...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #in...
[["-", 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
979
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 9999999999 #define PI 3.14159265359 using namespace std; int main() { int i, j = 0, x, n, ans; cin >> x >> n; if (n ==...
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 9999999999 #define PI 3.14159265359 using namespace std; int main() { int i, j = 0, x, n, ans; cin >> x >> n; if (n ==...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
176
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define mod 1000000007 #define inf 1000000000000000 #define infty 1000000000000000000LL #define md 998244353 #define PI acos(-1.0) #define endl "\n" #define rr return #define br cout << "\n"; long long prime[1000000]; void sieve...
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define mod 1000000007 #define inf 1000000000000000 #define infty 1000000000000000000LL #define md 998244353 #define PI acos(-1.0) #define endl "\n" #define rr return #define br cout << "\n"; long long prime[1000000]; void sieve...
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 68]]
1
705
#include <bits/stdc++.h> int main(void) { int X, N; std::cin >> X >> N; std::vector<int> a(N); if (N == 0) { std::cout << X << std::endl; return 0; } else { for (int i = 0; i < N; i++) { std::cin >> a[i]; } } if (std::find(a.begin(), a.end(), X) != a.end()) { std::cout << X <<...
#include <bits/stdc++.h> int main(void) { int X, N; std::cin >> X >> N; std::vector<int> a(N); if (N == 0) { std::cout << X << std::endl; return 0; } else { for (int i = 0; i < N; i++) { std::cin >> a[i]; } } if (std::find(a.begin(), a.end(), X) != a.end()) { } else { std::...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45]]
1
245
x,n = map(int,input().split()) if n == 0: print(x) exit(0) inp = list(map(int,input().split())) a = [] for i in range(1,113): if i not in inp: a.append(i) res = 0 minn = 1e5 for i in a: if abs(i-x) < minn: minn = abs(i-x) res = i print(res)
x,n = map(int,input().split()) if n == 0: print(x) exit(0) inp = list(map(int,input().split())) a = [] for i in range(-100,113): if i not in inp: a.append(i) res = 0 minn = 1e5 for i in a: if abs(i-x) < minn: minn = abs(i-x) res = i print(res)
[["-", 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]]
5
108
// c++ テンプレ #include <bits/stdc++.h> using namespace std; typedef long long llint; typedef long double ld; #define inf 1e18 #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> Que; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return...
// c++ テンプレ #include <bits/stdc++.h> using namespace std; typedef long long llint; typedef long double ld; #define inf 1e18 #define mod 1000000007 priority_queue<llint, vector<llint>, greater<llint>> que; priority_queue<llint> Que; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
250
#!/usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(): return...
#!/usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(): return...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
381
#include <bits/stdc++.h> using namespace std; int main() { int X, N, atai, M = 0, M2 = 0; cin >> X >> N; vector<int> p(N + 1); bool dekita = false; p.at(0) = 0; for (int i = 0; i < N; i++) { cin >> p.at(i); } if (p.at(0) == 0) { dekita = true; atai = X; } sort(p.begin(), p.end()); fo...
#include <bits/stdc++.h> using namespace std; int main() { int X, N, atai, M = 0, M2 = 0; cin >> X >> N; vector<int> p(N + 1); bool dekita = false; p.at(0) = 0; for (int i = 0; i < N; i++) { cin >> p.at(i); } if (p.at(0) == 0) { dekita = true; atai = X; } sort(p.rbegin(), p.rend()); ...
[["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]]
1
287
#include "bits/stdc++.h" using namespace std; bool isList[105]; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int p; for (int i = 0; i < N; i++) { cin >> p; isList[p] = true; } int max_val = 999999; int ans = 0; for (int i = 0; i <= 101; i++)...
#include "bits/stdc++.h" using namespace std; bool isList[105]; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int p; for (int i = 0; i < N; i++) { cin >> p; isList[p] = true; } int max_val = 999999; int ans = 0; for (int i = 0; i <= 101; i++)...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
148
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include ...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
328
from bisect import bisect_left,bisect x,N,*p = map(int,open(0).read().split()) dif = 300 near = 300 all_ = set(range(0,101)) for i in p: d = abs(i - x) if dif > d: dif = d near = i left = list(all_ - set(p)) dif2 = 300 near = 300 for i in left: d = abs(x-i) if d < near: ...
from bisect import bisect_left,bisect x,N,*p = map(int,open(0).read().split()) dif = 300 near = 300 all_ = set(range(0,102)) for i in p: d = abs(i - x) if dif > d: dif = d near = i left = list(all_ - set(p)) dif2 = 300 near = 300 for i in left: d = abs(x-i) if d < near: ...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
116
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <climits> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include ...
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <climits> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33]]
1
243
x, n = map(int, input().split()) if n == 0: print(x) else: P = set(map(int, input().split())) NP = [i for i in range(0, 102) if i not in P] mx = 100 for p in NP: if abs(x-p) < abs(x-mx): mx = p print(mx)
x, n = map(int, input().split()) if n == 0: print(x) else: P = set(map(int, input().split())) NP = [i for i in range(0, 102) if i not in P] mx = 102 for p in NP: if abs(x-p) < abs(x-mx): mx = p print(mx)
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
93
#include <bits/stdc++.h> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) \ for (__typeof__((s).begin()...
#include <bits/stdc++.h> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) \ for (__typeof__((s).begin()...
[["-", 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
664
/*------------------GZ:-)------------------*/ //#pragma GCC optimize "trapv" #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; // find_by_order(k) returns iterator to kth element starting from 0; // order_of_ke...
/*------------------GZ:-)------------------*/ //#pragma GCC optimize "trapv" #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; // find_by_order(k) returns iterator to kth element starting from 0; // order_of_ke...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
632
x, n = map(int, input().split()) if n == 0: print(x) P = set(map(int, input().split())) d_min = 1000 ans = 1000 for num in range(-1, 102): if num in P: continue d = abs(x-num) if d < d_min: d_min = d ans = num print(ans)
x, n = map(int, input().split()) if n == 0: print(x) exit() P = set(map(int, input().split())) d_min = 1000 ans = 1000 for num in range(-1, 102): if num in P: continue d = abs(x-num) if d < d_min: d_min = d ans = num print(ans)
[["+", 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, 25]]
5
88
#include <algorithm> #include <iostream> using namespace std; bool isThere(int arr[], int len, int x) { for (int i = 0; i < len; i++) { if (x == arr[i]) return true; } return false; } int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } int arr[n]; for ...
#include <algorithm> #include <iostream> using namespace std; bool isThere(int arr[], int len, int x) { for (int i = 0; i < len; i++) { if (x == arr[i]) return true; } return false; } int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } int arr[n]; 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
189
from sys import stdin import sys import math import random from decimal import Decimal X, N = [int(x) for x in stdin.readline().rstrip().split()] if N == 0: print(X) sys.exit() p = list(map(int, input().split())) ans = 10**9 ans1 = [0, 10**9] for i in range(-100, 101): if i not in p: if ans > a...
from sys import stdin import sys import math import random from decimal import Decimal X, N = [int(x) for x in stdin.readline().rstrip().split()] if N == 0: print(X) sys.exit() p = list(map(int, input().split())) ans = 10**9 ans1 = [X, 10**9] for i in range(-100, 105): if i not in p: if ans ...
[["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
165
import sys import numpy as np import math from collections import deque from functools import reduce # input = sys.stdin.readline x, y = map(int, input().split()) if y == 0: print(x) exit() p = [list(map(int, input().split()))] p_n = np.array(p) p_n = p_n.reshape(-1) pp = np.arange(0, 101) for i in p_n: p...
import sys import numpy as np import math from collections import deque from functools import reduce # input = sys.stdin.readline x, y = map(int, input().split()) if y == 0: print(x) exit() p = [list(map(int, input().split()))] p_n = np.array(p) p_n = p_n.reshape(-1) pp = np.arange(0, 102) for i in p_n: p...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
150
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func scanInt() int { sc.Scan() iv, _ := strconv.Atoi(sc.Text()) return iv } func init() { sc.Split(bufio.ScanWords) } func abs(x int) int { if x < 0 { return -x } return x } func main() { x, n := scanInt(), scan...
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func scanInt() int { sc.Scan() iv, _ := strconv.Atoi(sc.Text()) return iv } func init() { sc.Split(bufio.ScanWords) } func abs(x int) int { if x < 0 { return -x } return x } func main() { x, n := scanInt(), scan...
[["-", 8, 196, 0, 7, 0, 430, 15, 16, 12, 433], ["+", 8, 196, 0, 7, 0, 430, 15, 16, 12, 433]]
7
229
x, n, *P = map(int, open(0).read().split()) A = list(range(102)) P = set(P) B = [] m = 10**4 for a in A: if a not in P: if abs(x-a) < m: m = abs(x-a) B.append((m, a)) print(min([k for v, k in B if v == B[0][0]]))
x, n, *P = map(int, open(0).read().split()) A = list(range(102)) P = set(P) B = [] m = 10**4 for a in A: if a not in P: if abs(x-a) < m: m = abs(x-a) B.append((m, a)) B.sort() print(min([k for v, k in B if v == B[0][0]]))
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
112
x, n = input().split() x = int(x) n = int(n) if n==0: print(x) else: p = list(map(int, input().split())) ans = -1 mn = 10000 for i in range(1, 101): if(p.count(i) == 0): d = x - i if d<0: d = -d if d<mn: ans = i mn = d print(ans)
x, n = input().split() x = int(x) n = int(n) if n==0: print(x) else: p = list(map(int, input().split())) ans = -1 mn = 10000 for i in range(0, 102): if(p.count(i) == 0): d = x - i if d<0: d = -d if d<mn: ans = i mn = d print(ans)
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
109
#include <bits/stdc++.h> #include <cmath> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; if (N != 0) { for (int i = 0; i < N; i++) { cin >> p[i]; } } int min = 10000; int ans = 0; if (N == 0) { cout << X << endl; } else { for (int i = -5; i <= 100; i++) {...
#include <bits/stdc++.h> #include <cmath> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; if (N != 0) { for (int i = 0; i < N; i++) { cin >> p[i]; } } int min = 10000; int ans = 0; if (N == 0) { cout << X << endl; } else { for (int i = 0; i <= 101; i++) { ...
[["-", 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
181
import sys # from collections import deque # from collections import Counter # from math import sqrt # from math import log # from math import ceil # def gcd(a, b): # if(a==0): # return b # return gcd(b%a,a) # def sieve(n): # prime=[True for i in range(n+1)] # p=2 # while(p*p<=n): # if (prime[p]==True): ...
import sys # from collections import deque # from collections import Counter # from math import sqrt # from math import log # from math import ceil # def gcd(a, b): # if(a==0): # return b # return gcd(b%a,a) # def sieve(n): # prime=[True for i in range(n+1)] # p=2 # while(p*p<=n): # if (prime[p]==True): ...
[["-", 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
193
/* Author : Jeff Ahn Sun 14 Jun 2020 01:37:23 PM PDT */ #include <bits/stdc++.h> using namespace std; #define rep(i, r) for (int i = 0; i < (r); i++) #define pb push_back #define ALL(a) a.begin(), a.end() #define fastio \ ios::sync_with_stdio(0);...
/* Author : Jeff Ahn Sun 14 Jun 2020 01:37:23 PM PDT */ #include <bits/stdc++.h> using namespace std; #define rep(i, r) for (int i = 0; i < (r); i++) #define pb push_back #define ALL(a) a.begin(), a.end() #define fastio \ ios::sync_with_stdio(0);...
[["-", 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, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
454
//============================================================================ // Name : template.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <...
//============================================================================ // Name : template.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
302
#include "math.h" #include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <typeinfo> #include <vector> using namespace std; // Forbidden List //* int main() { int x, n, pp, ppp = 1000, sa = 1000; vector<int> p; cin...
#include "math.h" #include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <typeinfo> #include <vector> using namespace std; // Forbidden List //* int main() { int x, n, pp, ppp = 1000, sa = 1000; vector<int> p; cin...
[["-", 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
183
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { ll n, x; cin >> x >> n; ll a[n]; if (n == 0) cout << 0; else { for (int i = 0; i < n; i++) cin >> a[i]; int cnt = 0, flag = 0, ans; for (int j = 0;; j++) { int temp1 = x - j; int temp2 = x + j; ...
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { ll n, x; cin >> x >> n; ll a[n]; if (n == 0) cout << x; else { for (int i = 0; i < n; i++) cin >> a[i]; int cnt = 0, flag = 0, ans; for (int j = 0;; j++) { int temp1 = x - j; int temp2 = x + j; ...
[["-", 8, 9, 0, 57, 64, 1, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
201
#include <bits/stdc++.h> #define ADD(a, b) a = (a + ll(b)) % mod #define MUL(a, b) a = (a * ll(b)) % mod #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) #define rep(i, a, b) for (int i = int(a); i < int(b); i++) #define rer(i, a, b) for (int i = int(a) - 1; i >= int(b); i--) #define all(a) (a).begin(), ...
#include <bits/stdc++.h> #define ADD(a, b) a = (a + ll(b)) % mod #define MUL(a, b) a = (a * ll(b)) % mod #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) #define rep(i, a, b) for (int i = int(a); i < int(b); i++) #define rer(i, a, b) for (int i = int(a) - 1; i >= int(b); i--) #define all(a) (a).begin(), ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
649
#include <cmath> #include <iostream> using namespace std; const int MAX = 101; int main() { int x, n; int p[MAX] = {0}; cin >> x >> n; if (n == 0) { printf("%d\n", x); return 0; } int temp; for (int i = 0; i < n; ++i) { cin >> temp; ++p[temp]; } int check; int diff; int min =...
#include <cmath> #include <iostream> using namespace std; const int MAX = 120; int main() { int x, n; int p[MAX] = {0}; cin >> x >> n; if (n == 0) { printf("%d\n", x); return 0; } int temp; for (int i = 0; i < n; ++i) { cin >> temp; ++p[temp]; } int check; int diff; int min =...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 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
180
/*** ***Fresher*** Md Mahfujur Rahman Khan(So..a;) Dept. of CSE CSE-28 Batch JU-48 Batch Jahangirnagar University FSTREAM ***/ #include <algorithm> #include <array> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <fu...
/*** ***Fresher*** Md Mahfujur Rahman Khan(So..a;) Dept. of CSE CSE-28 Batch JU-48 Batch Jahangirnagar University FSTREAM ***/ #include <algorithm> #include <array> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <fu...
[["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33]]
1
419
#include <bits/stdc++.h> using namespace std; int main() { set<int> s; int x, n; cin >> x >> n; for (int i = -100; i <= 100; ++i) s.insert(i); for (int i = 0; i < n; ++i) { int z; cin >> z; s.erase(z); } auto p = s.lower_bound(x); auto p2 = p; if (s.begin() != p2) p2--; i...
#include <bits/stdc++.h> using namespace std; int main() { set<int> s; int x, n; cin >> x >> n; for (int i = -200; i <= 200; ++i) s.insert(i); for (int i = 0; i < n; ++i) { int z; cin >> z; s.erase(z); } auto p = s.lower_bound(x); auto p2 = p; if (s.begin() != p2) p2--; 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
148
x, n = list(map(int, input().split())) if not n: print(x) else: l = list(map(int, input().split())) dic = {} for ll in l: dic[ll] = 1 i = 1 while True: if not dic.get(x-i,0): print(x-i) break elif not dic.get(x+i, 0): print(x+i) break i+=1
x, n = list(map(int, input().split())) if not n: print(x) else: l = list(map(int, input().split())) dic = {} for ll in l: dic[ll] = 1 i = 0 while True: if not dic.get(x-i,0): print(x-i) break elif not dic.get(x+i, 0): print(x+i) break i+=1
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
110
/// apigs property #include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp[555555], a[555555], k, l, m, n, o, p; map<ll, ll> mp; vector<ll> adj[555555]; const ll mod = 1e9 + 7; int main() { cin >> m >> n; for (ll i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } k = 1e5; for (ll i = 1;...
/// apigs property #include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp[555555], a[555555], k, l, m, n, o, p; map<ll, ll> mp; vector<ll> adj[555555]; const ll mod = 1e9 + 7; int main() { cin >> m >> n; for (ll i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } k = 1e5; for (ll i = 0;...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
162
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int X, N; cin >> X >> N; unordered_set<int> s; for (int i = 0; i < N; ++i) { int x; cin >> x, s.insert(x); } int mins = 1e9, ans; for (int i = -100; i <= 100; ++i) { int x = abs(i - X); if (!s.count(i)) { ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int X, N; cin >> X >> N; unordered_set<int> s; for (int i = 0; i < N; ++i) { int x; cin >> x, s.insert(x); } int mins = 1e9, ans; for (int i = -105; i <= 105; ++i) { int x = abs(i - X); if (!s.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, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
131
#abc170 x, n = map(int, input().split()) ln = [] if n == 0: pass else: ln = list(map(int, input().split())) i = 0 while i < 5: if (x-i in ln) == False: print(x-i) break elif (x+i in ln) == False: print(x+i) break else: i +=1
#abc170 x, n = map(int, input().split()) ln = [] if n == 0: pass else: ln = list(map(int, input().split())) i = 0 while True: if (x-i in ln) == False: print(x-i) break elif (x+i in ln) == False: print(x+i) break else: i +=1
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 0, 22], ["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["-", 36, 36, 0, 656, 0, 52, 15, 666, 0, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 15, 146]]
5
95
#include <bits/stdc++.h> #define fios \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define sf(x) scanf("%d", &x) #define sfl(x) scanf("%lld", &x) #define pf(x) printf("%d\n", x) #define pfl(x) printf("%...
#include <bits/stdc++.h> #define fios \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define sf(x) scanf("%d", &x) #define sfl(x) scanf("%lld", &x) #define pf(x) printf("%d\n", x) #define pfl(x) printf("%...
[["-", 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
180
#include <math.h> #include <stdio.h> int main() { int x, n; scanf("%d%d", &x, &n); if (n == 0) printf("%d", x); else { int p[101], pp[101]; int menor_num = 101; int maior_num = 0; int cont = 0; for (int i = 0; i < n; ++i) { scanf("%d", &p[i]); } for (int j = 0; j < n; +...
#include <math.h> #include <stdio.h> int main() { int x, n; scanf("%d%d", &x, &n); if (n == 0) printf("%d", x); else { int p[101], pp[101]; int menor_num = 101; int maior_num = 0; int cont = 0; for (int i = 0; i < n; ++i) { scanf("%d", &p[i]); } for (int j = 0; j < n; +...
[["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
0
316
from sys import stdin input_num = stdin.readline().strip().split(" ") X = int(input_num[0]) N = int(input_num[1]) num_list = [] if N != 0: num_list = [int(x) for x in stdin.readline().strip().split(" ")] dec_num = X inc_num = X if N == 0: print(X) elif X not in num_list: print(X) else: while True: ...
from sys import stdin input_num = stdin.readline().strip().split(" ") X = int(input_num[0]) N = int(input_num[1]) num_list = [] if N != 0: num_list = [int(x) for x in stdin.readline().strip().split(" ")] dec_num = X inc_num = X if N == 0: print(X) elif X not in num_list: print(X) else: while True: ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
135
#include <iostream> #include <set> #define u unsigned #define s short #define ll long long #define REP(i, a, b) for (auto i = (a); i < (b); i++) #define REPR(i, a, b) for (auto i = (a - 1); i >= (b); i--) using namespace std; int solve(int X, set<int> nums) { u int min = -1, result = 0; REPR(i, X + 1, *nums.beg...
#include <iostream> #include <set> #define u unsigned #define s short #define ll long long #define REP(i, a, b) for (auto i = (a); i < (b); i++) #define REPR(i, a, b) for (auto i = (a - 1); i >= (b); i--) using namespace std; int solve(int X, set<int> nums) { u int min = -1, result = 0; REPR(i, X + 1, *nums.beg...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
254
// NAME-ADITYYA OJHA /* GURU(MENTOR)-AARADHYA */ /* * Heart beats fast * Colors and promises * How to be brave * How can I love when I am afraid to fall... (courtesy-amnesiac_dusk) */ #include <bits/stdc++.h> #define ll lo...
// NAME-ADITYYA OJHA /* GURU(MENTOR)-AARADHYA */ /* * Heart beats fast * Colors and promises * How to be brave * How can I love when I am afraid to fall... (courtesy-amnesiac_dusk) */ #include <bits/stdc++.h> #define ll lo...
[["-", 0, 30, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 36, 36, 0, 30, 0, 7, 15, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 7, 15, 16, 12, 13]]
1
258
#include <bits/stdc++.h> using namespace std; #define ll long long int #define set_bits(a) __builtin_popcount(a) #define pb push_back #define pf push_front #define mod 1000000007 #define M 998244353 #define fi first #define se second #define endl '\n' #define INF 1e18 #define PI 3.14159265358979323846 #define fast ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define set_bits(a) __builtin_popcount(a) #define pb push_back #define pf push_front #define mod 1000000007 #define M 998244353 #define fi first #define se second #define endl '\n' #define INF 1e18 #define PI 3.14159265358979323846 #define fast ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
268
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, x; cin >> x >> n; set<int> p; for (int i = 1; i <= n; i++) { int y; cin >> y; p.insert(y); } int val = 1e6; int num; for (int i = -100; i <= 100; i++) { if (p.find(i) == p.end()) { if (va...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, x; cin >> x >> n; set<int> p; for (int i = 1; i <= n; i++) { int y; cin >> y; p.insert(y); } int val = 1e6; int num; for (int i = -200; i <= 200; i++) { if (p.find(i) == p.end()) { if (va...
[["-", 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
135
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ll long long #define endl '\n' using namespace std; using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; int main() { ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ll long long #define endl '\n' using namespace std; using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; int main() { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
191
def main(): import sys def input(): return sys.stdin.readline().rstrip() x,n = map(int, input().split()) p = list(map(int, input().split())) l = [abs(i-x) if i not in p else 102 for i in range(101)] ans = l.index(min(l)) print(ans) if __name__ == '__main__': main()
def main(): import sys def input(): return sys.stdin.readline().rstrip() x,n = map(int, input().split()) p = list(map(int, input().split())) l = [abs(i-x) if i not in p else 103 for i in range(102)] ans = l.index(min(l)) print(ans) if __name__ == '__main__': main()
[["-", 0, 1, 0, 662, 12, 658, 8, 41, 0, 612], ["+", 0, 1, 0, 662, 12, 658, 8, 41, 0, 612], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
106
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fst first #define snd second using namespace std; typedef long long ll; typedef double db; typedef long double ldb; template <class T> inline void checkmin(T &a, const T &b) { if (b < a) a = b; } template <class T> inline void checkmax(T...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fst first #define snd second using namespace std; typedef long long ll; typedef double db; typedef long double ldb; template <class T> inline void checkmin(T &a, const T &b) { if (b < a) a = b; } template <class T> inline void checkmax(T...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 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
268
#include <bits/stdc++.h> using namespace std; using UL = unsigned int; using ULL = unsigned long long; using LL = long long; #define rep(i, n) for (UL i = 0; i < (n); i++) int main() { UL X; cin >> X; UL N; cin >> N; set<UL> P; rep(i, N) { UL p; cin >> p; P.insert(p); } for (UL i = 0;; i++)...
#include <bits/stdc++.h> using namespace std; using UL = unsigned int; using ULL = unsigned long long; using LL = long long; #define rep(i, n) for (UL i = 0; i < (n); i++) int main() { UL X; cin >> X; UL N; cin >> N; set<UL> P; rep(i, N) { UL p; cin >> p; P.insert(p); } for (UL i = 0;; i++)...
[["-", 51, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, ...
1
147
x,n = gets.split.map(&:to_i) return puts x if n == 0 p = gets.split.map(&:to_i) a = [*1..100].map {|n| n unless p.include? n }.compact! p a.min_by{|n| (n-x).abs}
x,n = gets.split.map(&:to_i) return puts x if n == 0 p = gets.split.map(&:to_i) a = [*-1..101].map {|n| n unless p.include? n }.compact! p a.min_by{|n| (n-x).abs}
[["+", 486, 516, 0, 741, 0, 475, 756, 748, 17, 33], ["-", 486, 652, 486, 516, 0, 741, 0, 475, 444, 612], ["+", 486, 652, 486, 516, 0, 741, 0, 475, 444, 612]]
4
70
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> oset; #define sim template <class c #defi...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> oset; #define sim template <class c #defi...
[["-", 63, 2, 3, 4, 0, 42, 0, 11, 12, 13], ["+", 63, 2, 3, 4, 0, 42, 0, 11, 12, 13], ["-", 63, 2, 3, 4, 0, 42, 0, 16, 12, 13], ["+", 63, 2, 3, 4, 0, 42, 0, 16, 12, 13]]
1
511
#include <cstdio> #include <iostream> #include <string> #include <unordered_map> #include <vector> #define task "" using namespace std; using ll = long long; using ld = long double; const int N = 1e5 + 2; int n, x; bool ck[N]; vector<int> a; void Read() { cin >> x >> n; while (n--) { int a; cin >> a; ...
#include <cstdio> #include <iostream> #include <string> #include <unordered_map> #include <vector> #define task "" using namespace std; using ll = long long; using ld = long double; const int N = 1e5 + 2; int n, x; bool ck[N]; vector<int> a; void Read() { cin >> x >> n; while (n--) { int a; cin >> a; ...
[["-", 0, 16, 12, 23, 0, 41, 15, 16, 17, 47], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 17, 20]]
1
226
x,n=map(int,input().split()) if n!=0: p=list(map(int,input().split())) p2=map(lambda s:s-x,p) a=0 i=0 if n==0: print(x) else: while a==0: if i in p2: if i==0: i=-1 elif i>0: i=-1*(i+1) else: i=-1*i else: print(x+i) a=1 break
x,n=map(int,input().split()) if n!=0: p=list(map(int,input().split())) p2=list(map(lambda s:s-x,p)) a=0 i=0 if n==0: print(x) else: while a==0: if i in p2: if i==0: i=-1 elif i>0: i=-1*(i+1) else: i=-1*i else: print(x+i) a=1 break
[["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
122
#include <bits/stdc++.h> using namespace std; #define int long long #define vi vector<int> #define ff first #define ss second #define file_se_input \ freopen("input.txt", "r", stdin); \ freopen("output.txt", "w", std...
#include <bits/stdc++.h> using namespace std; #define int long long #define vi vector<int> #define ff first #define ss second #define file_se_input \ freopen("input.txt", "r", stdin); \ freopen("output.txt", "w", std...
[["-", 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
497
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <stdio.h> using namespace std; using ll = long long; int main() { cin.tie(0); int x, n; vector<int> tempResult; cin >> x >> n; int p[100]; if (n == 0) { cout << x; return 0; } for (int i = 1; i <= n; i++) { cin >> p...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <stdio.h> using namespace std; using ll = long long; int main() { cin.tie(0); int x, n; vector<int> tempResult; cin >> x >> n; int p[110]; if (n == 0) { cout << x; return 0; } for (int i = 1; i <= n; i++) { cin >> p...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
212
#include <bits/stdc++.h> using namespace std; long long int power(long long int x, long long int y) { long long int res = 1; // Initialize result // x=x; while (y > 0) { // If y is odd, multiply x with result if (y & 1) res = (res * x); // y must be even now y = y >> ...
#include <bits/stdc++.h> using namespace std; long long int power(long long int x, long long int y) { long long int res = 1; // Initialize result // x=x; while (y > 0) { // If y is odd, multiply x with result if (y & 1) res = (res * x); // y must be even now y = y >> ...
[["-", 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
521
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; } else { int ans = 0; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 1; i < 101; i++) { int count = 0; ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; } else { int ans = 0; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } for (int i = 0; i < 102; i++) { int count = 0; ...
[["-", 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
168
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int fre[101] = {0}; int mi = 101, ma = -1; if (n == 0) { cout << x; return 0; } for (int i = 0; i < n; i++) { int y; cin >> y; fre[y]++; if (mi > y) mi = y; if (ma < y) ma = y; } ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int fre[102] = {0}; int mi = 101, ma = -1; if (n == 0) { cout << x; return 0; } for (int i = 0; i < n; i++) { int y; cin >> y; fre[y]++; if (mi > y) mi = y; if (ma < y) ma = 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
177
#include <bits/stdc++.h> 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; for (int i = 0; i < n + 2; i++) { int num = x; bool isSame = false; if (i % 2 == 0) { num += (i / 2); } else { ...
#include <bits/stdc++.h> 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; for (int i = 0; i < n + 2; i++) { int num = x; bool isSame = false; if (i % 2 == 0) { num -= (i / 2); } else { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 110], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107]]
1
175
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; set<int> st; while (n--) { int i; cin >> i; st.insert(i); } int ans = 0; int dmin = 0x3f3f3f3f; for (int i = 1; i <= 101; i++) { if (dmin > abs(i - x) && st.count(i) == 0) { dmin = abs(i - x); ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; set<int> st; while (n--) { int i; cin >> i; st.insert(i); } int ans = 0; int dmin = 0x3f3f3f3f; for (int i = 0; i <= 101; i++) { if (dmin > abs(i - x) && st.count(i) == 0) { dmin = abs(i - x); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
118
#include <bits/stdc++.h> using namespace std; int search(int arr[], int n, int key) { for (int i = 0; i < n; i++) { if (arr[i] == key) return 0; } return 1; } int main() { int x, n, i; cin >> x >> n; int arr[n]; for (i = 0; i < n; i++) cin >> arr[i]; int min = INT_MAX, value = 0; for (...
#include <bits/stdc++.h> using namespace std; int search(int arr[], int n, int key) { for (int i = 0; i < n; i++) { if (arr[i] == key) return 0; } return 1; } int main() { int x, n, i; cin >> x >> n; int arr[n]; for (i = 0; i < n; i++) cin >> arr[i]; int min = INT_MAX, value = 0; for (...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
173
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() const long long mod = 1e9 + 7; ////////////////////////////////// int main() { int x, n; cin >> x >> n; set<int> s; int p; for (int i = 0; i < n; i++) { cin >> p; s.insert(p); } int d = 1e9; int ans = -1; for...
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() const long long mod = 1e9 + 7; ////////////////////////////////// int main() { int x, n; cin >> x >> n; set<int> s; int p; for (int i = 0; i < n; i++) { cin >> p; s.insert(p); } int d = 1e9; int ans = -1; for...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
154
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <set> #include <utility> #include <vector> using namespace std; void forbidden_list(vector<int> v, int x); int main() { int x, n; vector<int> v; cin >> x >> n; for (int i = 0; i < n; i++) { int l; cin >> l; v.push_back(l); } ...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <set> #include <utility> #include <vector> using namespace std; void forbidden_list(vector<int> v, int x); int main() { int x, n; vector<int> v; cin >> x >> n; for (int i = 0; i < n; i++) { int l; cin >> l; v.push_back(l); } ...
[["-", 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, 17, 18], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
283
X, N = map(int, input().split()) if N==0: print(X) else: p = list(map(int, input().split())) for i in range(1,102): down = X - i up = X + i if down in p and up in p: pass elif down in p: temp = up break else: temp =...
X, N = map(int, input().split()) if N==0: print(X) else: p = list(map(int, input().split())) for i in range(0,102): down = X - i up = X + i if down in p and up in p: pass elif down in p: temp = up break else: temp =...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
93
x,n = [int(i) for i in input().split()] if n == 0: print(x) exit() p = [int(i) for i in input().split()] num = list(range(1,101)) nums = [] for i in num: if not(i in p): nums.append(i) #print(nums) p2 = [abs(nums[i]-x) for i in range(len(nums))] p2min = min(p2) for i in range(len(p2)): if p2[i] == p2min: ...
x,n = [int(i) for i in input().split()] if n == 0: print(x) exit() p = [int(i) for i in input().split()] num = list(range(102)) nums = [] for i in num: if not(i in p): nums.append(i) #print(nums) p2 = [abs(nums[i]-x) for i in range(len(nums))] p2min = min(p2) for i in range(len(p2)): if p2[i] == p2min: ...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
143
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" void solve(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); /*#ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif*/ int t = 1; // cin>>t; whi...
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" void solve(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); /*#ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif*/ int t = 1; // cin>>t; whi...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22]]
1
244