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> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(con...
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; template <typename T> struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(con...
[["-", 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
373
// clang-format off #include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; #define SFINAE(x, ...) template <class, class = void> struct x : false_type {}; template <class T> struct x<T, void_t<__VA_ARGS__>> : true_type {}; SFINAE(DefaultIO, decltype(cout << declval<T &>())) ...
// clang-format off #include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; #define SFINAE(x, ...) template <class, class = void> struct x : false_type {}; template <class T> struct x<T, void_t<__VA_ARGS__>> : true_type {}; SFINAE(DefaultIO, decltype(cout << declval<T &>())) ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
1
706
def examA(): X = LI() for i in range(len(X)): if X[i]==0: ans = i+1 print(ans) return def examB(): X, Y = LI() ans = "No" for i in range(X+1): if i*2+(X-i)*4==Y: ans = "Yes" print(ans) return def examC(): X, N = LI() P = LI() P = ...
def examA(): X = LI() for i in range(len(X)): if X[i]==0: ans = i+1 print(ans) return def examB(): X, Y = LI() ans = "No" for i in range(X+1): if i*2+(X-i)*4==Y: ans = "Yes" print(ans) return def examC(): X, N = LI() P = LI() P = ...
[["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
474
def main(): X, N = map(int, input().split()) if N == 0: return X p = list(map(int, input().split())) p = set(p) ans = 1 l = float('inf') for i in range(1, 102): if i not in p and abs(i-X) < l: l = abs(i-X) ans = i return ans if __name__ == '__main__':...
def main(): X, N = map(int, input().split()) if N == 0: return X p = list(map(int, input().split())) p = set(p) ans = 1 l = float('inf') for i in range(-1, 102): if i not in p and abs(i-X) < l: l = abs(i-X) ans = i return ans if __name__ == '__main__'...
[["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33]]
5
113
import sys input=lambda: sys.stdin.readline().rstrip() x,n=map(int,input().split()) P=set([int(i) for i in input().split()]) ans=0 for i in range(1,101): if i in P: continue else: if abs(i-x)<abs(ans-x): ans=i print(ans)
import sys input=lambda: sys.stdin.readline().rstrip() x,n=map(int,input().split()) P=set([int(i) for i in input().split()]) ans=0 for i in range(1,102): if i in P: continue else: if abs(i-x)<abs(ans-x): ans=i print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
97
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define ll long long using namespace std; // typedef vector<unsigned int>vec; // typedef vector<ll>vec; // typedef vector<vec> mat; typedef pair<int, int> P; typedef pair<ll, ll> LP; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define ll long long using namespace std; // typedef vector<unsigned int>vec; // typedef vector<ll>vec; // typedef vector<vec> mat; typedef pair<int, int> P; typedef pair<ll, ll> LP; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {...
[["-", 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
347
// ~zaletaet~ #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/rope> #define fi first #define se second #define sz(x) int(x.size()) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define pb push_bac...
// ~zaletaet~ #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/rope> #define fi first #define se second #define sz(x) int(x.size()) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define pb push_bac...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
500
#include <bits/stdc++.h> using namespace std; #define int long long #define f(i, x, n) for (int i = x; i < n; i++) #define all(c) c.begin(), c.end() const int MOD = 1e9 + 7, N = 5e5 + 10; const int LINF = LLONG_MAX; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, x; cin >> x >> n; ve...
#include <bits/stdc++.h> using namespace std; #define int long long #define f(i, x, n) for (int i = x; i < n; i++) #define all(c) c.begin(), c.end() const int MOD = 1e9 + 7, N = 5e5 + 10; const int LINF = LLONG_MAX; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, x; cin >> x >> n; ve...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
189
#include <cmath> #include <iostream> #include <set> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int x, n; set<int> s; cin >> x >> n; while (n--) { int y; cin >> y; s.insert(y); } int m = 10000, ans = 100000; for (int i = 100; i >= 1; i--) if (s.count(i) ...
#include <cmath> #include <iostream> #include <set> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int x, n; set<int> s; cin >> x >> n; while (n--) { int y; cin >> y; s.insert(y); } int m = 10000, ans = 100000; for (int i = 101; i >= -101; i--) if (s.count(...
[["-", 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
141
x,n=map(int,input().split()) if n>0: p=list(map(int,input().split())) p=set(p) mini=10**10 ans=0 for i in range(101): if i not in p: if abs(i-x)<mini: mini=abs(i-x) ans=i print(ans) else: print(x)
x,n=map(int,input().split()) if n>0: p=list(map(int,input().split())) p=set(p) mini=10**10 ans=0 for i in range(102): if i not in p: if abs(i-x)<mini: mini=abs(i-x) ans=i print(ans) else: print(x)
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
97
#include <bits/stdc++.h> using namespace std; #define M 200005 #define MOD 1000000007 #define PI 3.14159265358979323846 #define ep emplace_back #define mk make_pair #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() typedef long long int lli; typedef unsigned long long int ulli; typedef pa...
#include <bits/stdc++.h> using namespace std; #define M 200005 #define MOD 1000000007 #define PI 3.14159265358979323846 #define ep emplace_back #define mk make_pair #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() typedef long long int lli; typedef unsigned long long int ulli; typedef pa...
[["-", 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
210
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD 998244353 #define rep(i, a, b) for (ll i = a; i < b; ++i) #define rrep(i, a, b) for (ll i = a; i > b; --i) #define vi vector<int> #define vl vector<ll> #define ld long double #define vvi vector<vector<int>> #define vvl vector<vector<long...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD 998244353 #define rep(i, a, b) for (ll i = a; i < b; ++i) #define rrep(i, a, b) for (ll i = a; i > b; --i) #define vi vector<int> #define vl vector<ll> #define ld long double #define vvi vector<vector<int>> #define vvl vector<vector<long...
[["-", 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
359
X,N = map(int,input().split()) if N>0: p = list(map(int,input().split())) ans = [] for i in range(100): ans.append(X-i) ans.append(X+i) import sys for j in ans: if j not in p: print(j) sys.exit()
X,N = map(int,input().split()) if N>0: p = list(map(int,input().split())) else: p = [] ans = [] for i in range(100): ans.append(X-i) ans.append(X+i) import sys for j in ans: if j not in p: print(j) sys.exit()
[["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 634, 0, 70], ["+", 8, 196, 0, 1, 0, 662, 12, 634, 0, 73]]
5
88
# ANSHUL GAUTAM # IIIT-D from math import * from copy import * # ll = deepcopy(l) from heapq import * # heappush(hp,x) from string import * # alpha = ascii_lowercase from random import * # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference from bisect import * # bisect_left(arr,x,st...
# ANSHUL GAUTAM # IIIT-D from math import * from copy import * # ll = deepcopy(l) from heapq import * # heappush(hp,x) from string import * # alpha = ascii_lowercase from random import * # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference from bisect import * # bisect_left(arr,x,st...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
183
#include <bits/stdc++.h> using namespace std; int a[1000]; int main() { int x, n; cin >> x >> n; for (int i = 1; i <= n; ++i) { int y; cin >> y; a[y] = 1; } int ans = 1e9, pos; for (int i = 1; i <= 110; ++i) if (abs(i - x) < ans && !a[i]) { ans = abs(i - x); pos = i; } co...
#include <bits/stdc++.h> using namespace std; int a[1000]; int main() { int x, n; cin >> x >> n; for (int i = 1; i <= n; ++i) { int y; cin >> y; a[y] = 1; } int ans = 1e9, pos; for (int i = 0; i <= 110; ++i) if (abs(i - x) < ans && !a[i]) { ans = abs(i - x); pos = i; } co...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
119
x,n = map(int,input().split()) if n==0: print(x) else: p = list(map(int,input().split())) p.sort() if not(x in p): print(p) else: i=1 while True: if not(x-i in p): print(x-i) break elif not(x+i in p): pri...
x,n = map(int,input().split()) if n==0: print(x) else: p = list(map(int,input().split())) p.sort() if not(x in p): print(x) else: i=1 while True: if not(x-i in p): print(x-i) break elif not(x+i in p): pri...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
108
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007 #define maxx ((ll)1e6 + 5) #define zuciso \ ios::sync_with_stdio(0); \ cin.tie(0); ...
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007 #define maxx ((ll)1e6 + 5) #define zuciso \ ios::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120], ["+", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120]]
1
554
x, n = map(int, input().split()) if n == 0: print(x) exit() P = list(map(int, input().split())) for s in range(-101, 101): if s not in P: ans = s break for s in range(-101, 101): if s not in P: if abs(ans-x) > abs(s-x): ans = s elif abs(ans-x) == abs(s-x): ...
x, n = map(int, input().split()) if n == 0: print(x) exit() P = list(map(int, input().split())) for s in range(-101, 110): if s not in P: ans = s break for s in range(-101, 110): if s not in P: if abs(ans-x) > abs(s-x): ans = s elif abs(ans-x) == abs(s-x): ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
128
#include "bits/stdc++.h" #define DEBUG(x) cout << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cout << #v << ":"; \ for (int i = 0; i < v.size(); i++) \ ...
#include "bits/stdc++.h" #define DEBUG(x) cout << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cout << #v << ":"; \ for (int i = 0; i < v.size(); i++) \ ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
286
#include <bits/stdc++.h> using namespace std; int main() { int x, n; int a[114] = {}; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int p = lower_bound(a, a + n, x) - a; int c = 1; while (true) { if (!binary...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; int a[114] = {}; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int p = lower_bound(a, a + n, x) - a; int c = 0; while (true) { if (!binary...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
169
#pragma comment(linker, "/stack:16777216") #include <algorithm> #include <bitset> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <iomanip> #include <iost...
#pragma comment(linker, "/stack:16777216") #include <algorithm> #include <bitset> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <iomanip> #include <iost...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
384
#include "bits/stdc++.h" using namespace std; using ll = long long; #define print(n) cout << n << endl #define rep(i, a, n) for (ll i = a; i < n; i++) #define ALL(s) s.begin(), s.end() #define P pair<ll, ll> #define vl vector<ll> #define vi vector<int> #define vvl vector<vector<ll>> #define vvi vector<vector<int>> cons...
#include "bits/stdc++.h" using namespace std; using ll = long long; #define print(n) cout << n << endl #define rep(i, a, n) for (ll i = a; i < n; i++) #define ALL(s) s.begin(), s.end() #define P pair<ll, ll> #define vl vector<ll> #define vi vector<int> #define vvl vector<vector<ll>> #define vvi vector<vector<int>> cons...
[["-", 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]]
1
824
def main(sample_file = ''): """ convenient functions # for i, a in enumerate(iterable) # q, mod = divmod(a, b) # divmod(x, y) returns the tuple (x//y, x%y) # Higher-order function: reduce(operator.mul, xyz_count, 1) # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc...
def main(sample_file = ''): """ convenient functions # for i, a in enumerate(iterable) # q, mod = divmod(a, b) # divmod(x, y) returns the tuple (x//y, x%y) # Higher-order function: reduce(operator.mul, xyz_count, 1) # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
2,335
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; map<int, int> mp; for (int i = 0; i < n; ++i) { int p; cin >> p; mp[p]++; } int ans; int sa = 300; for (int i = -100; i <= 100; ++i) { if (mp[i] == 0) { int cal = abs(x - i); if (cal < sa) { ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; map<int, int> mp; for (int i = 0; i < n; ++i) { int p; cin >> p; mp[p]++; } int ans; int sa = 300; for (int i = -100; i <= 120; ++i) { if (mp[i] == 0) { int cal = abs(x - i); if (cal < sa) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
130
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long #define ld lo...
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long #define ld lo...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
1,226
#include <bits/stdc++.h> //#include <boost/array.hpp> //#include <boost/range/numeric.hpp> //#include <boost/range/algorithm.hpp> //#include <boost/multiprecision/cpp_int.hpp> #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; // using name...
#include <bits/stdc++.h> //#include <boost/array.hpp> //#include <boost/range/numeric.hpp> //#include <boost/range/algorithm.hpp> //#include <boost/multiprecision/cpp_int.hpp> #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; // using name...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
439
#include <bits/stdc++.h> using namespace std; const int N = 105; int x, n, arr[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> x >> n; for (int i = 1; i <= n; i++) { int a; cin >> a; arr[a] = 1; } int ans = -1; int fmin = 1000000; for (int i = -100; i...
#include <bits/stdc++.h> using namespace std; const int N = 105; int x, n, arr[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> x >> n; for (int i = 1; i <= n; i++) { int a; cin >> a; arr[a] = 1; } int ans = -1; int fmin = 1000000; for (int i = 0; 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
163
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); l...
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using ll = long long; using P = pair<ll, ll>; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); l...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
168
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll x, n, a[1000], l, r, fl, i, j; cin >> x >> n; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0;; i++) { l = x + i; r = x - i; fl = 1; for (j = 0; j ...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll x, n, a[1000], l, r, fl, i, j; cin >> x >> n; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0;; i++) { l = x + i; r = x - i; fl = 1; for (j = 0; j ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
206
#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 sz size() #define bgn begin() #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 sz size() #define bgn begin() #define en end() #defin...
[["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
3,154
#include <bits/stdc++.h> #include <time.h> #define F(i, a, b) for (long long i = a; i <= (b); ++i) #define dF(i, a, b) for (long long i = a; i >= (b); --i) #define inf 0x3f3f3f3f #define infll 0x3f3f3f3f3f3f3f3f #define pb push_back #define maxnkp make_pair #define fi first #define se second #define eps 1e-10 #define P...
#include <bits/stdc++.h> #include <time.h> #define F(i, a, b) for (long long i = a; i <= (b); ++i) #define dF(i, a, b) for (long long i = a; i >= (b); --i) #define inf 0x3f3f3f3f #define infll 0x3f3f3f3f3f3f3f3f #define pb push_back #define maxnkp make_pair #define fi first #define se second #define eps 1e-10 #define P...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
199
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = 0; i <= (n); i++) using namespace std; typedef long long ll; const int MOD = 1000000007; const ll INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; re...
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = 0; i <= (n); i++) using namespace std; typedef long long ll; const int MOD = 1000000007; const ll INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; re...
[["-", 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
305
x , n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int,input().split())) mi = 200 for i in range(102): if not i in p: d1 = abs(x-i) if d1<mi and d1!=0: ans = i mi = min(d1,mi) print(ans)
x , n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int,input().split())) mi = 200 for i in range(102): if not i in p: d1 = abs(x-i) if d1<mi: ans = i mi = min(d1,mi) print(ans)
[["-", 0, 57, 64, 196, 0, 57, 15, 679, 17, 355], ["-", 64, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["-", 64, 196, 0, 57, 15, 679, 12, 666, 667, 79], ["-", 64, 196, 0, 57, 15, 679, 12, 666, 0, 612]]
5
93
#import numpy as np #import math X, N = map(int, input().split()) if N != 0: P = list(map(int, input().split())) # a,b=map(int, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき # c=list(map(int, input().split())) #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき # s=[list(map(int,list(input()))) for i in range(h)] ...
#import numpy as np #import math X, N = map(int, input().split()) if N != 0: P = list(map(int, input().split())) # a,b=map(int, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき # c=list(map(int, input().split())) #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき # s=[list(map(int,list(input()))) for i in range(h)] ...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
96
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef pair<int, int> PI; typedef pair<ll, ll> PL; using graph = vector<vector<int>>; const double pi = 3.14159265358979323846; const ll mod = 1000000007; int main() { cin.tie(0); ios::sync_with_stdi...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; typedef pair<int, int> PI; typedef pair<ll, ll> PL; using graph = vector<vector<int>>; const double pi = 3.14159265358979323846; const ll mod = 1000000007; int main() { cin.tie(0); ios::sync_with_stdi...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
203
#include <algorithm> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long ...
#include <algorithm> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long ...
[["-", 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
357
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; #define int long long int int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); set<int> st; int j; for (j = -100; j <= 100; j++) st.insert(j); int answer = 100000000; int x, n; ...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <vector> using namespace std; #define int long long int int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); set<int> st; int j; for (j = -500; j <= 500; j++) st.insert(j); int answer = 100000000; int x, n; ...
[["-", 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
175
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define xx first #define yy second #define vi vector<int> #define pii pair<int, int> #define all(v) v.begin(), v.end() #define MAX 400005 int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll x, n, p; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define xx first #define yy second #define vi vector<int> #define pii pair<int, int> #define all(v) v.begin(), v.end() #define MAX 400005 int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll x, n, p; ...
[["-", 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
176
#include <bits/stdc++.h> using namespace std; #define ll long long int #define endl "\n" #define F first #define S second #define def(x) cerr << #x << " is " << x << endl; #define mod 1000000007 #define pb push_back #define FOR(i, a, n) for (int i = a; i < n; i++) #define ios ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define endl "\n" #define F first #define S second #define def(x) cerr << #x << " is " << x << endl; #define mod 1000000007 #define pb push_back #define FOR(i, a, n) for (int i = a; i < n; i++) #define ios ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
251
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> V; #define rep(cnt, e) for (ll cnt = 0; cnt < e; cnt++) #define allsort(X) sort(X.begin(), X.end()) typedef pair<ll, ll> P; const ll mod = 1e9 + 7; const ll INF = INT64_MAX; ll i, j, k; int main() { ll X, N; cin >> X >> N; V...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> V; #define rep(cnt, e) for (ll cnt = 0; cnt < e; cnt++) #define allsort(X) sort(X.begin(), X.end()) typedef pair<ll, ll> P; const ll mod = 1e9 + 7; const ll INF = INT64_MAX; ll i, j, k; int main() { ll X, N; cin >> X >> N; V...
[["-", 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; typedef long long ll; typedef vector<long long> vll; typedef vector<pair<int, int>> vpi; typedef vector<pair<long long, long long>> vpl; typedef pair<int, int> pii; typedef pair<long long, long long> pll; #define INF (int)(1e9) #define MAXX 1.1529215e+18 #define inf 999999 ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<long long> vll; typedef vector<pair<int, int>> vpi; typedef vector<pair<long long, long long>> vpl; typedef pair<int, int> pii; typedef pair<long long, long long> pll; #define INF (int)(1e9) #define MAXX 1.1529215e+18 #define inf 999999 ...
[["-", 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
430
x,y=map(int,input().split()) if y==0: print(x) exit(0) s=list(map(int,input().split())) res=100 mn=110 for n in range(1,110): if n not in s: v=abs(x-n) if v<res: res=v mn=n print(mn)
x,y=map(int,input().split()) if y==0: print(x) exit(0) s=list(map(int,input().split())) res=100 mn=110 for n in range( 110): if n not in s: v=abs(x-n) if v<res: res=v mn=n print(mn)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
91
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1}; vector<int> dy = {-1, 0, 1, -1, 1, -...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(), v.rend() vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1}; vector<int> dy = {-1, 0, 1, -1, 1, -...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
206
################################################### # # # author: raghav_0901 (Raghav Dalmia) # # updated on: Sunday, 14-06-2020, 17:41:34 pm # # # ################################################### from ma...
################################################### # # # author: raghav_0901 (Raghav Dalmia) # # updated on: Sunday, 14-06-2020, 17:43:43 pm # # # ################################################### from ma...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
135
#ifdef __APPLE__ #include <algorithm> #include <cmath> #include <ctgmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #else #include <bits...
#ifdef __APPLE__ #include <algorithm> #include <cmath> #include <ctgmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #else #include <bits...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
453
#include <bits/stdc++.h> #include <iomanip> #define M 100000 #define MAX 1000000001 #define MIN -100000000 #define mod 998244353 #define ss second #define ff first #define ll long long int #define pb push_back #define ld double #define fast \ ios_base:...
#include <bits/stdc++.h> #include <iomanip> #define M 100000 #define MAX 1000000001 #define MIN -100000000 #define mod 998244353 #define ss second #define ff first #define ll long long int #define pb push_back #define ld double #define fast \ ios_base:...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
186
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33]]
1
297
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define int long long constexpr long long INF = numeric_limits<long long>::max() / 2; constexpr int MOD = 1000000007; using Graph = vector<vector<int>>; signed main() { cin.tie(nullptr...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define PI 3.14159265358979323846 #define int long long constexpr long long INF = numeric_limits<long long>::max() / 2; constexpr int MOD = 1000000007; using Graph = vector<vector<int>>; signed main() { cin.tie(nullptr...
[["-", 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
209
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vll = vector<ll>; using vi = vector<int>; using vb = vector<bool>; using vs = vector<string>; using pll = pair<ll, ll>; using pii = pair<int, int>; using vpii = vector<pii>; using vpll = vector<pll>; const ll LIN...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vll = vector<ll>; using vi = vector<int>; using vb = vector<bool>; using vs = vector<string>; using pll = pair<ll, ll>; using pii = pair<int, int>; using vpii = vector<pii>; using vpll = vector<pll>; const ll LIN...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
1,782
#include <bits/stdc++.h> using namespace std; int main() { int x, n; int ans, min; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } ans = 10000; min = 10000; bool flg; for (int i = 1; i <= 100; i++) { flg = false; for (int j = 0; j < n; j++) { if (i == ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; int ans, min; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } ans = 10000; min = 10000; bool flg; for (int i = 0; i <= 101; i++) { flg = false; for (int j = 0; j < n; j++) { if (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
170
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <list> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> // #include "boost/algorithm...
#include <algorithm> #include <bits/stdc++.h> #include <bitset> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <list> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <unordered_map> #include <vector> // #include "boost/algorithm...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
566
// AtCoder template #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; ++i) int main() { cin.tie(0); ios::sync_with_stdio(false); int x, n; cin >> x >> n; int p[n]; rep(i, n) cin >> p[i]; int dif = 200, ans; for (int i = 0; i <= 100; ++i) { ...
// AtCoder template #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; ++i) int main() { cin.tie(0); ios::sync_with_stdio(false); int x, n; cin >> x >> n; int p[n]; rep(i, n) cin >> p[i]; int dif = 200, ans = 0; for (int i = 0; i <= 101; ++i) {...
[["+", 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, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
162
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ull = unsigned long long int; #define vll vector<ll> #define FOR(i, b, e) for (int i = (b); i < (e); ++i) #define REP(i, e) FOR(i, 0, e) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define RE...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ull = unsigned long long int; #define vll vector<ll> #define FOR(i, b, e) for (int i = (b); i < (e); ++i) #define REP(i, e) FOR(i, 0, e) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define RE...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
235
#include <cmath> #include <iostream> using namespace std; int main() { int x, n, in; bool p[102]; int i, j, ans; cin >> x >> n; for (i = 0; i < 102; i++) { p[i] = true; } for (i = 0; i < n; i++) { cin >> in; p[in] = false; } ans = 0; int sa = x; for (i = 0; i <= 100; i++) { if (p...
#include <cmath> #include <iostream> using namespace std; int main() { int x, n, in; bool p[102]; int i, j, ans; cin >> x >> n; for (i = 0; i < 102; i++) { p[i] = true; } for (i = 0; i < n; i++) { cin >> in; p[in] = false; } ans = 0; int sa = x; for (i = 0; i <= 101; i++) { if (p...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
154
X,N = (int(x) for x in input().split()) ans = 10000 ansnum = -3 if (N > 0): p = list(map(int, input().strip().split())) for i in range(-1,100): preans = abs(X-i) if(preans < ans) and (i in p ) == False: ans = preans ansnum = i print(ansnum) else: print(X)
X,N = (int(x) for x in input().split()) ans = 10000 ansnum = -3 if (N > 0): p = list(map(int, input().strip().split())) for i in range(-1,102): preans = abs(X-i) if(preans < ans) and (i in p ) == False: ans = preans ansnum = i print(ansnum) else: print(X)
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
105
#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; map<int, int> map; rep(i, N) { int p; cin >> p; map[p] = 1; } if (N == 0) { cout << X << endl; return 0; ...
#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; map<int, int> map; rep(i, N) { int p; cin >> p; map[p] = 1; } if (N == 0) { cout << X << endl; return 0; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
158
// header {{{ // header {{{ using namespace std; #include <bits/stdc++.h> #include <set> #define CPP_STR(x) CPP_STR_I(x) #define CPP_CAT(x, y) CPP_CAT_I(x, y) #define CPP_STR_I(args...) #args #define CPP_CAT_I(x, y) x##y #define ASSERT(expr...) assert((expr)) using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t...
// header {{{ // header {{{ using namespace std; #include <bits/stdc++.h> #include <set> #define CPP_STR(x) CPP_STR_I(x) #define CPP_CAT(x, y) CPP_CAT_I(x, y) #define CPP_STR_I(args...) #args #define CPP_CAT_I(x, y) x##y #define ASSERT(expr...) assert((expr)) using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
722
#include <algorithm> #include <cstdio> using namespace std; int P[105]; int main() { int X, N; scanf("%d%d", &X, &N); for (int i = 0; i < N; i++) scanf("%d", &P[i]); sort(P, P + N + 1); for (int i = 0;; i++) { if (!binary_search(P, P + N + 1, X - i)) { printf("%d\n", X - i); break; ...
#include <algorithm> #include <cstdio> using namespace std; int P[105]; int main() { int X, N; scanf("%d%d", &X, &N); for (int i = 0; i < N; i++) scanf("%d", &P[i]); sort(P, P + N); for (int i = 0;; i++) { if (!binary_search(P, P + N, X - i)) { printf("%d\n", X - i); break; } els...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 51, 91, 28, 2, 3, 4, 0, 16, 17, 72], ["-", 51, 91, 28, 2, 3, 4, 0, 16, 12, 13]]
1
161
#include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <map>...
#include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #include <map>...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
321
#include <bits/stdc++.h> using namespace std; #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define fastio \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ...
[["-", 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
415
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define repto(i, n) for (int i = 0; i <= (n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define _1 first #define _2 second #...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define repto(i, n) for (int i = 0; i <= (n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define _1 first #define _2 second #...
[["-", 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
235
#include <algorithm> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> //#include "All.h" using namespace std; typedef long long int l...
#include <algorithm> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> //#include "All.h" using namespace std; typedef long long int l...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 22], ["+", 36, 36, 0, 30, 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
255
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; bool P[105] = {}; for (int i = 0; i < N; ++i) { int x; cin >> x; P[x] = true; } int Min = INT_MAX, MinP = INT_MAX; for (int i = 0; i <= 100; ++i) { if (P[i]) continue; int tmp = abs(i - X); ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; bool P[300] = {}; for (int i = 0; i < N; ++i) { int x; cin >> x; P[x] = true; } int Min = INT_MAX, MinP = INT_MAX; for (int i = 0; i <= 300; ++i) { if (P[i]) continue; int tmp = abs(i - X); ...
[["-", 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
128
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline x, n = map(int, input().split()) p = list(map(int, input().split())) arr = [] for i in range(1, 101): if not i in p: arr.append(i) ans = arr[0] for ai in arr: if abs(ai - x) < abs...
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline x, n = map(int, input().split()) p = list(map(int, input().split())) arr = [] for i in range(-100, 201): if not i in p: arr.append(i) ans = arr[0] for ai in arr: if abs(ai - x) < ...
[["-", 8, 196, 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], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
124
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll inf = 1000000007; int check[100005] = {}; int p[100005]; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll inf = 1000000007; int check[100005] = {}; int p[100005]; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
242
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define Rep(i, n) for (intl i = 0; i < (intl)(n); i++) #define Rep1(i, n) for (intl i = 1; i < (intl)(n) + 1; i++) #define vec vector #define fi first #define se second #define pub push_back #define pob pop_back #define SortA(v) sort(v.begin(), v.end(...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define Rep(i, n) for (intl i = 0; i < (intl)(n); i++) #define Rep1(i, n) for (intl i = 1; i < (intl)(n) + 1; i++) #define vec vector #define fi first #define se second #define pub push_back #define pob pop_back #define SortA(v) sort(v.begin(), v.end(...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
279
import sys stdin = sys.stdin sys.setrecursionlimit(10**6) ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) nn = lambda: list(stdin.readline().split()) ns = lambda: stdin.readline().rstrip() x,n = na() p = na() q = [i for i in range(-1,101) if i not in p] r = [] for i in range(len(q)): ...
import sys stdin = sys.stdin sys.setrecursionlimit(10**6) ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) nn = lambda: list(stdin.readline().split()) ns = lambda: stdin.readline().rstrip() x,n = na() p = na() q = [i for i in range(-1,102) if i not in p] r = [] for i in range(len(q)): ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
175
# coding: utf-8 import sys # from operator import itemgetter sysread = sys.stdin.readline read = sys.stdin.read sys.setrecursionlimit(10 ** 7) #from heapq import heappop, heappush #from collections import defaultdict # import math # from itertools import product, accumulate, combinations, product # import bisect# lower...
# coding: utf-8 import sys # from operator import itemgetter sysread = sys.stdin.readline read = sys.stdin.read sys.setrecursionlimit(10 ** 7) #from heapq import heappop, heappush #from collections import defaultdict # import math # from itertools import product, accumulate, combinations, product # import bisect# lower...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
145
x, n = map(int, input().split()) if n == 0: print(x) exit() pn = list(map(int, input().split())) ls = [i for i in range(101)] for i in pn: ls[i] = 0 ls = list(set(ls)) ans = 0 m = 10**5 for j in ls: if abs(x - j) < m: m = abs(x - j) ans = j print(ans)
x, n = map(int, input().split()) if n == 0: print(x) exit() pn = list(map(int, input().split())) ls = [i for i in range(102)] for i in pn: ls[i] = 0 ls = list(set(ls)) ans = 0 m = 10**5 for j in ls: if abs(x - j) < m: m = abs(x - j) ans = j print(ans)
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
115
#include <bits/stdc++.h> #define ll long long #define endl '\n' using namespace std; #define N 100007 #define pb push_back; vector<ll> v[N]; vector<bool> vs(N); #define FAST \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define ll long long #define endl '\n' using namespace std; #define N 100007 #define pb push_back; vector<ll> v[N]; vector<bool> vs(N); #define FAST \ ios_base::sync_with_stdio(false); ...
[["-", 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
223
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
#include "algorithm" #include "bitset" #include "cassert" #include "climits" #include "cmath" #include "cstdio" #include "ctime" #include "functional" #include "iomanip" #include "iostream" #include "list" #include "map" #include "numeric" #include "queue" #include "random" #include "set" #include "stack" #include "str...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
246
#include <algorithm> #include <bitset> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <sstream> #include <stack> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; std::vector<int> p; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; p.p...
#include <algorithm> #include <bitset> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <sstream> #include <stack> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; std::vector<int> p; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; p.p...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
244
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int mod = 1000000000 + 7; int main() { int x, n; cin >> x >> n; int p[n]; rep(i, n) cin >> p[i]; int min = mod, flag, ans = 0; for (int i = -3; i <= 100; i++) { flag = 0; rep(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int mod = 1000000000 + 7; int main() { int x, n; cin >> x >> n; int p[n]; rep(i, n) cin >> p[i]; int min = mod, flag, ans = 0; for (int i = -3; i <= 101; i++) { flag = 0; rep(...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
155
X, N = map(int, input().split()) if N != 0: P = [int(i) for i in input().split()] else: P = [] m = float("inf") ans = 0 l = set(range(-100, 101)) - set(P) for p in sorted(l): d = abs(p-X) if d < m: m = d ans = p print(ans)
X, N = map(int, input().split()) if N != 0: P = [int(i) for i in input().split()] else: P = [] m = float("inf") ans = 0 l = set(range(-1000, 1001)) - set(P) for p in sorted(l): d = abs(p-X) if d < m: m = d ans = p print(ans)
[["-", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["-", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
104
/* * atcoder/abc170/c.cpp */ // C++ 14 #include <algorithm> #include <cassert> #include <cmath> #include <cstring> // memset #include <iostream> #include <vector> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) template <class T> ostream &operat...
/* * atcoder/abc170/c.cpp */ // C++ 14 #include <algorithm> #include <cassert> #include <cmath> #include <cstring> // memset #include <iostream> #include <vector> using namespace std; #define ll long long #define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++) template <class T> ostream &operat...
[["-", 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 <bits/stdc++.h> using namespace std; int n, x; const int N = 1e5 + 7; int main() { std ::ios ::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> x >> n; if (n == 0) { cout << x << endl; exit(0); } vector<int> vt(n); for (int i = 0; i < n; ++i) cin >> vt[i]; sort(vt.begin(...
#include <bits/stdc++.h> using namespace std; int n, x; const int N = 1e5 + 7; int main() { std ::ios ::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> x >> n; if (n == 0) { cout << x << endl; exit(0); } vector<int> vt(n); for (int i = 0; i < n; ++i) cin >> vt[i]; sort(vt.begin(...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
217
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() using ll = long long; using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); rep(i, n) cin >> p[i]; int mn = 1000, ans; rep(i, 101) { if (count(all(p), i)) contin...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() using ll = long long; using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); rep(i, n) cin >> p[i]; int mn = 1000, ans; rep(i, 102) { if (count(all(p), i)) contin...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
126
X, N = map(int, input().split()) if N == 0: print(X) exit() p = list(map(int, input().split())) ans = -float('inf') d = float('inf') for i in range(-10, 101): if i not in p: if abs(X-i) < d: d = abs(X-i) ans = i print(ans)
X, N = map(int, input().split()) if N == 0: print(X) exit() p = list(map(int, input().split())) ans = -float('inf') d = float('inf') for i in range(-10, 2100): if i not in p: if abs(X-i) < d: d = abs(X-i) ans = i print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
104
#include <bits/stdc++.h> using namespace std; #define T top() #define E end() #define PS push #define Q queue #define PP pop() #define L0 (LL)0 #define V vector #define ST stack #define FI first #define MAX 4e18 #define MIN -MAX #define DQ deque #define RE rend() #define SZ size() #define C clear() #define B begin() #d...
#include <bits/stdc++.h> using namespace std; #define T top() #define E end() #define PS push #define Q queue #define PP pop() #define L0 (LL)0 #define V vector #define ST stack #define FI first #define MAX 4e18 #define MIN -MAX #define DQ deque #define RE rend() #define SZ size() #define C clear() #define B begin() #d...
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
418
X,N=map(int, input().split()) if N==0: print(X) exit() P=list(map(int, input().split())) ans=-1 for i in range(-1,101): if i not in P: if abs(X-i)<abs(X-ans): ans=i print(ans)
X,N=map(int, input().split()) if N==0: print(X) exit() P=list(map(int, input().split())) ans=-1 for i in range(-1,102): if i not in P: if abs(X-i)<abs(X-ans): ans=i print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
88
#include <bits/stdc++.h> using namespace std; #define ___ ios::sync_with_stdio(0), cin.tie(0); #define dbg(a) cerr << __LINE__ << ": " << #a << " = " << a << '\n' typedef long long ll; int ache[102]; int main() { ___ int x, n; cin >> x >> n; for (int i = 0; i < n; ++i) { int p; cin >> p; ache[p] = ...
#include <bits/stdc++.h> using namespace std; #define ___ ios::sync_with_stdio(0), cin.tie(0); #define dbg(a) cerr << __LINE__ << ": " << #a << " = " << a << '\n' typedef long long ll; int ache[102]; int main() { ___ int x, n; cin >> x >> n; for (int i = 0; i < n; ++i) { int p; cin >> p; ache[p] = ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
139
def resolve(): X, N = [int(i) for i in input().split()] if N == 0: print(X) return P = sorted([int(i) for i in input().split()]) if X not in P: print(X) for i in range(100): if (X - i) not in P: print(X - i) return if (X + i) not in P: ...
def resolve(): X, N = [int(i) for i in input().split()] if N == 0: print(X) return P = sorted([int(i) for i in input().split()]) if X not in P: print(X) return for i in range(100): if (X - i) not in P: print(X - i) return if (X ...
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
111
x,n=gets.chomp.split(" ").map(&:to_i); n = 0 begin fob_lis = gets.chomp.split(' ').map(&:to_i) rescue fob_lis = [] end lis = [*1..100] lis = lis - fob_lis sa_m = 100000 ans = 0 lis.each do |k| sa = (x - k).abs if sa < sa_m sa_m = sa ans = k end end puts ans
x,n=gets.chomp.split(" ").map(&:to_i); n = 0 begin fob_lis = gets.chomp.split(' ').map(&:to_i) rescue fob_lis = [] end lis = [*0..101] lis = lis - fob_lis sa_m = 100000 ans = 0 lis.each do |k| sa = (x - k).abs if sa < sa_m sa_m = sa ans = k end end puts ans
[["-", 0, 662, 12, 516, 0, 741, 0, 475, 756, 612], ["+", 0, 662, 12, 516, 0, 741, 0, 475, 756, 612], ["-", 0, 662, 12, 516, 0, 741, 0, 475, 444, 612], ["+", 0, 662, 12, 516, 0, 741, 0, 475, 444, 612]]
4
98
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int x, n; cin >> x >> n; vector<int> a(n); set<int> s; for (int i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); } int ans = INT_MAX; int cur = INT_MAX; for (int i = 1; i <= 20000; i++) { if (!s.count(i)) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int x, n; cin >> x >> n; vector<int> a(n); set<int> s; for (int i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); } int ans = INT_MAX; int cur = INT_MAX; for (int i = -200; i <= 20000; i++) { if (!s.count(i)) {...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
142
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define INF 1LL << 60 typedef long long int LL; typedef long long int ll; #define pll pair<ll, ll> #define F first #define S sec...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define INF 1LL << 60 typedef long long int LL; typedef long long int ll; #define pll pair<ll, ll> #define F first #define S sec...
[["-", 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
268
x,n,*a=map(int,open(0).read().split()) b=[1]*101 for i in a: b[i]=0 c=100 ans=0 for i in range(101): if b[i] and c>abs(x-i): c=abs(x-i) ans=i print(ans)
x,n,*a=map(int,open(0).read().split()) b=[1]*103 for i in a: b[i]=0 c=1000 ans=n for i in range(102): if b[i] and c>abs(x-i): c=abs(x-i) ans=i print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
86
#include <bits/stdc++.h> using namespace std; bool ans[101]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= k; i++) { int a; cin >> a; ans[a] = true; } int mi = 100000, cnt; for (int i = 1; i <= 100; i++) { if (ans[i] == true) continue; if (abs(n - i) < mi) { mi =...
#include <bits/stdc++.h> using namespace std; bool ans[103]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= k; i++) { int a; cin >> a; ans[a] = true; } int mi = 100000, cnt = n; for (int i = 0; i <= 102; i++) { if (ans[i] == true) continue; if (abs(n - i) < mi) { ...
[["-", 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, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 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, ...
1
126
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
[["-", 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
316
X, N = list(map(int, input().split())) if N==0: print(X) else: ps = list(map(int, input().split())) sub_abs = 0 while True: if (X-sub_abs) not in ps: print(X-sub_abs) break if (X+sub_abs) not in ps: print(X+sub_abs) sub_abs += 1
X, N = list(map(int, input().split())) if N==0: print(X) else: ps = list(map(int, input().split())) sub_abs = 0 while True: if (X-sub_abs) not in ps: print(X-sub_abs) break if (X+sub_abs) not in ps: print(X+sub_abs) break sub_abs +=...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
89
x, n = map(int, input().split()) if n == 0: print(x) exit() else: p = list(map(int, input().split())) li = [i for i in range(-101, 101) if i not in p] li.sort(reverse = True) tmp1 = float('inf') ans = float('inf') for i in li: if abs(i - x) <= tmp1: if i < ans: ...
x, n = map(int, input().split()) if n == 0: print(x) exit() else: p = list(map(int, input().split())) li = [i for i in range(-101, 102) if i not in p] li.sort(reverse = True) tmp1 = float('inf') ans = float('inf') for i in li: if abs(i - x) <= tmp1: if i < ans: ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
126
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define MOD 1000000007LL #define rep(i, n) for (ll(i) = 0LL; (i) < (ll)(n); (i)++) #define rep2(i, s, e) for (ll(i) = (ll)(s); (i) < (ll)(e); (i)++) #define repi(i, n) for (ll(i) = 0LL; (i) <= ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define MOD 1000000007LL #define rep(i, n) for (ll(i) = 0LL; (i) < (ll)(n); (i)++) #define rep2(i, s, e) for (ll(i) = (ll)(s); (i) < (ll)(e); (i)++) #define repi(i, n) for (ll(i) = 0LL; (i) <= ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
519
#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; #define ordered_set \ tree<int, null_type, less<int>, rb_tree_tag, \ ...
#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; #define ordered_set \ tree<int, null_type, less<int>, rb_tree_tag, \ ...
[["-", 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
917
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 main() { int x, n, i, ind, ans = 100000; cin >> x >> n; int p; map<int, int> mp; for (i = 1; i <= n; i++) { cin >> p; mp[p] = 1; } for (i = 1; i <= 150; i++) { if (mp[i] == 1) { continue; } ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 main() { int x, n, i, ind, ans = 100000; cin >> x >> n; int p; map<int, int> mp; for (i = 1; i <= n; i++) { cin >> p; mp[p] = 1; } for (i = 0; i <= 150; i++) { if (mp[i] == 1) { continue; } ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
139
x,n=map(int,input().split()) if n==0: print(x) else: lst=sorted(map(int,input().split())) dis=200 ans=100 for i in range(101): temp=abs(x-i) if temp<dis and i not in lst: dis=temp ans=i print(ans)
x,n=map(int,input().split()) if n==0: print(x) else: lst=sorted(map(int,input().split())) dis=200 ans=100 for i in range(102): temp=abs(x-i) if temp<dis and i not in lst: dis=temp ans=i print(ans)
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
86
#import sys #import numpy as np import math #import itertools #from fractions import Fraction #import itertools from collections import deque #import heapq #from fractions import gcd #input=sys.stdin.readline #import bisect x,n=map(int,input().split()) if n==0: print(x) exit() p=list(map(int,input().split())) p=se...
#import sys #import numpy as np import math #import itertools #from fractions import Fraction #import itertools from collections import deque #import heapq #from fractions import gcd #input=sys.stdin.readline #import bisect x,n=map(int,input().split()) if n==0: print(x) exit() p=list(map(int,input().split())) p=se...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
168
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; int x, n; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> x >> n; pair<int, int> mn = {INT_MAX, -1}; set<int> inc; for (int i = 1; i ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; int x, n; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> x >> n; pair<int, int> mn = {INT_MAX, -1}; set<int> inc; for (int i = -200;...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
156
#include <bits/stdc++.h> using namespace std; typedef long long ll; main() { // int x,y;cin>>x>>y; // if((y-2*x)>=0&&(y-2*x)%2==0&&(4*x-y)>=0&&(4*x-y)%2==0)puts("Yes"); // else puts("No"); int x, n; cin >> x >> n; map<int, int> m; int a[n]; for (int i = 0; i < n; i++) cin >> a[i], m[a[i]] = 1; sor...
#include <bits/stdc++.h> using namespace std; typedef long long ll; main() { // int x,y;cin>>x>>y; // if((y-2*x)>=0&&(y-2*x)%2==0&&(4*x-y)>=0&&(4*x-y)%2==0)puts("Yes"); // else puts("No"); int x, n; cin >> x >> n; map<int, int> m; int a[n]; for (int i = 0; i < n; i++) cin >> a[i], m[a[i]] = 1; sor...
[["-", 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
170
#include <bits/stdc++.h> #define ll long long #define pb push_back #define st first #define sc second #define mp make_pair using namespace std; const int e = 1e6 + 69; int main() { ll x; int n; cin >> x >> n; map<ll, ll> kt; for (int i = 1; i <= n; i++) { int cur; cin >> cur; kt[cur]++; } ...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define st first #define sc second #define mp make_pair using namespace std; const int e = 1e6 + 69; int main() { ll x; int n; cin >> x >> n; map<ll, ll> kt; for (int i = 1; i <= n; i++) { int cur; cin >> cur; kt[cur]++; } ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
149
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <vector> using namespace std; #define int long long #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; #define ic(n) ...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <vector> using namespace std; #define int long long #define rep(s, i, n) for (int i = s; i < n; i++) #define c(n) cout << n << endl; #define ic(n) ...
[["+", 0, 42, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 42, 0, 2, 3, 4, 0, 16, 12, 13]]
1
1,951
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p_ll; template <class T> void debug(T itr1, T itr2) { auto now = itr1; while (now < itr2) { cout << *now << " "; now++; } cout << endl; } #define repr(i, from, to) for (int i = (int)from; i < (int)to; i++) #define...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p_ll; template <class T> void debug(T itr1, T itr2) { auto now = itr1; while (now < itr2) { cout << *now << " "; now++; } cout << endl; } #define repr(i, from, to) for (int i = (int)from; i < (int)to; i++) #define...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
488