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 ll long long #define pb(a) push_back(a) #define pi pair<int, int> using namespace std; int solveC() { int x, n; cin >> x >> n; vector<int> arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; int ans = 0; map<int, int> mp; for (int a : arr) mp[a] = 1; int i = 1; ...
#include <bits/stdc++.h> #define ll long long #define pb(a) push_back(a) #define pi pair<int, int> using namespace std; int solveC() { int x, n; cin >> x >> n; vector<int> arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; int ans = 0; map<int, int> mp; for (int a : arr) mp[a] = 1; int i = 0; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
175
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } vector<int> v; int num; for (int i = 0; i < n; i++) { cin >> num; v.push_back(num); } sort(v.begin(), v.end()); for (int ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } vector<int> v; int num; for (int i = 0; i < n; i++) { cin >> num; v.push_back(num); } sort(v.begin(), v.end()); for (int ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
182
X,N=map(int,input().split()) if N==0: print(X) exit() P_ori=list(map(int,input().split())) if P_ori.count(X)==0: print(X) exit() P1=sorted(P_ori) N=list(range(1,101)) PZ=[] for i in range(len(N)): if P1.count(N[i])==0: PZ.append(N[i]) PZ.append(X) P2=sorted(PZ) t=P2.index(X) if P2[t]==P2[...
X,N=map(int,input().split()) if N==0: print(X) exit() P_ori=list(map(int,input().split())) if P_ori.count(X)==0: print(X) exit() P1=sorted(P_ori) N=list(range(0,102)) PZ=[] for i in range(len(N)): if P1.count(N[i])==0: PZ.append(N[i]) PZ.append(X) P2=sorted(PZ) t=P2.index(X) if P2[t]==P2...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
249
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> list(110, 0); for (int i = 0; i < N; i++) cin >> list.at(i); if (N == 0) { cout << X << endl; return 0; } bool checkm = 1; bool checkp = 1; int ans = 0; for (int i = 0; i < 110; i++) { c...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> list(110, 0); for (int i = 0; i < N; i++) cin >> list.at(i); if (N == 0) { cout << X << endl; return 0; } bool checkm = 1; bool checkp = 1; int ans = 0; for (int i = 0; i < 110; i++) { c...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
202
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; set<int> st; for (int i = 0; i < n; i++) { int val; cin >> val; st.insert(val); } int mn = INT_MAX, ret = -1; for (int i = 1; i <= 100; i++) { if (st.count(i)) continue; int diff = abs(x - i); ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; set<int> st; for (int i = 0; i < n; i++) { int val; cin >> val; st.insert(val); } int mn = INT_MAX, ret = -1; for (int i = 0; i <= 200; i++) { if (st.count(i)) continue; int diff = abs(x - 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
130
#include <algorithm> #include <bits/stdc++.h> #include <cstdint> #include <iostream> #include <iterator> #include <vector> // lib/util.hpp #ifndef UTIL_HPP #define UTIL_HPP typedef ::std::int_fast64_t i64; typedef ::std::uint_fast64_t u64; typedef ::std::int_fast32_t i32; typedef ::std::uint_fast32_t u32; namespace ...
#include <algorithm> #include <bits/stdc++.h> #include <cstdint> #include <iostream> #include <iterator> #include <vector> // lib/util.hpp #ifndef UTIL_HPP #define UTIL_HPP typedef ::std::int_fast64_t i64; typedef ::std::uint_fast64_t u64; typedef ::std::int_fast32_t i32; typedef ::std::uint_fast32_t u32; namespace ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
422
/*╔═══╗──╔╗╔╗───────────────────╔╗────────╔═══╦═══╗ ║║─║╠╗╠╗╔╣╚═╦══╦═╗╔╦╗╔═╗╔══╦══╣╚═╦╦══╦══╣║─║║║─╚╝ ║╔═╗║╚╝║╚╣║║║╚╝║║─╔╦╗║║║║╚╝║╚╝║╚╝║║║═╬══║╔═╗║╚╩═║ ╚╝─╚╩══╩═╩╝╚╩══╩╝─╚╩╝╚╝╚╩══╩══╩══╩╩══╩══╩╝─╚╩═══╝*/ #include <bits/stdc++.h> using namespace std; #define f(i, k, n) for (i = k; i < n; i++) #define fd(i, k, n)...
/*╔═══╗──╔╗╔╗───────────────────╔╗────────╔═══╦═══╗ ║║─║╠╗╠╗╔╣╚═╦══╦═╗╔╦╗╔═╗╔══╦══╣╚═╦╦══╦══╣║─║║║─╚╝ ║╔═╗║╚╝║╚╣║║║╚╝║║─╔╦╗║║║║╚╝║╚╝║╚╝║║║═╬══║╔═╗║╚╩═║ ╚╝─╚╩══╩═╩╝╚╩══╩╝─╚╩╝╚╝╚╩══╩══╩══╩╩══╩══╩╝─╚╩═══╝*/ #include <bits/stdc++.h> using namespace std; #define f(i, k, n) for (i = k; i < n; i++) #define fd(i, k, n)...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
866
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <vector> std::set<int> s; std::vector<int> v; int x, n, c, ans; int main() { std::cin >> x >> n; for (int i = 0; i <= 100; i++) { s.insert(i); } for (int i = 0; i < n; i++) { std::cin >> c; s.erase(c); ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <vector> std::set<int> s; std::vector<int> v; int x, n, c, ans; int main() { std::cin >> x >> n; for (int i = 0; i <= 101; i++) { s.insert(i); } for (int i = 0; i < n; i++) { std::cin >> c; s.erase(c); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
225
x,n=map(int,input().split()) if n!=0: p=list(map(int,input().split())) hantei=10**9+1 sp=set(p) ans=0 for i in range(1,10000): if not i in sp: if hantei>abs(i-x): hantei=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())) hantei=10**9+1 sp=set(p) ans=0 for i in range(-10000,10000): if not i in sp: if hantei>abs(i-x): hantei=abs(i-x) ans=i print(ans) else: print(x)
[["-", 64, 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]]
5
101
X, N = map(int,input().split()) if N == 0: print(X) else: plist = list(map(int,input().split())) ans = -2000 dist1 = 1000 for i in range(-101,101): dist2 = abs(X-i) if dist2 < dist1 and not(i in plist): ans = i dist1 = dist2 print(ans)
X, N = map(int,input().split()) if N == 0: print(X) else: plist = list(map(int,input().split())) ans = -2000 dist1 = 1000 for i in range(-200,200): dist2 = abs(X-i) if dist2 < dist1 and not(i in plist): ans = i dist1 = dist2 print(ans)
[["-", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
92
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; i++) cin >> p[i]; int ans = 0; int mindiff = 999; for (int i = -100; i <= 100; i++) { bool inp = false; for (int j = 0; j < N; j++) { ...
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; i++) cin >> p[i]; int ans = 0; int mindiff = 999; for (int i = -101; i <= 101; i++) { bool inp = false; for (int j = 0; j < N; j++) { ...
[["-", 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
158
#include <bits/stdc++.h> #include <string> using namespace std; #define ll long long int #define pb push_back #define mod 1000000007 #define all(x) x.begin(), x.end() typedef vector<ll> vll; typedef vector<int> vi; ll modpower(ll a, ll b, ll c) { ll res = 1; while (b) { if (b & 1LL) res = (res * a) % c; ...
#include <bits/stdc++.h> #include <string> using namespace std; #define ll long long int #define pb push_back #define mod 1000000007 #define all(x) x.begin(), x.end() typedef vector<ll> vll; typedef vector<int> vi; ll modpower(ll a, ll b, ll c) { ll res = 1; while (b) { if (b & 1LL) res = (res * a) % c; ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 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]]
1
376
// first second push_back unordered return continue break vector visited check // flag bool while iterator begin end lower_bound upper_bound temp true false // INT_MAX INT_MIN insert erase clear pop push compare INT64_MAX INT64_MIN // reverse replace stringstream string::npos length substr front priority_queue #include...
// first second push_back unordered return continue break vector visited check // flag bool while iterator begin end lower_bound upper_bound temp true false // INT_MAX INT_MIN insert erase clear pop push compare INT64_MAX INT64_MIN // reverse replace stringstream string::npos length substr front priority_queue #include...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
278
# -*- coding: utf-8 -*- def main(): x, n = map(int, input().split()) if n == 0: print(x) return p = list(map(int, input().split())) print(p) check = 0 while(1): s = check//2 if check%2 == 0: ans = x-s else: ans = x+s if ...
# -*- coding: utf-8 -*- def main(): x, n = map(int, input().split()) if n == 0: print(x) return p = list(map(int, input().split())) check = 0 while(1): s = check//2 if check%2 == 0: ans = x-s else: ans = x+s if not ans in p:...
[["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
102
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <utility> #include <vector> #define INF 1e16 #define N (1000000007) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<ll, P> Q; ll s...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <utility> #include <vector> #define INF 1e16 #define N (1000000007) using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<ll, P> Q; ll s...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
213
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */ int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */ int cmp_char(const void *a, const void *b) { return *(char *)...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */ int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */ int cmp_char(const void *a, const void *b) { return *(char *)...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
0
334
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<vector<int>> Matrix; int main() { int x, n; cin >> x >> n; vector<bool> d(101, true); rep(i, n) { int p; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<vector<int>> Matrix; int main() { int x, n; cin >> x >> n; vector<bool> d(102, true); rep(i, n) { int p; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 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
155
#include <bits/stdc++.h> using namespace std; int a[101]; map<int, bool> m; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]] = true; } int y, z; for (int i = x - 1; i >= -100; i--) if (m[i] == false)...
#include <bits/stdc++.h> using namespace std; int a[101]; map<int, bool> m; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]] = true; } int y, z; for (int i = x; i >= -100; i--) if (m[i] == false) { ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
178
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e18; vector<pair<long long, long long>> factorize(long long n) { vector<pair<long long, long long>> a; for (long long i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e18; vector<pair<long long, long long>> factorize(long long n) { vector<pair<long long, long long>> a; for (long long i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { n /= i; cnt++; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
303
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long double ld; typedef set<int>::iterator sit; typedef map<int, int>::iterator mit; typedef vector<int>::iterator vit; const int INF = 1e9 + 7; const int MOD = 1e9 +...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long double ld; typedef set<int>::iterator sit; typedef map<int, int>::iterator mit; typedef vector<int>::iterator vit; const int INF = 1e9 + 7; const int MOD = 1e9 +...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
391
#include <bits/stdc++.h> #include <iostream> #define int long long #define mod 1000000007 #define pb(x) push_back(x) #define gcd(a, b) __gcd(a, b) #define all(v) v.begin(), v.end() #define lcm(a, b) (a * b) / gcd(a, b) #define bits(x) __builtin_popcountll(x) #define fast ...
#include <bits/stdc++.h> #include <iostream> #define int long long #define mod 1000000007 #define pb(x) push_back(x) #define gcd(a, b) __gcd(a, b) #define all(v) v.begin(), v.end() #define lcm(a, b) (a * b) / gcd(a, b) #define bits(x) __builtin_popcountll(x) #define fast ...
[["-", 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
186
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll X, N; cin >> X >> N; vector<bool> b(101, true); vector<ll> p(N); for (ll i = 0; i < N; i++) { cin >> p[i]; b[p[i]] = false; } ll d = 1000; ll ans; for (ll i = 0; i < 101; i++) { if (b[i] && d > abs(X - i))...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll X, N; cin >> X >> N; vector<bool> b(102, true); vector<ll> p(N); for (ll i = 0; i < N; i++) { cin >> p[i]; b[p[i]] = false; } ll d = 1000; ll ans; for (ll i = 0; i < 102; i++) { if (b[i] && d > abs(X - i))...
[["-", 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, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
142
#include <bits/stdc++.h> using namespace std; #define ft \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); int a[202]; int ...
#include <bits/stdc++.h> using namespace std; #define ft \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); int a[202]; int ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
135
#include <bits/stdc++.h> typedef long long LL; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <typename Container> bool include(const Container &c, const typename Container::value_type &v) { return (c.end() != std::find(c.begin(), c.end(), v)); } using namespace std; int main() { int X, N; cin >>...
#include <bits/stdc++.h> typedef long long LL; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template <typename Container> bool include(const Container &c, const typename Container::value_type &v) { return (c.end() != std::find(c.begin(), c.end(), v)); } using namespace std; int main() { int X, N; cin >>...
[["-", 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
195
#include <bits/stdc++.h> #define int long long using namespace std; int a[105]; bool f[105]; signed main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; f[a[i]] = true; } for (int i = 0; i <= n; i++) { if (!f[n - i]) { cout << n - i << endl; return 0; } else...
#include <bits/stdc++.h> #define int long long using namespace std; int a[105]; bool f[105]; signed main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a[i]; f[a[i]] = true; } for (int i = 0; i <= n; i++) { if (!f[n - i]) { cout << n - i << endl; return 0; } else...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
139
X,N = map(int,input().split()) if N == 0: print(X) else: p = list(map(int,input().split())) if X not in p: print(X) else: n = [x for x in range(101)] for i in p: n.remove(i) ans = 0 a = 101 b = -1 for j in n: b += 1 if abs(j-X) < a: a=abs...
X,N = map(int,input().split()) if N == 0: print(X) else: p = list(map(int,input().split())) if X not in p: print(X) else: n = [x for x in range(102)] for i in p: n.remove(i) ans = 0 a = 101 b = -1 for j in n: b += 1 if abs(j-X) < a: a=abs(...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
125
#include <bits/stdc++.h> using namespace std; int main() { int x, n, mind = 1000, ans = 100; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = -100; i <= 100; i++) { if (count(p.begin(), p.end(), i) == 0) { int d = abs(x - i); if (mind > d) { mi...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, mind = 1000, ans = 100; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = 0; i <= 101; i++) { if (count(p.begin(), p.end(), i) == 0) { int d = abs(x - i); if (mind > d) { mind ...
[["-", 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 = map(int, input().split()) if n == 0: print(x) exit() P = list(map(int, input().split())) t = 101 for i in range(101): if not i in P: if t > abs(i - x): t = abs(i - x) ans = i print(ans)
x, n = map(int, input().split()) if n == 0: print(x) exit() P = list(map(int, input().split())) t = 100 for i in range(0,102): if not i in P: if t > abs(i - x): t = abs(i - x) ans = i print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
87
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N; cin >> X >> N; int p; int arrP[101] = {}; for (int i = 0; i < N; i++) { cin >> p; arrP[p]++; } int minDiff = X; int ans = 0; for (int i = 1; i < 101; i++) { if (arrP[i] == 0) { if (minDiff > abs(X - i)) { ...
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N; cin >> X >> N; int p; int arrP[102] = {}; for (int i = 0; i < N; i++) { cin >> p; arrP[p]++; } int minDiff = X; int ans = 0; for (int i = 1; i < 102; i++) { if (arrP[i] == 0) { if (minDiff > abs(X - i)) { ...
[["-", 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
134
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define pb push_back #define mp make_pair #define ...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define pb push_back #define mp make_pair #define ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
249
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define pb push_back #define mp make_pair #define ...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define per(i, a, b) for (int i = (b)-1; i >= (a); i--) #define pb push_back #define mp make_pair #define ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
250
#include <bits/stdc++.h> #define simplify \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define int long long #define endl "\...
#include <bits/stdc++.h> #define simplify \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define int long long #define endl "\...
[["-", 51, 91, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 91, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["-", 51, 91, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 91, 28, 2, 3, 4, 0, 16, 17, 72], ["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 64, 9, 0, 1,...
1
133
x,n = (int(x) for x in input().split()) p = [int(x) for x in input().split()] result = 100 l = list(range(0,101)) if len(p) == 0: kotae = x else: for i in range(len(p)): l[p[i]] = 200 for i in reversed(range(len(l))): if l[i] != 200: if result >= abs(l[i] - x)...
x,n = (int(x) for x in input().split()) p = [int(x) for x in input().split()] result = 100 l = list(range(0,102)) if len(p) == 0: kotae = x else: for i in range(len(p)): l[p[i]] = "" for i in reversed(range(len(l))): if l[i] != "": if result >= abs(l[i] - x): ...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 557, 0, 654], ["+", 8, 196, 0, 1, 0, 662, 12, 557, 0, 655], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+...
5
141
x,n = map(int,input().split()) if n == 0: print (x) exit () p = list(map(int,input().split())) for i in range(1,201): if not x-i in p: print (x-i) exit () elif not x+i in p: print (x+i) exit ()
x,n = map(int,input().split()) if n == 0: print (x) exit () p = list(map(int,input().split())) for i in range(201): if not x-i in p: print (x-i) exit () elif not x+i in p: print (x+i) exit () else: pass
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 674, 0, 675]]
5
89
x , n = map(int , input().split()) b = [] if n!=0: b = list(map(int,input().split())) t = 1 ans = 0 while 1: if x-t not in b: ans = x - t break if x+t not in b: ans = x + t break t += 1 print(ans)
x , n = map(int , input().split()) b = [] if n!=0: b = list(map(int,input().split())) t = 0 ans = 0 while 1: if x-t not in b: ans = x - t break if x+t not in b: ans = x + t break t += 1 print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
86
X, N = map(int,input().split()) answer = 0 if N != 0: mapped_list = map(int,input().split()) list = list(mapped_list) print(list) for i in range (N): if (X-i in list) == False: answer = X-i break elif (X+i in list) == False: answer = X+i break else: answer = X print(answer)
X, N = map(int,input().split()) answer = 0 if N != 0: mapped_list = map(int,input().split()) list = list(mapped_list) for i in range (N): if (X-i in list) == False: answer = X-i break elif (X+i in list) == False: answer = X+i break else: answer =X print(answer)
[["-", 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, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
99
#include <bits/stdc++.h> using namespace std; using ll = long long; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int power(int x, int y, int p) { int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return r...
#include <bits/stdc++.h> using namespace std; using ll = long long; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int power(int x, int y, int p) { int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return r...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
272
X,N = map(int,input().split(" ")) if N != 0: p_list = list(map(int,input().split(" "))) target = X target_num_min = X target_num_plus = X if X in p_list: while True: target_num_min -= 1 if target_num_min not in p_list: target = target_num_min break target_num_plus...
X,N = map(int,input().split(" ")) target = X if N != 0: p_list = list(map(int,input().split(" "))) target_num_min = X target_num_plus = X if X in p_list: while True: target_num_min -= 1 if target_num_min not in p_list: target = target_num_min ...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22]]
5
91
k = list(map(int, input().split())) if k[1] == 0: print(k[0]) else: l = list(map(int, input().split())) a = [i for i in range(101) if not i in l] m = [] for i in a: m.append(abs(i - k[0])) print(a[m.index(min(m))])
k = list(map(int, input().split())) if k[1] == 0: print(k[0]) else: l = list(map(int, input().split())) a = [i for i in range(102) if not i in l] m = [] for i in a: m.append(abs(i - k[0])) print(a[m.index(min(m))])
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
106
package main import ( "bufio" "fmt" "os" "strconv" "strings" "math" ) var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10) func main() { l := getStdinIntArr() X, N := l[0], l[1] if N == 0 { fmt.Println(X) } else { p := getStdinIntArr() i := -1 va...
package main import ( "bufio" "fmt" "os" "strconv" "strings" "math" ) var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10) func main() { l := getStdinIntArr() X, N := l[0], l[1] if N == 0 { fmt.Println(X) } else { p := getStdinIntArr() i := -1 va...
[["+", 0, 7, 8, 196, 0, 57, 15, 91, 17, 111], ["+", 8, 196, 0, 57, 75, 57, 15, 91, 17, 111]]
7
617
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main(void) { int x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } vector<int> p(n); //元の数字、abs for (int i = 0; i < n; i++) { cin >> p[i]; } sort(p.begin(), p.end()); vector<in...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main(void) { int x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } vector<int> p(n); //元の数字、abs for (int i = 0; i < n; i++) { cin >> p[i]; } sort(p.begin(), p.end()); vector<in...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
264
#include <bits/stdc++.h> #define debug(a) cout << #a << " " << a << endl; #define _debug(a, i) \ cout << #a << "[" << i << "]" \ << " = " << a[i] << endl; #define fastio ...
#include <bits/stdc++.h> #define debug(a) cout << #a << " " << a << endl; #define _debug(a, i) \ cout << #a << "[" << i << "]" \ << " = " << a[i] << endl; #define fastio ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
367
#ifdef LOCAL //#define _GLIBCXX_DEBUG #endif //#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<int, int> Pi; typedef vector<ll> Vec...
#ifdef LOCAL //#define _GLIBCXX_DEBUG #endif //#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef pair<int, int> Pi; typedef vector<ll> Vec...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20]]
1
1,349
#include <iostream> using namespace std; int nearUp(int x, int a[]) { int r = -1; int k = 0; while (x - 1 + k < 101) { if (a[x + k] == 1) { r = x + k; break; } k++; } return r; } int nearDn(int x, int a[]) { int r = -1; int k = 0; while (x - 1 - k > -1) { if (a[x - k] == 1)...
#include <iostream> using namespace std; int nearUp(int x, int a[]) { int r = -1; int k = 0; while (x - 1 + k < 102) { if (a[x + k] == 1) { r = x + k; break; } k++; } return r; } int nearDn(int x, int a[]) { int r = -1; int k = 0; while (x - 1 - k > -5) { if (a[x - k] == 1)...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
306
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int x, n; cin >> x >> n; vector<int> p(n); if (n != 0) rep(i, n) cin >> p[i]; sort(p.begin(), p.end()); int ans = 100000; int tem = 0; int count = 0; ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; int main() { int x, n; cin >> x >> n; vector<int> p(n); if (n != 0) rep(i, n) cin >> p[i]; sort(p.begin(), p.end()); int ans = 100000; int tem = 0; int count = 0; ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
185
#include <stdio.h> #include <stdlib.h> int main() { int a[200], d[200]; int b, c, i, j, k, tmp, tmp2, count = 0; scanf("%d %d", &b, &c); for (i = 0; i < c; i++) { scanf("%d", &a[i]); } for (i = 0; i < c; ++i) { for (j = i + 1; j < c; ++j) { if (a[i] > a[j]) { tmp = a[i]; a[i] =...
#include <stdio.h> #include <stdlib.h> int main() { int a[200], d[200]; int b, c, i, j, k, tmp, tmp2, count = 0; scanf("%d %d", &b, &c); for (i = 0; i < c; i++) { scanf("%d", &a[i]); } for (i = 0; i < c; ++i) { for (j = i + 1; j < c; ++j) { if (a[i] > a[j]) { tmp = a[i]; a[i] =...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47]]
0
316
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines x, n = map(int, readline().split()) p = set(map(int, readline().split())) ans = x tmp = 10 ** 9 for i in reversed(range(-1, 101)): if i not in p: if tmp >= abs(x - i): tmp = abs...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines x, n = map(int, readline().split()) p = set(map(int, readline().split())) ans = x tmp = 300 for i in reversed(range(-1, 102)): if i not in p: if tmp >= abs(x - i): tmp = abs(x -...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 578], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
115
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int p[100]; int flag = 0; int min = 100; int n_closest = 100; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int n = 100; n >= 0; n--) { for (int i = 0; i < N; i++) { if (n == p[i]) flag = 1...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; int p[100]; int flag = 0; int min = 100; int n_closest = 100; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int n = 101; n >= 0; n--) { for (int i = 0; i < N; i++) { if (n == p[i]) flag = 1...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
159
#include <bits/stdc++.h> #include <cassert> #include <numeric> //#include <boost/multiprecision/cpp_int.hpp> #define ll long long int #define CON 100010 const long long mod = 1e9 + 7; const int INF = 1001001001; const int inf = 100000; // const ll inf=1e9+7; // const ll ful=1e18; using namespace std; // namespace mp = ...
#include <bits/stdc++.h> #include <cassert> #include <numeric> //#include <boost/multiprecision/cpp_int.hpp> #define ll long long int #define CON 100010 const long long mod = 1e9 + 7; const int INF = 1001001001; const int inf = 100000; // const ll inf=1e9+7; // const ll ful=1e18; using namespace std; // namespace mp = ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
237
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; typedef pair<ll, ll> Pll; using Graph = vector<vector<int>>; using Graphl = vector<vector<ll>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define Rep(i, k, n) for (int i = k; i < (int)(n); i+...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; typedef pair<ll, ll> Pll; using Graph = vector<vector<int>>; using Graphl = vector<vector<ll>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define Rep(i, k, n) for (int i = k; i < (int)(n); i+...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
404
tmp = list(map(int, input().split())) x = tmp[0] n = tmp[1] if n == 0: print(x) exit() p = list(map(int, input().split())) i = 1 while True: if not x-i in p: print(x-i) break if not x+i in p: print(x+i) break i += 1
tmp = list(map(int, input().split())) x = tmp[0] n = tmp[1] if n == 0: print(x) exit() p = list(map(int, input().split())) i = 0 while True: if not x-i in p: print(x-i) break if not x+i in p: print(x+i) break i += 1
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
97
x,n = map(int,input().split()) if n != 0: p = list(map(int,input().split())) else: print(x) exit() s = 1000000000 for i in range(-101,101): if i in p: continue s = min(abs(x-i),s) if not x-s in p: print(x - s) else: print(x + s)
x,n = map(int,input().split()) if n != 0: p = list(map(int,input().split())) else: print(x) exit() s = 1000000000 for i in range(-100,102): if i in p: continue s = min(abs(x-i),s) if not x-s in p: print(x - s) else: print(x + s)
[["-", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
102
#include <bits/stdc++.h> using namespace std; int main() { typedef long long ll; ll x, n; cin >> x >> n; vector<ll> v; for (ll i = 0; i < n; i++) { ll t; cin >> t; v.push_back(t); } sort(v.begin(), v.end()); if (n == 0) { cout << x; } else { vector<ll> nv; for (ll i = v[0]; ...
#include <bits/stdc++.h> using namespace std; int main() { typedef long long ll; ll x, n; cin >> x >> n; vector<ll> v; for (ll i = 0; i < n; i++) { ll t; cin >> t; v.push_back(t); } sort(v.begin(), v.end()); if (n == 0) { cout << x; } else { vector<ll> nv; for (ll i = 0; i <...
[["-", 0, 7, 10, 43, 49, 50, 51, 69, 28, 22], ["-", 10, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["-", 10, 43, 49, 50, 51, 69, 341, 342, 0, 73], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
243
#include <bits/stdc++.h> using namespace std; int main() { int x, n, c = 0, d = 0; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } for (int j = 0; j < n; j++) { if (c != j || d != j) { break; } for (int i = 0; i < n; i++) { if (x - j == p[i]) { ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, c = 0, d = 0; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p[i]; } for (int j = 0; j < n; j++) { if (c != j || d != j) { break; } for (int i = 0; i < n; i++) { if (x - j == p[i]) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
193
#include <stdio.h> #include <stdlib.h> int main() { int x, n, a[100], i, w = 0, q = 0; // wは距離 scanf("%d %d", &x, &n); w = x; if (n == 0) { printf("%d", x); return 0; } for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int mode = 0; int j; for (j = x; j < 100; j++) { for (i = 0;...
#include <stdio.h> #include <stdlib.h> int main() { int x, n, a[100], i, w = 0, q = 0; // wは距離 scanf("%d %d", &x, &n); w = x; if (n == 0) { printf("%d", x); return 0; } for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int mode = 0; int j; for (j = x; j < 200; j++) { for (i = 0;...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18]]
0
312
import math def main(): x, n = map(int, input().split()) if n==0: out = x else: p_l = [int(_) for _ in input().split()] c_l = [] for i in range(-101, 101): c_l.append(i) for p in p_l: if p in c_l: c_l[c_l.index(p)]=100...
import math def main(): x, n = map(int, input().split()) if n==0: out = x else: p_l = [int(_) for _ in input().split()] c_l = [] for i in range(-101, 105): c_l.append(i) for p in p_l: if p in c_l: c_l[c_l.index(p)]=100...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
162
X, Y = map(int, input().split()) if Y == 0: answer = X else: list_1 = list(map(int, input().split())) mylist = list(range(-100, 101)) list_2 = list(filter(lambda x: x not in list_1, mylist)) list_3 = list(map(lambda x: x - X, list_2)) import numpy as np abslist = np.abs(list_3) ...
X, Y = map(int, input().split()) if Y == 0: answer = X else: list_1 = list(map(int, input().split())) mylist = list(range(-100, 200)) list_2 = list(filter(lambda x: x not in list_1, mylist)) list_3 = list(map(lambda x: x - X, list_2)) import numpy as np abslist = np.abs(list_3) ...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
144
x,n,*p=map(int,open(0).read().split()) if n==0: print(x) else: q=[i for i in range(101) if not(i in p)] m=[] for j in q: m.append(abs(j-x)) a,b=x-min(m),x+min(m) if a in q: print(a) else: print(b)
x,n,*p=map(int,open(0).read().split()) if n==0: print(x) else: q=[i for i in range(102) if not(i in p)] m=[] for j in q: m.append(abs(j-x)) a,b=x-min(m),x+min(m) if a in q: print(a) else: print(b)
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
106
X, N = map(int, input().split()) try: list_ = list(map(int, input().split())) except: print(X) else: for i in range(1, 101): if not (X-i) in list_: print(X-i) break elif not(X+i) in list_: print(X+i) break
X, N = map(int, input().split()) try: list_ = list(map(int, input().split())) except: print(X) else: for i in range(0, 101): if not (X-i) in list_: print(X-i) break elif not(X+i) in list_: print(X+i) break
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
87
#include <bits/stdc++.h> using namespace std; int main() { int x, n = 0; cin >> x >> n; vector<int> p(n); int ans = 10000; int anS = 0; if (n == 0) { cout << x << endl; return 0; } for (int i = 0; i < n; i++) { cin >> p.at(i); } bool flag = false; for (int i = -100; i <= 100; i++) ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n = 0; cin >> x >> n; vector<int> p(n); int ans = 10000; int anS = 0; if (n == 0) { cout << x << endl; return 0; } for (int i = 0; i < n; i++) { cin >> p.at(i); } bool flag = false; for (int i = -10; i <= 150; 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
238
from sys import stdin, stdout import sys INF=1e9 import bisect def get_int(): return int(stdin.readline().strip()) def get_ints(): return map(int,stdin.readline().strip().split()) def get_array(): return list(map(int,stdin.readline().strip().split())) def get_string(): return stdin.readline().strip() def op(c): return...
from sys import stdin, stdout import sys INF=1e9 import bisect def get_int(): return int(stdin.readline().strip()) def get_ints(): return map(int,stdin.readline().strip().split()) def get_array(): return list(map(int,stdin.readline().strip().split())) def get_string(): return stdin.readline().strip() def op(c): return...
[["-", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
181
import numpy as np X, N = list(map(int, input().split())) try: p = np.array(list(map(int, input().split()))) except EOFError: print(X) exit() I = np.arange(1, 101) indices = np.argsort(np.abs(I - X), kind='stable') for idx in indices: if I[idx] not in p: print(I[idx]) break
import numpy as np X, N = list(map(int, input().split())) try: p = np.array(list(map(int, input().split()))) except EOFError: print(X) exit() I = np.arange(0, 102) indices = np.argsort(np.abs(I - X), kind='stable') for idx in indices: if I[idx] not in p: print(I[idx]) break
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612]]
5
110
#include <iostream> #include <stdlib.h> #include <vector> using namespace std; int main() { int X, N; int P[100]; cin >> X >> N; for (int i = 0; i < N; i++) cin >> P[i]; int min = 1000; int mins[102]; for (int i = 0; i <= 101; i++) mins[i] = 1000; int cur = 0; for (int i = -1; i <= 100; i++)...
#include <iostream> #include <stdlib.h> #include <vector> using namespace std; int main() { int X, N; int P[100]; cin >> X >> N; for (int i = 0; i < N; i++) cin >> P[i]; int min = 1000; int mins[103]; for (int i = 0; i <= 102; i++) mins[i] = 1000; int cur = 0; for (int i = -1; i <= 101; i++)...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
242
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> v; if (n == 0) cout << x; else { for (int i = 0; i < n; i++) { int c; cin >> c; v.push_back(c); } vector<int>::iterator it; vector<int>::iterator itr; int i = -1; whil...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> v; if (n == 0) cout << x; else { for (int i = 0; i < n; i++) { int c; cin >> c; v.push_back(c); } vector<int>::iterator it; vector<int>::iterator itr; int i = -1; whil...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72]]
1
247
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) #define reps(i, cc, n) for (int i = cc; i < (n); ++i) #define dreps(i, cc, n) for (int i = cc; i > (n); --i) #define llreps(i, cc, n) for (long long i = cc; i < (n); ++i) using namespace std; using ll = long long; using ld = long double; using ull...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (n); ++i) #define reps(i, cc, n) for (int i = cc; i < (n); ++i) #define dreps(i, cc, n) for (int i = cc; i > (n); --i) #define llreps(i, cc, n) for (long long i = cc; i < (n); ++i) using namespace std; using ll = long long; using ld = long double; using ull...
[["-", 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
202
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <vector> using namespace std; int main(void) { int X; int N; cin >> X >> N; vector<int> p(N); vector<int> forbidden; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int data = -100; data <= 100; data++) { ...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <vector> using namespace std; int main(void) { int X; int N; cin >> X >> N; vector<int> p(N); vector<int> forbidden; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int data = -101; data <= 101; data++) { ...
[["-", 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
213
#include <bits/stdc++.h> using namespace std; int main() { int x, n, p[110], d = 200, k = 0; cin >> x >> n; for (int i = 0; i < n; ++i) cin >> p[i]; vector<int> v(101); for (int i = 0; i < 101; i++) { v.at(i) = i; } for (int i = 0; i < n; i++) { int value_to_remove = p[i]; v.erase(std::rem...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, p[110], d = 200, k; cin >> x >> n; for (int i = 0; i < n; ++i) cin >> p[i]; vector<int> v(102); for (int i = 0; i < 102; i++) { v.at(i) = i; } for (int i = 0; i < n; i++) { int value_to_remove = p[i]; v.erase(std::remove(...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 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, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 1...
1
210
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + n + 1); int ans, mi = 1000; for (int i = 0; i <= 100; i++) { if (binary_search(a + 1, a + n + 1, i) == 0) { if (mi > (abs(x - i))...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + n + 1); int ans, mi = 1000; for (int i = -2; i <= 105; i++) { if (binary_search(a + 1, a + n + 1, i) == 0) { if (mi > (abs(x - 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
145
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define ll long long #define pai 3.1415926535897932384626433832795028841971693 int main() { int x, n, min = 100001, ans = 0, k; scanf("%d %d", &x, &n); int p[n], a[n]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } for (i...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define ll long long #define pai 3.1415926535897932384626433832795028841971693 int main() { int x, n, min = 100001, ans = 0, k; scanf("%d %d", &x, &n); int p[n], a[n]; for (int i = 0; i < n; i++) { scanf("%d", &p[i]); } 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]]
0
218
a = list(map(int,input().split())) x = a[0] if a[1] == 0 : print(x) else : b = list(map(int,input().split())) retu = [] for i in range(1,101) : retu.append(i) for i in b : if i in retu : retu.remove(i) k = 1000 ans = 0 for i in retu : y = abs(i - x) ...
a = list(map(int,input().split())) x = a[0] if a[1] == 0 : print(x) else : b = list(map(int,input().split())) retu = [] for i in range(0,102) : retu.append(i) for i in b : if i in retu : retu.remove(i) k = 1000 ans = 0 for i in retu : y = abs(i - x) ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
124
x, n = map(int, input().split()) if n > 0: P = list(map(int, input().split())) else: P = [] ans, dist = 0, 1000 for i in range(101): if i not in P: if abs(i - x) < dist: dist = abs(i - x) ans = i print(ans)
x, n = map(int, input().split()) if n > 0: P = list(map(int, input().split())) else: P = [] ans, dist = 0, 1000 for i in range(-200, 200): if i not in P: if abs(i - x) < dist: dist = abs(i - x) ans = i print(ans)
[["-", 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, 21], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
90
#include <bits/stdc++.h> using namespace std; #define endl '\n' int main() { ios::sync_with_stdio(false); cin.tie(NULL); int x, n; vector<int> arr; cin >> x >> n; int max = 0; for (int i = 0; i < n; i++) { int a; cin >> a; arr.push_back(a); if (a > max) max = a; } int min = 1...
#include <bits/stdc++.h> using namespace std; #define endl '\n' int main() { ios::sync_with_stdio(false); cin.tie(NULL); int x, n; vector<int> arr; cin >> x >> n; int max = 0; for (int i = 0; i < n; i++) { int a; cin >> a; arr.push_back(a); if (a > max) max = a; } int min = 1...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
218
#ifdef LOCAL #include <header.hpp> #else #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> #endif #define lp(i, l, r) for (auto i = regu(l); i <= decltype(i)(r); ++i) #define rp(i, r, l) for (auto i = regu(r); i >= decltype(i)(l); --i) #define lv(i, a) for (int i ...
#ifdef LOCAL #include <header.hpp> #else #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> #endif #define lp(i, l, r) for (auto i = regu(l); i <= decltype(i)(r); ++i) #define rp(i, r, l) for (auto i = regu(r); i >= decltype(i)(l); --i) #define lv(i, a) for (int i ...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]]
1
2,116
#include <bits/stdc++.h> using namespace std; int main() { int x, n, o; cin >> x >> n; vector<int> v; if (n == 0) { cout << x << endl; } else if (n == 100) { int z = x; if (z > 50) { cout << 101 << endl; } else { cout << 0 << endl; } } else { for (int p = 1; p < 101; p++...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, o; cin >> x >> n; vector<int> v; if (n == 0) { cout << x << endl; } else if (n == 100) { int z = x; if (z > 50) { cout << 101 << endl; } else { cout << 0 << endl; } } else { for (int p = -200; p < 301; ...
[["-", 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], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 0, 9, 0, 7, 15, 16, 12, 16, 31, 13]]
1
250
/* * Author:sam51305 */ #include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define endl '\n' #define f first #define s second #define mp make_pair ...
/* * Author:sam51305 */ #include <bits/stdc++.h> using namespace std; #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define endl '\n' #define f first #define s second #define mp make_pair ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 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
207
X,N=map(int,input().split()) if(N==0): print(X) exit() P= list(map(int,input().split())) c=-100 ans=100 for i in range(200): a=0 for i in range(200): if (abs(X-c)>=abs(X-c-a)): if not (c+a in P): if (abs(X-ans) >=abs(X-c-a)): ans=c+a a+=1 c+=1 if ...
X,N=map(int,input().split()) if(N==0): print(X) exit() P= list(map(int,input().split())) c=-100 ans=100000 for i in range(200): a=0 for i in range(200): if (abs(X-c)>=abs(X-c-a)): if not (c+a in P): if (abs(X-ans) >=abs(X-c-a)): ans=c+a a+=1 c+=1 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
162
eval'X,_,*A='+`dd`.split*?, p (0..100).reject{A.index _1}.min_by{(X-_1).abs}
eval'X,_,*A='+`dd`.split*?, p (0..101).reject{A.index _1}.min_by{(X-_1).abs}
[["-", 0, 652, 486, 652, 486, 739, 0, 475, 444, 612], ["+", 0, 652, 486, 652, 486, 739, 0, 475, 444, 612]]
4
37
def main(): X, N = map(int, input().split()) if N == 0: print(X) return p = tuple(map(int, input().split())) if X not in p: print(X) not_p = list(set([i for i in range(max(p)+2)]) - set(p)) not_p_X = [abs(i - X) for i in not_p] print(not_p[not_p_X.index(min(not_p_X))]) main()
def main(): X, N = map(int, input().split()) if N == 0: print(X) return p = tuple(map(int, input().split())) if X not in p: print(X) return not_p = list(set([i for i in range(max(p)+2)]) - set(p)) not_p_X = [abs(X - i) for i in not_p] print(not_p[not_p_X.index(min(not_p_X))]) mai...
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 12, 658, 8, 652, 3, 4, 0, 657, 31, 22], ["-", 12, 658, 8, 652, 3, 4, 0, 657, 17, 33], ["+", 12, 658, 8, 652, 3, 4, 0, 657, 17, 33], ["+", 12, 658, 8, 652, 3, 4, 0, 657, 12, 22]]
5
118
#include <bits/stdc++.h> using namespace std; int main(void) { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p.at(i); } int lans = -1000; int uans = 1000; int l, u; l = x; u = x; int tmp; bool is_exist = false; // lower while (l >= 0) { is_exist =...
#include <bits/stdc++.h> using namespace std; int main(void) { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p.at(i); } int lans = -1000; int uans = 1000; int l, u; l = x; u = x; int tmp; bool is_exist = false; // lower while (l >= 0) { is_exist =...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]]
1
257
#include <math.h> #include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using P = pair<int, int>; int main() { int x, n; cin >> x >> n; if (n...
#include <math.h> #include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using P = pair<int, int>; int main() { int x, n; cin >> x >> n; if (n...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
286
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> //#include <boost/multiprecision/cpp_int.hpp> // // using namespace boost::multiprecision; using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> //#include <boost/multiprecision/cpp_int.hpp> // // using namespace boost::multiprecision; using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree...
[["-", 51, 16, 31, 16, 31, 2, 3, 4, 0, 22], ["+", 51, 16, 31, 16, 31, 2, 3, 4, 0, 22]]
1
1,870
#include <bits/stdc++.h> using namespace std; #define test(t) \ int t; \ cin >> t; \ while (t--) #define p1(x) ...
#include <bits/stdc++.h> using namespace std; #define test(t) \ int t; \ cin >> t; \ while (t--) #define p1(x) ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
178
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define inf 1e9 #define mod 1000000007 #define endl "\n" #define ff first #define ss second void solve() { int x, n; cin >> x >> n; if (n == 0) { cout << x; return; } set<int> s1; for (int i = -1; i <= 100; i...
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define inf 1e9 #define mod 1000000007 #define endl "\n" #define ff first #define ss second void solve() { int x, n; cin >> x >> n; if (n == 0) { cout << x; return; } set<int> s1; for (int i = -1; i <= 101; i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
198
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; int flag_dpl = 0; int prevval; int d[100]; int ds[100]; int x, n; int ans = 1000; int flag = 0; int main() { cin >> x >> n; for (int i = 0; i < n; i++) { cin >> ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; int flag_dpl = 0; int prevval; int d[101]; int ds[500]; int x, n; int ans = 1000; int flag = 0; int main() { cin >> x >> n; for (int i = 0; i < n; i++) { cin >> ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
248
from sys import stdin X,N=[int(x) for x in stdin.readline().rstrip().split()] P=[int(x) for x in stdin.readline().rstrip().split()] l=[i for i in range(-100,101) if i not in P] abslist = list(map(lambda a:abs(a-X),l)) print(l[abslist.index(min(abslist))])
from sys import stdin X,N=[int(x) for x in stdin.readline().rstrip().split()] P=[int(x) for x in stdin.readline().rstrip().split()] l=[i for i in range(-1,102) if i not in P] abslist = list(map(lambda a:abs(a-X),l)) print(l[abslist.index(min(abslist))])
[["-", 0, 659, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 659, 12, 652, 3, 4, 0, 664, 28, 612], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
108
#include <bits/stdc++.h> #include <cmath> using namespace std; #define _GLIBCXX_DEBUG #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) #define vl vector<ll> #define vpl vector<pair<ll, ll>> #define vvl vector<vector<ll>> // a(縦行,vector<ll>(横列)); #include <algorithm> //__gcd(a,b) #include <cst...
#include <bits/stdc++.h> #include <cmath> using namespace std; #define _GLIBCXX_DEBUG #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) #define vl vector<ll> #define vpl vector<pair<ll, ll>> #define vvl vector<vector<ll>> // a(縦行,vector<ll>(横列)); #include <algorithm> //__gcd(a,b) #include <cst...
[["+", 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
271
#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; } int ans; int num; map<int, bool> mp; for (int i = 0; i < n; ++i) { cin >> num; mp[num] = true; } int sum = 1010; for (int i = -100...
#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; } int ans; int num; map<int, bool> mp; for (int i = 0; i < n; ++i) { cin >> num; mp[num] = true; } int sum = 1010; for (int i = -100...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
154
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; int num = 0; bool frag = true; vector<int> b(N); if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { cin >> b.at(i); } sort(b.begin(), b.end()); if (b.at(0) > X) { cout <<...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; int num = 0; bool frag = true; vector<int> b(N); if (N == 0) { cout << X << endl; return 0; } for (int i = 0; i < N; i++) { cin >> b.at(i); } sort(b.begin(), b.end()); if (b.at(0) > X) { cout <<...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
321
#include <bits/stdc++.h> using namespace std; #define start \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define f(i, a, n...
#include <bits/stdc++.h> using namespace std; #define start \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define f(i, a, 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
243
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> q(101); for (int i = 0; i < 101; i++) q[i] = i; int z; int count = 0; for (int i = 0; i < n; i++) { cin >> z; for (int j = 0; j < 101; j++) { if (z == q[j]...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> q(102); for (int i = 0; i < 102; i++) q[i] = i; int z; int count = 0; for (int i = 0; i < n; i++) { cin >> z; for (int j = 0; j < 102; j++) { if (z == q[j]...
[["-", 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, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, ...
1
216
#include <bits/stdc++.h> using namespace std; #define pp pair<int, int> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ll long long #define ld long double #define all(a) (a).begin(), (a).end() #define mk make_pair ll mod = 998244353; int inf = 100...
#include <bits/stdc++.h> using namespace std; #define pp pair<int, int> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define ll long long #define ld long double #define all(a) (a).begin(), (a).end() #define mk make_pair ll mod = 998244353; int inf = 100...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
219
x,n=map(int,input().split()) if n==0: print(x) quit() lst=list(map(int,input().split())) a=list(range(-100,101)) for i in lst: if i in a: a.remove(i) if len(a)==0: print(x) quit() b=[] for j in a: b.append(abs(j-x)) print(a[b.index(min(b))])
x,n=map(int,input().split()) if n==0: print(x) quit() lst=list(map(int,input().split())) a=list(range(-1,102)) for i in lst: if i in a: a.remove(i) if len(a)==0: print(x) quit() b=[] for j in a: b.append(abs(j-x)) print(a[b.index(min(b))])
[["-", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
123
#include <bits/stdc++.h> using namespace std; int main() { int x, n, p; int chk = 1000; bool flag = false; vector<int> vec(200); cin >> x >> n; vector<int> vec2; for (int i = -200; i < 101; i++) { vec2.push_back(i); } for (int i = 0; i < n; i++) { cin >> p; vec2[p + 200] = -9999; i...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; int p = 0; int chk = 1000; bool flag = false; vector<int> vec(200); cin >> x >> n; vector<int> vec2; for (int i = -200; i < 200; i++) { vec2.push_back(i); } for (int i = 0; i < n; i++) { cin >> p; vec2[p + 200] = -9...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 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
202
# -*- coding: utf-8 -*- num, i = map(int, input().split()) if(i != 0): s = set(map(int, input().split())) else: s = set() m = set(range(101)) o = list(m-s) o2 = list(map(lambda x: abs(x - num), o)) print(o[o2.index(min(o2))])
# -*- coding: utf-8 -*- num, i = map(int, input().split()) if(i != 0): s = set(map(int, input().split())) else: s = set() m = set(range(102)) o = list(m-s) o2 = list(map(lambda x: abs(x - num), o)) print(o[o2.index(min(o2))])
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
99
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int X, N; cin >> X >> N; set<int> p; rep(i, N) { int tmpP; cin >> tmpP; p.insert(tmpP); } if (p.size() == 0) { cout << X << endl; return 0; } int minNum...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { int X, N; cin >> X >> N; set<int> p; rep(i, N) { int tmpP; cin >> tmpP; p.insert(tmpP); } if (p.size() == 0) { cout << X << endl; return 0; } int minNum...
[["-", 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
179
#include <bits/stdc++.h> using namespace std; int main() { int x, n; vector<int> nums; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } nums = vector<int>(n); for (int i = 0; i < n; i++) cin >> nums.at(i); int res; int p = -1; int cnt = 1; bool flg = false; while (1) ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; vector<int> nums; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } nums = vector<int>(n); for (int i = 0; i < n; i++) cin >> nums.at(i); int res; int p = -1; int cnt = 0; bool flg = false; while (1) ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
188
xn=input() x,n=xn.split() if n=='0': print(int(x)) else: p=input() p={int(i) for i in p.split()} s={i for i in range(1,100)} s_p=list(s-p) d=[abs(i-int(x)) for i in s_p] print(s_p[d.index(min(d))])
xn=input() x,n=xn.split() if n=='0': print(int(x)) else: p=input() p={int(i) for i in p.split()} s={i for i in range(-150,150)} s_p=list(s-p) d=[abs(i-int(x)) for i in s_p] print(s_p[d.index(min(d))])
[["-", 12, 689, 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, 689, 0, 659, 12, 652, 3, 4, 0, 612]]
5
105
/* https://codeforces.com/contest/1360/problem/H */ #include <bits/stdc++.h> using namespace std; using ll = long long; using vs = vector<string>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using pi = pair<int, int>; using pl = pair<ll, ll>; using vpi = vector<pair<int, int>>; using vpl = ...
/* https://codeforces.com/contest/1360/problem/H */ #include <bits/stdc++.h> using namespace std; using ll = long long; using vs = vector<string>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using pi = pair<int, int>; using pl = pair<ll, ll>; using vpi = vector<pair<int, int>>; using vpl = ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
352
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X; cin >> N; if (N == 0) { cout << X << endl; return 0; } vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p[i]; } int min = 1; for (int i = 1; i < 100; i++) { min = X - i; if (p.end() == find(p...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X; cin >> N; if (N == 0) { cout << X << endl; return 0; } vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p[i]; } int min = 0; for (int i = 0; i < 100; i++) { min = X - i; if (p.end() == find(p...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
174
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; for (int i = 0; i < N; i++) { cin >> p[i]; } sort(p, p + N); int check_p, minus_X, min_X, min_i; min_X = 100; min_i = X; for (int i = 0; i < 102; i++) { for (int j = 0; j < N; j++) { if ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; for (int i = 0; i < N; i++) { cin >> p[i]; } sort(p, p + N); int check_p, minus_X, min_X, min_i; min_X = 100; min_i = X; for (int i = 0; i < 102; i++) { for (int j = 0; j < N; j++) { if ...
[["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
173