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; typedef long long ll; #define rep(k, i, n) for (ll i = k; i < n; ++i) #define push_back pb int main(void) { // Your code here! ll x, n; cin >> x >> n; vector<ll> a(n); rep(0, i, n) { cin >> a[i]; } sort(a.begin(), a.end()); ll m = 1e9, ans, c = 0; rep(0, i, ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(k, i, n) for (ll i = k; i < n; ++i) #define push_back pb int main(void) { // Your code here! ll x, n; cin >> x >> n; vector<ll> a(n); rep(0, i, n) { cin >> a[i]; } sort(a.begin(), a.end()); ll m = 1e9, ans, c = 0; rep(0, i, ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 151], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18]]
1
157
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(k, i, n) for (ll i = k; i < n; ++i) #define pb push_back int main(void) { ll x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } vector<ll> p(n); rep(0, i, n) { cin >> p[i]; } sort(p.begin(), p.end()); ll c = 0...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(k, i, n) for (ll i = k; i < n; ++i) #define pb push_back int main(void) { ll x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } vector<ll> p(n); rep(0, i, n) { cin >> p[i]; } sort(p.begin(), p.end()); ll c = 0...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
172
x,n=map(int,input().split()) if(n==0): print(x) exit(0) a=list(map(int,input().split())) f=set(a) mi=1000000 r=100000000 for i in range(-100,101): if(i in f): continue if(abs(x-i)<mi): mi=abs(x-i) r=i print(r)
x,n=map(int,input().split()) if(n==0): print(x) exit(0) a=list(map(int,input().split())) f=set(a) mi=1000000 r=100000000 for i in range(-1000,1001): if(i in f): continue if(abs(x-i)<mi): mi=abs(x-i) r=i print(r)
[["-", 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
106
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll x, n; cin >> x >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } ll mn = 1000, ans = 0; for (int i = 1; i <= 105; i++) { ll flag = 1; for (int j = 0; j < n; j++) { if (v[j] == i) ...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll x, n; cin >> x >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } ll mn = 1000, ans = 0; for (int i = -105; i <= 105; i++) { ll flag = 1; for (int j = 0; j < n; j++) { if (v[j] == i) ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 25]]
1
152
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /0 ___/`---'\___ .' \\| |// '. / \\||| : |||// \ / _||||| -:- |||||- \ ...
[["+", 64, 1, 0, 16, 31, 16, 12, 2, 63, 22]]
1
398
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <random> using namespace std; using namespace __gnu_pbds; #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <random> using namespace std; using namespace __gnu_pbds; #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef tree<int, null_type, less<int>, rb_tree_tag, ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
244
#include <bits/stdc++.h> using namespace std; #define hyperspeed \ ios::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long #define ull unsigned long long #define ui unsigned int #define li long int...
#include <bits/stdc++.h> using namespace std; #define hyperspeed \ ios::sync_with_stdio(false); \ cin.tie(NULL); #define ll long long #define ull unsigned long long #define ui unsigned int #define li long int...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
212
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<bool> p(110, true); for (int i = 0; i < n; i++) { int a; cin >> a; p[a] = false; } int ans = -1, cnt = 100; for (int i = 100; i >= 0; i--) { if (p[i]) { if (abs(x - i) <= cnt) { ans = ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<bool> p(110, true); for (int i = 0; i < n; i++) { int a; cin >> a; p[a] = false; } int ans = -1, cnt = 100; for (int i = 110; i >= 0; i--) { if (p[i]) { if (abs(x - i) <= cnt) { ans = ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
130
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> using ll = long long int; using ul = unsigned long long int; const ll LL_MAX(1LL << 60); co...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> using ll = long long int; using ul = unsigned long long int; const ll LL_MAX(1LL << 60); co...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
232
#include <iostream> using namespace std; int main() { int X; int N; cin >> X >> N; if (N > 0) { int p[N]; int buff[2]; for (int i = 0; i < N; i++) cin >> p[i]; for (int i = 1; i < 101; i++) { buff[0] = X - i; buff[1] = X + i; for (int j = 0; j < N; j++) { if (p[...
#include <iostream> using namespace std; int main() { int X; int N; cin >> X >> N; if (N > 0) { int p[N]; int buff[2]; for (int i = 0; i < N; i++) cin >> p[i]; for (int i = 0; i < 101; i++) { buff[0] = X - i; buff[1] = X + i; for (int j = 0; j < N; j++) { if (p[...
[["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
235
X, N = map(int, input().split()) if N == 0: print(X) exit() P = list(map(int, input().split())) for i in range(X+1): for d in [-1, +1]: if not X+i*d in P: print(X+i*d) break
X, N = map(int, input().split()) if N == 0: print(X) exit() P = list(map(int, input().split())) for i in range(X+1): for d in [-1, +1]: if not (X+i*d) in P: print(X + i*d) exit()
[["+", 0, 57, 15, 681, 28, 666, 0, 23, 0, 24], ["+", 0, 57, 15, 681, 28, 666, 0, 23, 0, 25], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
85
#include <iostream> #include <set> #include <string> using namespace std; int f[501]; int main() { long long n, origin, ans = 1e12, k; cin >> origin >> n; for (int i = 1; i <= n; i++) { cin >> k; f[k + 150] = true; } k = 0; while (true) { if (f[origin - k + 150] == false) { cout << ori...
#include <iostream> #include <set> #include <string> using namespace std; int f[501]; int main() { long long n, origin, ans = 1e12, k; cin >> origin >> n; for (int i = 1; i <= n; i++) { cin >> k; f[k + 150] = true; } k = 0; while (true) { if (f[origin - k + 150] == false) { cout << ori...
[["-", 64, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 16, 12, 16, 17, 72]]
1
137
import sys import operator readline = sys.stdin.buffer.readline a, b = map(int, readline().split()) c = set(map(int, readline().split())) L = [(i, abs(i - a)) for i in range(0, 102) if i not in c] L.sort(key=operator.itemgetter(1)) print(L)
import sys import operator readline = sys.stdin.buffer.readline a, b = map(int, readline().split()) c = set(map(int, readline().split())) L = [(i, abs(i - a)) for i in range(0, 102) if i not in c] L.sort(key=operator.itemgetter(1)) print(L[0][0])
[["+", 0, 652, 3, 4, 0, 206, 51, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 206, 51, 206, 206, 612], ["+", 0, 652, 3, 4, 0, 206, 51, 206, 0, 73], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]]
5
91
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int mod = 1000000007; bool p[201] = {}; int ans = -1; int k = (30 << 1); int main() { int x, n; cin >> x >> n; rep(i, n) { int a; cin >> a; p[a] = true; } rep(i, 101) { if ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; const int mod = 1000000007; bool p[201] = {}; int ans = 0; int k = (30 << 1); int main() { int x, n; cin >> x >> n; rep(i, n) { int a; cin >> a; p[a] = true; } rep(i, 102) { if (...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 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
139
x,n = map(int, input().split()) if n!=0: p = list(map(int,input().split())) for i in range(1,101): if x-i not in p: print(x-i) break elif x+i not in p: print(x+i) break else: print(x)
x,n = map(int, input().split()) if n!=0: p = list(map(int,input().split())) for i in range(0,101): if x-i not in p: print(x-i) break elif x+i not in p: print(x+i) break else: print(x)
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
84
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define yn(x) ((x) ? "Yes" : "No") typedef pair<int, int> ii; typedef pair<int, ii> iii; const int siz = 1e2 + 10; const int SIZ = 1e6 + 10; const...
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define yn(x) ((x) ? "Yes" : "No") typedef pair<int, int> ii; typedef pair<int, ii> iii; const int siz = 1e2 + 10; const int SIZ = 1e6 + 10; const...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
240
#include <bits/stdc++.h> using namespace std; template <typename T> void print_vector(vector<T> &vec) { cout << "print_vector -> "; for (int i = 0; i < vec.size(); i++) { if (i == vec.size() - 1) { cout << vec[i] << endl; } else { cout << vec[i] << " "; } } return; } int main() { in...
#include <bits/stdc++.h> using namespace std; template <typename T> void print_vector(vector<T> &vec) { cout << "print_vector -> "; for (int i = 0; i < vec.size(); i++) { if (i == vec.size() - 1) { cout << vec[i] << endl; } else { cout << vec[i] << " "; } } return; } int main() { in...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
240
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #define N 200010 #define MAX 1000000000000000000 #define MOD 1000000007 #include <stdio.h> int main(void) { int x, n, p[100], i, j, c, flg = 0; scanf("%d %d", &x, &n); for (i = 0; i < n; i++) { scanf("%d", &(p[i])); } for ...
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #define N 200010 #define MAX 1000000000000000000 #define MOD 1000000007 #include <stdio.h> int main(void) { int x, n, p[100], i, j, c, flg = 0; scanf("%d %d", &x, &n); for (i = 0; i < n; i++) { scanf("%d", &(p[i])); } for ...
[["-", 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, 22]]
0
189
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #pragma comment(linker, "/stack:200000000") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=nati...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #pragma comment(linker, "/stack:200000000") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=nati...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
799
#include <algorithm> #include <fstream> #include <iostream> #include <stdio.h> #include <vector> using std::cin; using std::cout; using std::endl; using std::find; using std::sort; using std::terminate; using std::vector; template <class T> inline T min(T X, T Y) { return X < Y ? X : Y; } template <class T> inline T...
#include <algorithm> #include <fstream> #include <iostream> #include <stdio.h> #include <vector> using std::cin; using std::cout; using std::endl; using std::find; using std::sort; using std::terminate; using std::vector; template <class T> inline T min(T X, T Y) { return X < Y ? X : Y; } template <class T> inline T...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
330
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int main() { int X, N; cin >> X >> N; set<int> p; rep(i, N) { int pi; cin >> pi; p.insert(pi); } rep(i, N) { if (!p.count(X - i)) { cout << X - i << 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; int main() { int X, N; cin >> X >> N; set<int> p; rep(i, N) { int pi; cin >> pi; p.insert(pi); } rep(i, N + 1) { if (!p.count(X - i)) { cout << X - i << endl; retu...
[["+", 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], ["+", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 14, 8, 9, 0, 46]]
1
127
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,default...
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,default...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
463
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; bool visited[n]; memset(visited, 0, sizeof(visited)); int u; for (int i = 0; i < n; i++) { cin >> u; visited[u] = true; } int smaller = x, larger = x; while (true) { if (!visited[smaller]) { cout <<...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; bool visited[150]; memset(visited, false, sizeof(visited)); int u; for (int i = 0; i < n; i++) { cin >> u; visited[u] = true; } int smaller = x, larger = x; while (true) { // cout // <<smaller<<","<<l...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 147]]
1
130
#include <iostream> #include <set> int X, N; int main() { std::cin >> X >> N; std::set<int> P; for (int i = 0; i < N; ++i) { int x; std::cin >> x; P.insert(x); } if (P.find(X) == P.end()) std::cout << X << "\n"; else { int left = X, right = X; while (P.find(left) != P.end()) ...
#include <iostream> #include <set> int X, N; int main() { std::cin >> X >> N; std::set<int> P; for (int i = 0; i < N; ++i) { int x; std::cin >> x; P.insert(x); } if (P.find(X) == P.end()) std::cout << X << "\n"; else { int left = X, right = X; while (P.find(left) != P.end()) ...
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 17, 18], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 19]]
1
161
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = 0; 1; i++) { bool flag = true; for (int j = 0; j < n; j++) { if (p[j] == x - i) { flag = false; break; } } ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; i++) cin >> p[i]; for (int i = 0; 1; i++) { bool flag = true; for (int j = 0; j < n; j++) { if (p[j] == x - i) { flag = false; break; } } ...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]]
1
180
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pi 3.141592653589793238 #define MOD 1000000007 #define int long long #define vi vector<long long int> #define pb push_back #define rep(i, a, n) for (int i = (a); i < (n); ++i) using namespace __gnu_pbds; using...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pi 3.141592653589793238 #define MOD 1000000007 #define int long long #define vi vector<long long int> #define pb push_back #define rep(i, a, n) for (int i = (a); i < (n); ++i) using namespace __gnu_pbds; using...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
400
x,n =map(int,input().split()) if n ==0: print(x) p =list(map(int,input().split())) l = [] for i in range(51): if x-i not in p and x+i not in p: print(min(x-i,x+i)) exit() elif x-i not in p and x+i in p: print(x-i) exit() elif x-i in p and x+i not in p: print(x+i) ...
x,n =map(int,input().split()) if n ==0: print(x) exit() p =list(map(int,input().split())) l = [] for i in range(51): if x-i not in p and x+i not in p: print(min(x-i,x+i)) exit() elif x-i not in p and x+i in p: print(x-i) exit() elif x-i in p and x+i not in p: ...
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
131
x, n = map(int, input().split()) if n != 0: l = list(map(int, input().split())) else: l = [] diff = 10**10 ans = 10**10 for i in range(101): if i in l: continue else: if abs(x-i) < diff: ans = i diff = abs(x-i) print(ans)
x, n = map(int, input().split()) if n != 0: l = list(map(int, input().split())) else: l = [] diff = 10**18 ans = 10**18 for i in range(-10000, 10000): if i in l: continue else: if abs(x-i) < diff: ans = i diff = abs(x-i) print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 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
95
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int ans; int min = 1000; for (int i = -100; i <= 100; i++) { bool skip = false; for (int j = 0; j < n; j++) if (i == v[j]) skip = true...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int ans; int min = 1000; for (int i = -100; i <= 200; i++) { bool skip = false; for (int j = 0; j < n; j++) if (i == v[j]) skip = true...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
150
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } vector<int> p(n); for (auto &a : p) cin >> a; for (int i = 0; i < n; i++) { if (std::find(p.begin(), p.end(), x - i) != p.end()) { cout << x - i << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } vector<int> p(n); for (auto &a : p) cin >> a; for (int i = 0; i <= n; i++) { if (std::find(p.begin(), p.end(), x - i) == p.end()) { cout << x - i << endl; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
159
#include <bits/stdc++.h> using namespace std; #define int long long int #define double long double #define pb push_back #define fi first #define se second #define vii vector<int> #define pii pair<int, int> #define vpii vector<pii> #define pq priority_queue<int> #define test ...
#include <bits/stdc++.h> using namespace std; #define int long long int #define double long double #define pb push_back #define fi first #define se second #define vii vector<int> #define pii pair<int, int> #define vpii vector<pii> #define pq priority_queue<int> #define test ...
[["-", 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
224
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int x, n; cin >> x >> n; vector<int> p; rep(i, n) { int t; cin >> t; p.push_back(t); } vector<int> np; for (int i = 1; i <= 100; i++) { bool f = true; for (int j = 0; j < (int)p....
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int x, n; cin >> x >> n; vector<int> p; rep(i, n) { int t; cin >> t; p.push_back(t); } vector<int> np; for (int i = 0; i <= 101; i++) { bool f = true; for (int j = 0; j < (int)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
225
x,n = map(int,input().split()) if n>0: p = list(map(int,input().split())) tmp = 0 diff = 10000000 for i in range(200): if abs(x-i)<diff and i not in p: tmp = i diff = abs(x-i) print(tmp) else: print(n)
x,n = map(int,input().split()) if n>0: p = list(map(int,input().split())) tmp = -100 diff = 10000000 for i in range(0,102): if abs(x-i)<diff and i not in p: tmp = i diff = abs(x-i) print(tmp) else: print(x)
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["...
5
88
#include <bits/stdc++.h> #pragma GCC optimize("O3") #define fi first #define se second #define em emplace #define eb emplace_back #define mp make_pair #define pi pair<int, int> #define vi vector<int> #define vpi vector<pair<int, int>> #define vll vector<ll> #define vpll vector<pair<ll, ll>> #define endl '\n' #define ...
#include <bits/stdc++.h> #pragma GCC optimize("O3") #define fi first #define se second #define em emplace #define eb emplace_back #define mp make_pair #define pi pair<int, int> #define vi vector<int> #define vpi vector<pair<int, int>> #define vll vector<ll> #define vpll vector<pair<ll, ll>> #define endl '\n' #define ...
[["-", 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
301
import sys def input(): return sys.stdin.readline().rstrip() def main(): x,n=map(int,input().split()) P = list(map(int,input().split())) n_lis = [0]*102 print(n_lis) for p in P: n_lis[p] += 1 dis = 0 while 1: if n_lis[x-dis] == 0: print(x-dis) break ...
import sys def input(): return sys.stdin.readline().rstrip() def main(): x,n=map(int,input().split()) P = list(map(int,input().split())) n_lis = [0]*102 for p in P: n_lis[p] += 1 dis = 0 while 1: if n_lis[x-dis] == 0: print(x-dis) break elif n_lis[...
[["-", 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
132
x,n = gets.split.map(&:to_i) a = gets.split.map(&:to_i) h = {} a.each{|i| h[i] = true} dif = 100 ans = 0 101.times{|i| if !h[i] && dif > (x-i).abs ans = i dif = (x-i).abs end } p ans
x,n = gets.split.map(&:to_i) a = gets.split.map(&:to_i) h = {} a.each{|i| h[i] = true} dif = 100 ans = 0 (-100..101).each{|i| if !h[i] && dif > (x-i).abs ans = i dif = (x-i).abs end } p ans
[["+", 36, 36, 0, 493, 0, 652, 486, 739, 0, 24], ["+", 0, 652, 486, 739, 0, 475, 756, 748, 17, 33], ["+", 0, 652, 486, 739, 0, 475, 756, 748, 439, 612], ["+", 0, 493, 0, 652, 486, 739, 0, 475, 17, 757], ["+", 36, 36, 0, 493, 0, 652, 486, 739, 0, 25], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36,...
4
87
const main = (input) => { input = input.trim().split('\n') const [x, ] = input[0].split(' ').map(Number) if (input.length === 1) return console.log(x) const arr = input[1].split(' ').map(Number).sort((a, b) => a - b) for (let abs = 1; 'infinite'; abs++) { if (!arr.includes(x ...
const main = (input) => { input = input.trim().split('\n') const [x, ] = input[0].split(' ').map(Number) if (input.length === 1) return console.log(x) const arr = input[1].split(' ').map(Number).sort((a, b) => a - b) for (let abs = 0; 'infinite'; abs++) { if (!arr.includes(x ...
[["-", 8, 556, 0, 7, 10, 570, 0, 200, 51, 555], ["+", 8, 556, 0, 7, 10, 570, 0, 200, 51, 555]]
2
213
//============================================================================ /* "There is nothing that can take the pain away, But eventually you will find a way to live with it" */ // Author : Murad // Online Judge: Codeforces.cpp & Atcoder.cpp // Description : Problem name //===========================...
//============================================================================ /* "There is nothing that can take the pain away, But eventually you will find a way to live with it" */ // Author : Murad // Online Judge: Codeforces.cpp & Atcoder.cpp // Description : Problem name //===========================...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
1,144
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, ll> Pil; int X, N; int p[110]; int main() { cin >> X >> N; for (int i = 0; i < N; i++) cin >> p[i]; bool is_exist[101]; memset(is_exist, false, sizeof(is_exist)); for (int i = 0; i < N; i++) { is_exist[p[i]] = tr...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, ll> Pil; int X, N; int p[110]; int main() { cin >> X >> N; for (int i = 0; i < N; i++) cin >> p[i]; bool is_exist[101]; memset(is_exist, false, sizeof(is_exist)); for (int i = 0; i < N; i++) { is_exist[p[i]] = tr...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
209
#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; if (n == 0) { cout << x << endl; return 0; } vector<int> p(n); rep(i, n) cin >> p[i]; sort(p.begin(), p.end()); que...
#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; if (n == 0) { cout << x << endl; return 0; } vector<int> p(n); rep(i, n) cin >> p[i]; sort(p.begin(), p.end()); que...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
228
#include <bits/stdc++.h> using namespace std; int main() { int x, n, p; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } set<int> P; for (int i = 0; i < n; ++i) { cin >> p; P.insert(p); } int ans = 0, min = 1e9; for (int i = 1; i < 101; ++i) { if (P.count(i)) cont...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, p; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } set<int> P; for (int i = 0; i < n; ++i) { cin >> p; P.insert(p); } int ans = 0, min = 1e9; for (int i = -1001; i < 1001; ++i) { if (P.count(i)) ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
143
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { int x, n, ans = -1; cin >> x >> n; int aa; // int min1 = 101,min2=101; vector<bool> a(102, true); rep(i, n) { cin >> aa; a[aa] = false; } // sort(a.begin(),a.end(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { int x, n, ans = -1; cin >> x >> n; int aa; // int min1 = 101,min2=101; vector<bool> a(102, true); rep(i, n) { cin >> aa; a[aa] = false; } // sort(a.begin(),a.end(...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
129
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; unordered_set<int> hashset; for (int i = 0; i < n; ++i) { int p; cin >> p; hashset.insert(p); } int min_diff = 100; int min_val = 100; for (int val = 100; val >= 1; val--) { if (hashset.find(val) == hash...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; unordered_set<int> hashset; for (int i = 0; i < n; ++i) { int p; cin >> p; hashset.insert(p); } int min_diff = 100; int min_val = 100; for (int val = 101; val >= 0; val--) { if (hashset.find(val) == hash...
[["-", 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
134
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int x, n, ans = -1, cur = 1e9; cin >> x >> n; map<int, int> p; rep(i, n) { int a; cin >> a; p[a]++; } for (int i = 0; i <= 100; i++) { if (p[i] > 0) continue; if (abs(x -...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int x, n, ans = -1, cur = 1e9; cin >> x >> n; map<int, int> p; rep(i, n) { int a; cin >> a; p[a]++; } for (int i = 0; i <= 101; i++) { if (p[i] > 0) continue; if (abs(x -...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
127
#include <bits/stdc++.h> using namespace std; int main(void) { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; ++i) cin >> p[i]; vector<bool> q(101, true); for (int i = 0; i < n; ++i) q[p[i]] = false; vector<int> r; for (int i = 0; i < 101; ++i) if (q[i] == true) r.pu...
#include <bits/stdc++.h> using namespace std; int main(void) { int x, n; cin >> x >> n; vector<int> p(n); for (int i = 0; i < n; ++i) cin >> p[i]; vector<bool> q(102, true); for (int i = 0; i < n; ++i) q[p[i]] = false; vector<int> r; for (int i = 0; i < 102; ++i) if (q[i] == true) r.pu...
[["-", 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
217
#include <algorithm> #include <iostream> #include <limits> #include <numeric> #include <set> #include <string> #include <vector> #define rep(i, x, n) for (int i = x; i < n; i++) using namespace std; const long long INF = 1LL << 60; bool cont(vector<int> v, int k, int size) { for (int i = 0; i < size; i++) { if ...
#include <algorithm> #include <iostream> #include <limits> #include <numeric> #include <set> #include <string> #include <vector> #define rep(i, x, n) for (int i = x; i < n; i++) using namespace std; const long long INF = 1LL << 60; bool cont(vector<int> v, int k, int size) { for (int i = 0; i < size; i++) { if ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
203
#include <bits/stdc++.h> using namespace std; int main() { int x, n; scanf("%d%d", &x, &n); map<int, int> mp; for (int i = 0; i < n; i++) { int q; scanf("%d", &q); mp[q] = 1; } int cek = 1e4; int ans = x; for (int i = -100; i <= 100; i++) { if (mp[i]) continue; else if (abs(x...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; scanf("%d%d", &x, &n); map<int, int> mp; for (int i = 0; i < n; i++) { int q; scanf("%d", &q); mp[q] = 1; } int cek = 1e4; int ans = x; for (int i = -101; i <= 101; i++) { if (mp[i]) continue; else if (abs(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], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 31, 22], ["-", 51, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 16, 31, 2,...
1
148
#include <algorithm> #include <iostream> #include <set> using namespace std; int main() { set<int> s; int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } for (int i = 0; i < n; i++) { int a; cin >> a; s.insert(a); } int idx = 1; while (true) { if (s.find(x ...
#include <algorithm> #include <iostream> #include <set> using namespace std; int main() { set<int> s; int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } for (int i = 0; i < n; i++) { int a; cin >> a; s.insert(a); } int idx = 0; while (true) { if (s.find(x ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
155
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') #define Lower_bound(v, x) \ distance(v.begin(), lower_bound(v.beg...
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') #define Lower_bound(v, x) \ distance(v.begin(), lower_bound(v.beg...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
322
#include <algorithm> #include <bits/stdc++.h> #include <stdlib.h> using namespace std; int main() { ios::sync_with_stdio(0); int X, N, p; vector<int> list; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p; list.push_back(p); } list.push_back(101); for (int j = 0; j <= N + 1; j++) { v...
#include <algorithm> #include <bits/stdc++.h> #include <stdlib.h> using namespace std; int main() { ios::sync_with_stdio(0); int X, N, p; vector<int> list; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p; list.push_back(p); } list.push_back(10100); for (int j = 0; j <= N + 1; j++) { ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
201
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; ...
#include <bits/stdc++.h> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) using namespace std; const long long INF = 1LL << 60; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
231
X, N = list(map(int, input().split())) if N!=0: P = set(list(map(int, input().split()))) else: print(X) exit(0) dist = 100 r = None for i in range(100, -1, -1): if not i in P and abs(X-i) <= dist: dist = abs(X-i) # print (i, dist) r = i print(r)
X, N = list(map(int, input().split())) if N!=0: P = set(list(map(int, input().split()))) else: print(X) exit(0) dist = 100 r = None for i in range(105, -1, -1): if not i in P and abs(X-i) <= dist: dist = abs(X-i) r = i print(r)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
105
x, n = [int(i) for i in input().split()] a = [int(i) for i in input().split()] if n != 0 else [] min_ = 100 cnt = 0 for i in range(100 + 1): if abs(i - x) < min_ and not i in a: min_ = abs(i - x) cnt = i print(cnt)
x, n = [int(i) for i in input().split()] a = [int(i) for i in input().split()] if n != 0 else [] min_ = 100 cnt = 0 for i in range(100 + 2): if abs(i - x) < min_ and not i in a: min_ = abs(i - x) cnt = i print(cnt)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
91
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll X, N; cin >> X >> N; vector<ll> p(N); for (int i = 0; i < N; ++i) cin >> p[i]; ll res = 100000; ll out = 0; for (int i = 0; i < 101; ++i) { if (p.end() != find(p.begin(), p.end(), i)) continue; else { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll X, N; cin >> X >> N; vector<ll> p(N); for (int i = 0; i < N; ++i) cin >> p[i]; ll res = 100000; ll out = 0; for (int i = 0; i < 105; ++i) { if (p.end() != find(p.begin(), p.end(), i)) continue; else { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
149
#include <bits/stdc++.h> #include <chrono> #include <math.h> using namespace std; using ll = long long; using ld = long double; using namespace std::chrono; #define fo(i, z, n) for (int i = z; i < n; i++) #define Fo(i, z, n) for (ll i = z; i < n; i++) #define INT_BITS 32 #define mod 1000000007 #define vi vector<int> #d...
#include <bits/stdc++.h> #include <chrono> #include <math.h> using namespace std; using ll = long long; using ld = long double; using namespace std::chrono; #define fo(i, z, n) for (int i = z; i < n; i++) #define Fo(i, z, n) for (ll i = z; i < n; i++) #define INT_BITS 32 #define mod 1000000007 #define vi vector<int> #d...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
304
X, N = map(int, input().split()) ans = 0 if N > 0: p = list(map(int, input().split())) r = [i for i in range(-101, 101) if i not in p] d = [abs(X-i) for i in r] ans = r[d.index(min(d))] else: ans = X print(ans)
X, N = map(int, input().split()) ans = 0 if N > 0: p = list(map(int, input().split())) r = [i for i in range(102) if i not in p] d = [abs(X-i) for i in r] ans = r[d.index(min(d))] else: ans = X print(ans)
[["-", 0, 659, 12, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 659, 12, 652, 3, 4, 0, 664, 28, 612], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
98
def run(): X, N = [int(v) for v in input().rstrip().split()] p = [] if N > 0: p = [int(v) for v in input().rstrip().split()] i = -1 try: i = p.index(X) except ValueError: pass if i == -1: # not contained return X d1 = {} for k in range(0, 101): d1[k] = k for v in p: del d1[v] l2 = sorted(...
def run(): X, N = [int(v) for v in input().rstrip().split()] p = [] if N > 0: p = [int(v) for v in input().rstrip().split()] i = -1 try: i = p.index(X) except ValueError: pass if i == -1: # not contained return X d1 = {} for k in range(0, 102): d1[k] = k for v in p: del d1[v] l2 = sorted(...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
252
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; #define rep(i, n) for (int i = 0; i < (int)(n); i++) // __uint128_t const ll MOD = 1e9 + 7; int main() { ll X, N; cin >> X >> N; set<ll> ST; for (int i = 0; i < N; i++) { ll a; cin >> a; ST.insert(a); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; #define rep(i, n) for (int i = 0; i < (int)(n); i++) // __uint128_t const ll MOD = 1e9 + 7; int main() { ll X, N; cin >> X >> N; set<ll> ST; for (int i = 0; i < N; i++) { ll a; cin >> a; ST.insert(a); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
162
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int x...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int x...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
234
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> P(N); for (int i = 0; i < N; i++) { cin >> P.at(i); } bool judge = false; int i = 1; int ans = 0; while (!(judge)) { if (!(find(P.begin(), P.end(), X + i) != P.end())) { ans = X + i; j...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> P(N); for (int i = 0; i < N; i++) { cin >> P.at(i); } bool judge = false; int i = 0; int ans = 0; while (!(judge)) { if (!(find(P.begin(), P.end(), X + i) != P.end())) { ans = X + i; j...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
174
x,n = map(int,input().split()) if n == 0: print(x) exit() l = set(list(map(int,input().split()))) for i in range(1,max(x,100-x)+1): if x-i not in l: print(x-i) exit() if x+i not in l: print(x+i) exit()
x,n = map(int,input().split()) if n == 0: print(x) exit() l = set(list(map(int,input().split()))) for i in range(max(x,100-x)+1): if x-i not in l: print(x-i) exit() if x+i not in l: print(x+i) exit()
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
101
// given n integers and an integer m such that n>m then there exits a pair //(a-b) such that (a-b)%m==0 #include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll M = 1000000007; void solve() { int x, n; cin >> x >> n; int a[n], mini = INT_MAX; vector<pair<int, int>> tans; for (int i = ...
// given n integers and an integer m such that n>m then there exits a pair //(a-b) such that (a-b)%m==0 #include <bits/stdc++.h> using namespace std; typedef long long int ll; const ll M = 1000000007; void solve() { int x, n; cin >> x >> n; int a[n], mini = INT_MAX; vector<pair<int, int>> tans; for (int 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
232
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; map<int, int> mapAll; for (int i = 0; i < 101; i++) { mapAll[i] = abs(X - i); } vector<int> P(N); for (int i = 0; i < N; i++) { cin >> P[i]; mapAll.erase(P[i]); } int A = 100; int ans; for (auto p :...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; map<int, int> mapAll; for (int i = 0; i < 102; i++) { mapAll[i] = abs(X - i); } vector<int> P(N); for (int i = 0; i < N; i++) { cin >> P[i]; mapAll.erase(P[i]); } int A = 100; int ans; for (auto p :...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
149
#include <bits/stdc++.h> #include <iostream> using namespace std; #define mod 1000000000000000007 #define pi 3.1415926535897932384626433832795 #define ll long long #define pb push_back #define pii pair<int, int> #define vecsort(v) sort(v.begin(), v.end()) #define lcm(x, y) (x / __gcd(x, y)) * y #define forn(i, n) for ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define mod 1000000000000000007 #define pi 3.1415926535897932384626433832795 #define ll long long #define pb push_back #define pii pair<int, int> #define vecsort(v) sort(v.begin(), v.end()) #define lcm(x, y) (x / __gcd(x, y)) * y #define forn(i, n) for ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
198
#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 < (int)(n); i++) #define repr(i, a, b) for (int i = a; i < b; i++) #define each(i, mp) for (auto &i : mp) const int INF = 1001001001; int main() { int x, n; cin >> x >> n; vector<in...
#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 < (int)(n); i++) #define repr(i, a, b) for (int i = a; i < b; i++) #define each(i, mp) for (auto &i : mp) const int INF = 1001001001; int main() { int x, n; cin >> x >> n; vector<in...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
213
#include <bits/stdc++.h> using namespace std; typedef long long ll; const long long INF = 1LL << 60; // intじゃ扱えないことに注意! using P = pair<int, int>; #define rep(i, n) \ for (int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意! int main() { int X, N; cin >> X...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const long long INF = 1LL << 60; // intじゃ扱えないことに注意! using P = pair<int, int>; #define rep(i, n) \ for (int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意! int main() { int X, N; cin >> X...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13]]
1
184
x,n = map(int,input().split()) if n == 0: print(x) else: p = list(map(int,input().split())) absolute = list(map(lambda i:abs(i-x),p)) if 0 not in absolute: print(x) else: ab = set(absolute) i = 1 while i < 100: if absolute.count(i) == 2: i ...
x,n = map(int,input().split()) if n == 0: print(x) else: p = list(map(int,input().split())) absolute = list(map(lambda i:abs(i-x),p)) if 0 not in absolute: print(x) else: ab = set(p) i = 1 while i < 100: if absolute.count(i) == 2: i += 1 ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
131
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> V(N); for (int i = 0; i < N; i++) { cin >> V.at(i); } int m = 101, mi = 0, s = 0, cont; for (int i = 100; i >= -100; i--) { cont = 0; for (int j = 0; j < N; j++) { if (V.at(j) == i) { ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> V(N); for (int i = 0; i < N; i++) { cin >> V.at(i); } int m = 101, mi = 0, s = 0, cont; for (int i = 101; i >= -1; i--) { cont = 0; for (int j = 0; j < N; j++) { if (V.at(j) == 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
201
#include <bits/stdc++.h> using namespace std; #define ALL(a) (a).begin(), (a).end() #define rALL(a) (a).rbegin(), (a).rend() typedef pair<int, int> Pint; typedef pair<int64_t, int64_t> Pll; typedef int64_t ll; int main() { int X, N; Pint ans = make_pair(999999, 99999); cin >> X >> N; set<int> A; for (int i =...
#include <bits/stdc++.h> using namespace std; #define ALL(a) (a).begin(), (a).end() #define rALL(a) (a).rbegin(), (a).rend() typedef pair<int, int> Pint; typedef pair<int64_t, int64_t> Pll; typedef int64_t ll; int main() { int X, N; Pint ans = make_pair(999999, 99999); cin >> X >> N; set<int> A; for (int 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
172
#include "bits/stdc++.h" using namespace std; int main() { int x, n, ans, a, b; cin >> x >> n; if (n == 0) { ans = x; } else { vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p.at(i); } for (int i = x; i <= 100; i++) { int h = 0; for (int j = 0; j < n; j++) { ...
#include "bits/stdc++.h" using namespace std; int main() { int x, n, ans, a, b; cin >> x >> n; if (n == 0) { ans = x; } else { vector<int> p(n); for (int i = 0; i < n; i++) { cin >> p.at(i); } for (int i = x; i <= 101; i++) { int h = 0; for (int j = 0; j < n; j++) { ...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
245
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define mod 1000000007 #define pi 3.141592653589793 typedef vector<ll> vcl; ll gcd(ll a, ll b) { if (b > a) swap(a, b); if (b == 0) return a; return gcd(b, a % b)...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define mod 1000000007 #define pi 3.141592653589793 typedef vector<ll> vcl; ll gcd(ll a, ll b) { if (b > a) swap(a, b); if (b == 0) return a; return gcd(b, a % b)...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
373
#include <iostream> using namespace std; int a[201] = {0}; int main() { int x, n, b; cin >> x >> n; while (n--) { cin >> b; a[b + 100] = 1; } for (int d = 1;; d++) { if (a[x + 100 - d] == 0) { cout << x - d; return 0; } if (a[x + 100 + d] == 0) { cout << x + d; retu...
#include <iostream> using namespace std; int a[201] = {0}; int main() { int x, n, b; cin >> x >> n; while (n--) { cin >> b; a[b + 100] = 1; } for (int d = 0;; d++) { if (a[x + 100 - d] == 0) { cout << x - d; return 0; } if (a[x + 100 + d] == 0) { cout << x + d; retu...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
116
/* Author : Xinyuan */ #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() typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<string> VS; typedef vector<PII> VII; typedef vector<VI> VVI; typedef long long int ll; const int INF...
/* Author : Xinyuan */ #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() typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<string> VS; typedef vector<PII> VII; typedef vector<VI> VVI; typedef long long int ll; const int INF...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
290
// Problem : C - Forbidden List // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #define pb push_back #define fi firs...
// Problem : C - Forbidden List // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> #define pb push_back #define fi firs...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
1,017
#include <iostream> #include <math.h> using namespace std; bool cnt[106]; int main() { int n, x; cin >> x >> n; for (int i = 0, y; i < n; ++i) cin >> y, cnt[y] = 1; int ans = x, cur = -1; for (int i = 0; i < 205; ++i) { if (cnt[i]) continue; if (abs(x - i) < cur) cur = abs(x - i), ans...
#include <iostream> #include <math.h> using namespace std; bool cnt[106]; int main() { int n, x; cin >> x >> n; for (int i = 0, y; i < n; ++i) cin >> y, cnt[y] = 1; int ans = x, cur = 1e9; for (int i = 0; i < 205; ++i) { if (cnt[i]) continue; if (abs(x - i) < cur) cur = abs(x - i), an...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
120
// Problem : C - Forbidden List // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_c?lang=en // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define ...
// Problem : C - Forbidden List // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_c?lang=en // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define ...
[["-", 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
202
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // int t; // cin>>t; // while(t--) // { // } int x, n; cin >> x >> n; bool f[101] = {false}; for (int i = 0; i < n; i++) { int k; cin >> k; f[k] = t...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // int t; // cin>>t; // while(t--) // { // } int x, n; cin >> x >> n; bool f[102] = {false}; for (int i = 0; i < n; i++) { int k; cin >> k; f[k] = t...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
161
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; ++i) { cin >> p[i]; } bool num[101] = {}; for (int i = 0; i < N; ++i) { num[p[i]] = true; } int min_abs = 101, ans = 0; for (int i = 0; i <= 100; ++i) { if (!nu...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); for (int i = 0; i < N; ++i) { cin >> p[i]; } bool num[201] = {}; for (int i = 0; i < N; ++i) { num[p[i]] = true; } int min_abs = 101, ans = 0; for (int i = 0; i <= 200; ++i) { if (!nu...
[["-", 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
153
#include <bits/stdc++.h> using namespace std; bool chkx(vector<int> a, int x); int main() { bool isFind = false, ism = true; int x = 0, n = 0, ans = 0; cin >> x >> n; cerr << x << " " << n << endl; vector<int> m(n); for (int i = 0; i < n; i++) { cerr << i << endl; cin >> m.at(i); cerr << "raw...
#include <bits/stdc++.h> using namespace std; bool chkx(vector<int> a, int x); int main() { bool isFind = false, ism = true; int x = 0, n = 0, ans = 0; cin >> x >> n; cerr << x << " " << n << endl; vector<int> m(n); for (int i = 0; i < n; i++) { cerr << i << endl; cin >> m.at(i); cerr << "raw...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]]
1
282
#include <iostream> using namespace std; #include <vector> int main() { int X, N; cin >> X >> N; int p[101] = {}; for (int i = 0; i < N; i++) { int a; cin >> a; p[a] = -1; } int l = X, r = X; for (int i = 0; i < N; i++) { if (p[l] == -1) l--; if (p[r] == -1) r++; } if (...
#include <iostream> using namespace std; #include <vector> int main() { int X, N; cin >> X >> N; int p[101] = {}; for (int i = 0; i < N; i++) { int a; cin >> a; p[a] = -1; } int l = X, r = X; for (int i = 0; i < N; i++) { if (p[l] == -1) l--; if (p[r] == -1) r++; } if (...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33]]
1
140
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007 #define speed \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) using namespace std; int main() { speed; ll X, N, p, mini = 10000, an...
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007 #define speed \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) using namespace std; int main() { speed; ll X, N, p, mini = 10000, an...
[["-", 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
177
#include <iostream> using namespace std; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int P[N]; int pi; int i; for (i = 0; i < N; i++) { cin >> pi; P[i] = pi; } bool flag; flag = false; for (i = 0; i < N; i++) { if (P[i] == X) { ...
#include <iostream> using namespace std; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int P[N]; int pi; int i; for (i = 0; i < N; i++) { cin >> pi; P[i] = pi; } bool flag; flag = false; for (i = 0; i < N; i++) { if (P[i] == X) { ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
329
#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 INF = 101; int main() { int X; cin >> X; int N; cin >> N; int min = INF, num, def; vector<int> p(N); rep(i, N) cin >> p.at(i); bool nt = false; rep(i, 101) ...
#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 INF = 101; int main() { int X; cin >> X; int N; cin >> N; int min = INF, num, def; vector<int> p(N); rep(i, N) cin >> p.at(i); bool nt = false; rep(i, 102) ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
171
#include <bits/stdc++.h> #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define endl "\n" #define rep(i, a, n...
#include <bits/stdc++.h> #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define endl "\n" #define rep(i, a, n...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72]]
1
248
/* ID: rajiv TASK: test LANG: C++14 */ #include <algorithm> #include <chrono> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_se...
/* ID: rajiv TASK: test LANG: C++14 */ #include <algorithm> #include <chrono> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_se...
[["-", 0, 52, 8, 9, 0, 42, 0, 2, 63, 22], ["-", 8, 9, 0, 42, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 42, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 42, 0, 2, 3, 4, 0, 25]]
1
522
#include <bits/stdc++.h> #define endl "\n" #define pb push_back #define ll long long #define d1(x) cerr << #x << "--> " << x << endl #define d2(x, y) cerr << #x << "--> " << x << " | " << #y << "--> " << y << endl #define d3(x, y, z) \ cerr << #x << "--> " <<...
#include <bits/stdc++.h> #define endl "\n" #define pb push_back #define ll long long #define d1(x) cerr << #x << "--> " << x << endl #define d2(x, y) cerr << #x << "--> " << x << " | " << #y << "--> " << y << endl #define d3(x, y, z) \ cerr << #x << "--> " <<...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
487
#include <iostream> using namespace std; int main(void) { // Your code here! int X; int N; int min = 101; int ans = 101; cin >> X >> N; int p[N]; if (N == 0) { cout << X << endl; } else { for (int i = 0; i < N; i++) { cin >> p[i]; } int pre; for (int j = 1; j <= 100; j++) { ...
#include <iostream> using namespace std; int main(void) { // Your code here! int X; int N; int min = 101; int ans = 101; cin >> X >> N; int p[N]; if (N == 0) { cout << X << endl; } else { for (int i = 0; i < N; i++) { cin >> p[i]; } int pre; for (int j = -10; j <= 110; j++) {...
[["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
168
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 5; int main(void) { int x, n; cin >> x >> n; int a[105]; memset(a, 0, sizeof(a)); for (int i = 0; i < n; ++i) { int in; cin >> in; ++a[in]; } if (!n) { cout << x << endl; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 5; int main(void) { int x, n; cin >> x >> n; int a[105]; memset(a, 0, sizeof(a)); for (int i = 0; i < n; ++i) { int in; cin >> in; ++a[in]; } if (!n) { cout << x << endl; ...
[["-", 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
179
#include <bits/stdc++.h> typedef long long ll; #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define AA(i) cout << i << endl; #define AS(i) cout << i << " "; const int INF = 1001001001; const double PI = 3.14159; using namespace std; vector<ll> mem...
#include <bits/stdc++.h> typedef long long ll; #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define AA(i) cout << i << endl; #define AS(i) cout << i << " "; const int INF = 1001001001; const double PI = 3.14159; using namespace std; vector<ll> mem...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
190
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, m, n, x, u, v, z; cin >> x >> n; map<int, int> mp; for (i = 0; i < n; i++) { cin >> v; mp[v]++; } j = 0; while (1) { u = x + j; v = x - j; if (mp.find(u) == mp.end()) { cout << u << "\n"; break; } ...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, m, n, x, u, v, z; cin >> x >> n; map<int, int> mp; for (i = 0; i < n; i++) { cin >> v; mp[v]++; } j = 0; while (1) { v = x + j; u = x - j; if (mp.find(u) == mp.end()) { cout << u << "\n"; break; } ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
149
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; #define fast ios_base::sync_with_stdio(false), cin.tie(nullptr) int main() { fast; int t; cin >> t; while (t--) { int n, x, ans = x; cin >> x >> n; vector<int> a(n); int flag = 0; // check if x is present in ...
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; #define fast ios_base::sync_with_stdio(false), cin.tie(nullptr) int main() { fast; int t = 1; // cin>>t; while (t--) { int n, x, ans = x; cin >> x >> n; vector<int> a(n); int flag = 0; // check if x is present ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
370
// inlclude前用define #define _USE_MATH_DEFINES // include #include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <type_traits> #include <vector> //#include<deque> #include <iomanip> #include <limits> #include <map> #include <set> #include <tuple> using namespace std; /...
// inlclude前用define #define _USE_MATH_DEFINES // include #include <algorithm> #include <cmath> #include <iostream> #include <numeric> #include <string> #include <type_traits> #include <vector> //#include<deque> #include <iomanip> #include <limits> #include <map> #include <set> #include <tuple> using namespace std; /...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
193
// // main.cpp // ABC170C #include <iostream> #include <set> using namespace std; int main(int argc, const char *argv[]) { int X, N; cin >> X >> N; set<int> st; for (int i = 0; i <= 100; i++) { st.insert(i); } int p; for (int i = 0; i < N; i++) { cin >> p; st.erase(p); } int min = 100100...
// // main.cpp // ABC170C #include <iostream> #include <set> using namespace std; int main(int argc, const char *argv[]) { int X, N; cin >> X >> N; set<int> st; // 答えの範囲は0〜101になる for (int i = 0; i <= 101; i++) { st.insert(i); } int p; for (int i = 0; i < N; i++) { cin >> p; st.erase(p); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
150
x, n = map(int, input().split()) if n == 0: print(x) else: l = list(map(int, input().split())) tmp = x while x: if not x in l: print(x) break elif not tmp in l: print(tmp) break x -= 1 tmp += 1
x, n = map(int, input().split()) if n == 0: print(x) else: l = list(map(int, input().split())) tmp = x i = 1 while i: if not x in l: print(x) break elif not tmp in l: print(tmp) break x -= 1 tmp += 1
[["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 57, 75, 76, 8, 196, 0, 52, 15, 22], ["+", 0, 57, 75, 76, 8, 196, 0, 52, 15, 22]]
5
78
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define endl '\n' #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define endl '\n' #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
193
#include <iostream> using namespace std; bool CheckValue(int value, int p[], int n) { for (int i = 0; i < n; i++) { if (value == p[i]) return false; } return true; } int main() { int x, n; int *p; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } p = new int[n]; for (...
#include <iostream> using namespace std; bool CheckValue(int value, int p[], int n) { for (int i = 0; i < n; i++) { if (value == p[i]) return false; } return true; } int main() { int x, n; int *p; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } p = new int[n]; for (...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
201
function main(input) { var input = input.trim(); var input = input.split("\n"); var kazu = parseInt(input[0].split(" ")[0]); var answer = kazu; if (input[1]) { var fList = input[1].split(" "); } else { fList = []; } for (var i = -100; i < fList.length; i++) { fList[i] = parseInt(fList[i]); ...
function main(input) { var input = input.trim(); var input = input.split("\n"); var kazu = parseInt(input[0].split(" ")[0]); var answer; if (input[1]) { var fList = input[1].split(" "); } else { fList = []; } for (var i = 0; i < fList.length; i++) { fList[i] = parseInt(fList[i]); } var n...
[["-", 0, 435, 8, 556, 0, 198, 0, 200, 0, 32], ["-", 0, 435, 8, 556, 0, 198, 0, 200, 51, 22], ["-", 0, 7, 10, 198, 0, 200, 51, 91, 17, 33], ["-", 0, 7, 10, 198, 0, 200, 51, 91, 28, 555], ["+", 8, 556, 0, 7, 10, 198, 0, 200, 51, 555], ["-", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555], ["+", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555]...
2
234
X,N = map(int,input().split()) if N == 0: print(X) exit(); p = [int(i) for i in input().split()] q = set(range(101)) - set(p) r = sorted(q,key=lambda x:(abs(x-X),x)) print(r[0])
X,N = map(int,input().split()) if N == 0: print(X) exit(); p = [int(i) for i in input().split()] q = set(range(102)) - set(p) r = sorted(q,key=lambda x:(abs(x-X),x)) print(r[0])
[["-", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
90
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; #define ll long long #define bit(x, i) (x & (1 << i)) #define pi 3.1415926535897932384626 #define pb push_back #define pf push_front #define mt make_tuple #define ff first #define ss second #define debug(x) cout << #x " = " << (x) <<...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; #define ll long long #define bit(x, i) (x & (1 << i)) #define pi 3.1415926535897932384626 #define pb push_back #define pf push_front #define mt make_tuple #define ff first #define ss second #define debug(x) cout << #x " = " << (x) <<...
[["-", 64, 37, 0, 34, 31, 16, 31, 16, 12, 13], ["+", 64, 37, 0, 34, 31, 16, 31, 16, 12, 22]]
1
454
# 全探索 x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) min_list = [] for i in range(-100, 101): if i not in p: ans = abs(i-x) min_list.append(ans) minimum = min(min_list) minimum_right = x + minimum min...
# 全探索 x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) min_list = [] for i in range(-200, 200): if i not in p: ans = abs(i-x) min_list.append(ans) minimum = min(min_list) minimum_right = x + minimum min...
[["-", 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
124