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; using ll = long long; int main() { int x, y; cin >> x >> y; for (int i = 0; i < x + 1; ++i) { if (2 * i + 4 * (x - i) == y) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int x, y; cin >> x >> y; for (int i = 0; i < x + 1; ++i) { if (2 * i + 4 * (x - i) == y) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
87
a,b=gets.split.map(&:to_i) if a*2<=b&&b<=a*4 puts "Yes" else puts "No" end
a,b=gets.split.map(&:to_i) if a*2<=b&&b<=a*4&&b.even? puts "Yes" else puts "No" end
[["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 98], ["+", 0, 493, 0, 121, 15, 738, 12, 652, 486, 22], ["+", 0, 493, 0, 121, 15, 738, 12, 652, 17, 131], ["+", 0, 493, 0, 121, 15, 738, 12, 652, 735, 22]]
4
35
#include <bits/stdc++.h> #define Int int64_t using namespace std; int main() { int x, y; cin >> x >> y; for (int i = 0; i <= 1000; ++i) { int n = i * 2 + (x - i) * 4; if (n == y) { cout << "Yes\n"; return 0; } } cout << "No\n"; return 0; }
#include <bits/stdc++.h> #define Int int64_t using namespace std; int main() { int x, y; cin >> x >> y; for (int i = 0; i <= x; ++i) { int n = i * 2 + (x - i) * 4; if (n == y) { cout << "Yes\n"; return 0; } } cout << "No\n"; return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
85
#pragma region RegionDefs #include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, l, r) for (int i = (l), i##_len = (r); i < i##_len; ++i) #define all(x) begin(x), end(x) using namespace std; typedef long long ll; const ll INF = 1e9; template <class T = ll> using V = ...
#pragma region RegionDefs #include <bits/stdc++.h> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, l, r) for (int i = (l), i##_len = (r); i < i##_len; ++i) #define all(x) begin(x), end(x) using namespace std; typedef long long ll; const ll INF = 1e9; template <class T = ll> using V = ...
[["+", 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
376
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template <class T> constexp...
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template <class T> constexp...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22]]
1
141
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define pb p...
#include <bits/stdc++.h> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define ll long long int #define pb p...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
301
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect #from operator import itemgetter #from heapq import heappush, heappop #import numpy as np #from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford,...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect #from operator import itemgetter #from heapq import heappush, heappop #import numpy as np #from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford,...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
195
#include <bits/stdc++.h> #include <cmath> using namespace std; typedef long long ll; ll tc, bil, r; int main() { scanf("%lld %lld", &bil, &tc); map<ll, ll> ar; for (int k = 1; k <= tc; k++) { scanf("%lld", &r); ar[r]++; } ll tmp = 1; ll jaw = 0; if (tc == 0) { printf("%lld\n", bil); retu...
#include <bits/stdc++.h> #include <cmath> using namespace std; typedef long long ll; ll tc, bil, r; int main() { scanf("%lld %lld", &bil, &tc); map<ll, ll> ar; for (int k = 1; k <= tc; k++) { scanf("%lld", &r); ar[r]++; } ll tmp = 0; ll jaw = 0; if (tc == 0) { printf("%lld\n", bil); retu...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
171
#include <bits/stdc++.h> using namespace std; map<int, int> used; main() { int n, m; cin >> n >> m; int a; for (int i = 1; i <= m; i++) { cin >> a; used[a] = 1; } int mn = 1e9, ans = n; for (int i = -100; i <= 100; i++) { if (used[i] == 0) { if (abs(n - i) < mn) { mn = abs(n - i)...
#include <bits/stdc++.h> using namespace std; map<int, int> used; main() { int n, m; cin >> n >> m; int a; for (int i = 1; i <= m; i++) { cin >> a; used[a] = 1; } int mn = 1e9, ans = n; for (int i = 0; i <= 1000; i++) { if (used[i] == 0) { if (abs(n - i) < mn) { mn = abs(n - 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
126
#include <stdio.h> #include <stdlib.h> int main() { int i, x, n, left = 103, right = 103; scanf("%d %d", &x, &n); if (n == 0) { printf("%d", x); return 0; } int p[101] = {0}; int pp; for (i = 0; i < n; i++) { scanf("%d", &pp); p[pp] = 1; } int count = 0; for (i = 0; i < 101; i+...
#include <stdio.h> #include <stdlib.h> int main() { int i, x, n, left = 103, right = 103; scanf("%d %d", &x, &n); if (n == 0) { printf("%d", x); return 0; } int p[105] = {0}; int pp; for (i = 0; i < n; i++) { scanf("%d", &pp); p[pp] = 1; } int count = 0; for (i = 0; i < 101; i+...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 15, 23, 0, 16, 12, 23, 0, 16, 17, 47], ["+", 15, 23, 0, 16, 12, 23, 0, 16, 17, 20]]
0
227
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; map<int, int> z; for (int i = 0; i < N; i++) { int j; cin >> j; z[j] = j; } int ans = 0; int i = 0; while (ans == 0) { if (!(z.count(X - i))) { ans = X - i; } else if (!(z.count(X + i))) { ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; map<int, int> z; for (int i = 0; i < N; i++) { int j; cin >> j; z[j] = j; } int ans = 10000; int i = 0; while (ans == 10000) { if (!(z.count(X - i))) { ans = X - i; } else if (!(z.count(X + i...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
133
x,n=map(int,input().split()) if n==0: print(x) exit() p=list(map(int,input().split())) p.sort() t=0 while True: if x-t in p and x+t in p: t+=1 elif x-t in p and x+t not in p: print(x+t) exit() elif x-t not in p: print(x-1) exit()
x,n=map(int,input().split()) if n==0: print(x) exit() p=list(map(int,input().split())) p.sort() t=0 while True: if x-t in p and x+t in p: t+=1 elif x-t in p and x+t not in p: print(x+t) exit() elif x-t not in p: print(x-t) exit()
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]]
5
112
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) for j in range(0, int(n/2)+ 1): #print(j) if x-j not in p: print(x-j) break else: if x+j not in p: print(x+j)
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) for j in range(0, int(n/2)+ 2): #print(j) if x-j not in p: print(x-j) break else: if x+j not in p: print(x+j) break
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
93
// Q - Problem 17 #include <bits/stdc++.h> using namespace std; int main() { int X{0}, length{0}; scanf("%d %d", &X, &length); if (length == 0) { printf("%d\n", X); return 0; } int diff{0}, smallest{200}; bool arr[102] = {0}; while (length--) { scanf("%d", &diff); arr[diff] = true; ...
// Q - Problem 17 #include <bits/stdc++.h> using namespace std; int main() { int X{0}, length{0}; scanf("%d %d", &X, &length); if (length == 0) { printf("%d\n", X); return 0; } int diff{0}, smallest{200}; bool arr[102] = {0}; while (length--) { scanf("%d", &diff); arr[diff] = true; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
200
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int x, n, p[100], min = 1000; cin >> x >> n; int minn = x; for (int i = 0; i < n; i++) { cin >> p[i]; } sort(p, p + n); for (int i = 1; i <= 101; i++) { for (int j = 0; j < n; j++) { if (p[j] == i)...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int x, n, p[100], min = 1000; cin >> x >> n; int minn = x; for (int i = 0; i < n; i++) { cin >> p[i]; } sort(p, p + n); for (int i = 0; i <= 101; i++) { for (int j = 0; j < n; j++) { if (p[j] == i)...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
157
#include <algorithm> #include <iostream> #include <set> #include <string> #include <vector> typedef long long ll; using namespace std; int arr[107]; const ll inf = 1000000001; int main() { int x, n; cin >> x >> n; set<int> s; for (int i = 0; i < n; ++i) { int a; cin >> a; s.insert(a); } ll d...
#include <algorithm> #include <iostream> #include <set> #include <string> #include <vector> typedef long long ll; using namespace std; int arr[107]; const ll inf = 1000000001; int main() { int x, n; cin >> x >> n; set<int> s; for (int i = 0; i < n; ++i) { int a; cin >> a; s.insert(a); } ll d...
[["-", 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; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int X, N; cin >> X >> N; vector<int> p(N); rep(i, N) cin >> p[i]; if (N == 0) { cout << X << endl; return 0; } if (find(p.begin(), p.end(), X) != p.end()) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int X, N; cin >> X >> N; vector<int> p(N); rep(i, N) cin >> p[i]; if (N == 0) { cout << X << endl; return 0; } if (find(p.begin(), p.end(), X) == p.end()) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
222
x, n = gets.split(' ').map(&:to_i) ps = n == 0 ? [] : gets.split(' ').map(&:to_i) result = 100 min_abs = 100 target_arr = (0..100).to_a.select { |i| !ps.include?(i) } target_arr.each do |i| abs = (x - i).abs if abs < min_abs result = i min_abs = abs elsif abs == min_abs && i < result result = i e...
x, n = gets.split(' ').map(&:to_i) ps = n == 0 ? [] : gets.split(' ').map(&:to_i) result = 100 min_abs = 100 target_arr = (0..101).to_a.select { |i| !ps.include?(i) } target_arr.each do |i| abs = (x - i).abs if abs < min_abs result = i min_abs = abs elsif abs == min_abs && i < result result = i e...
[["-", 12, 652, 486, 652, 486, 739, 0, 475, 444, 612], ["+", 12, 652, 486, 652, 486, 739, 0, 475, 444, 612]]
4
111
#include <algorithm> #include <iostream> #include <string> using namespace std; int comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main() { int X, N, p[102], num; bool flag = 1; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } qsort(p, N, sizeof(int), comp); f...
#include <algorithm> #include <iostream> #include <string> using namespace std; int comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main() { int X, N, p[102], num; bool flag = 1; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } qsort(p, N, sizeof(int), comp); f...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 15, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 15, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 15, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 7, 15, 16, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 85], ["-", 8, 9, ...
1
259
#include <bits/stdc++.h> //#include <ext/pb_ds/detail/standard_policies.hpp> const double pi = acos(-1.0); // memset ( a , 0 , n * sizeof(ll) ) ; using namespace std; // using namespace __gnu_pbds; #define endl '\n' #define sl(n) scanf("%lld", &n) #define mp make_pair #define pb push_back #define ppb pop_back #define ...
#include <bits/stdc++.h> //#include <ext/pb_ds/detail/standard_policies.hpp> const double pi = acos(-1.0); // memset ( a , 0 , n * sizeof(ll) ) ; using namespace std; // using namespace __gnu_pbds; #define endl '\n' #define sl(n) scanf("%lld", &n) #define mp make_pair #define pb push_back #define ppb pop_back #define ...
[["-", 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
875
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) typedef vector<int> VI; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, a, n) for (int i = n - 1; i >= a; i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) typedef vector<int> VI; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
370
#include <math.h> #include <stdio.h> #include <stdlib.h> int min(int x, int y) { if (x < y) { return x; } return y; } int main() { int x, n; scanf("%d %d", &x, &n); int p[101] = {0}; for (int i = 0; i < n; i++) { int pp; scanf("%d", &pp); p[pp] = 1; } int ans = __INT32_MAX__; int...
#include <math.h> #include <stdio.h> #include <stdlib.h> int min(int x, int y) { if (x < y) { return x; } return y; } int main() { int x, n; scanf("%d %d", &x, &n); int p[102] = {0}; for (int i = 0; i < n; i++) { int pp; scanf("%d", &pp); p[pp] = 1; } int ans = __INT32_MAX__; int...
[["-", 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, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20]]
0
179
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; set<int> S; for (int i = 0; i < N; i++) { int a; cin >> a; S.insert(a); } int ans = 0; int d = X; for (int i = 0; i <= 100; i++) if (!S.count(i)) { if (abs(X - i) < d) { ans = i; d =...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; set<int> S; for (int i = 0; i < N; i++) { int a; cin >> a; S.insert(a); } int ans = 0; int d = X; for (int i = 0; i <= 101; i++) if (!S.count(i)) { if (abs(X - i) < d) { ans = i; d =...
[["-", 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 <iostream> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; void Sol3() { int X, N; cin >> X >> N; vector<int> input; unordered_map<int, bool> hsh_map; if (N == 0) { cout << X << endl; return; } for (int i =...
#include <algorithm> #include <iostream> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; void Sol3() { int X, N; cin >> X >> N; vector<int> input; unordered_map<int, bool> hsh_map; if (N == 0) { cout << X << endl; return; } for (int i =...
[["-", 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
201
#include <bits/stdc++.h> 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); rep(i, n) cin >> p[i]; int hantei = 0, ans_min = -101, ans_max = 201; while (hantei <= x) { bool list = true; rep(i, n) { ...
#include <bits/stdc++.h> 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); rep(i, n) cin >> p[i]; int hantei = 0, ans_min = -101, ans_max = 201; while (hantei <= x) { bool list = true; rep(i, n) { ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
196
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define endl "\n" #define fo for (int i = 0; i < n; i++) #define clear \ cin.clear(); \ cin.ign...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define endl "\n" #define fo for (int i = 0; i < n; i++) #define clear \ cin.clear(); \ cin.ign...
[["-", 36, 36, 0, 30, 0, 7, 15, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 7, 15, 16, 12, 13], ["-", 0, 30, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 7, 10, 43, 49, 50, 51, 13]]
1
431
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> n >> x; set<int> s; for (int i = 0; i < n; i++) { int k; cin >> k; s.insert(k); } int index; int mini = 10000; for (int i = x; i > -1000; i--) { if (s.count(i) == 0) { if (mini > abs(x - i)) { mini...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; set<int> s; for (int i = 0; i < n; i++) { int k; cin >> k; s.insert(k); } int index; int mini = 10000; for (int i = x; i > -1000; i--) { if (s.count(i) == 0) { if (mini > abs(x - i)) { mini...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
188
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; 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 =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; 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 =...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
376
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int num; int sequence_num; vector<int> sequence; cin >> num >> sequence_num; sequence.resize(sequence_num); for (int i = 0; i < sequence_num; i++) { cin >> sequence[i]; } if (sequence_num == 0) { cout <...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int num; int sequence_num; vector<int> sequence; cin >> num >> sequence_num; sequence.resize(sequence_num); for (int i = 0; i < sequence_num; i++) { cin >> sequence[i]; } if (sequence_num == 0) { cout <...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
204
#include <bits/stdc++.h> #include <string.h> typedef long long int ll; #define all(x) (x).begin(), (x).end() using namespace std; int nxt() { int x; cin >> x; return x; } ll nxtl() { ll x; cin >> x; return x; } void SieveOfEratosthenes(int n, vector<int> &primes) { // Create a boolean array "prime[0....
#include <bits/stdc++.h> #include <string.h> typedef long long int ll; #define all(x) (x).begin(), (x).end() using namespace std; int nxt() { int x; cin >> x; return x; } ll nxtl() { ll x; cin >> x; return x; } void SieveOfEratosthenes(int n, vector<int> &primes) { // Create a boolean array "prime[0....
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
804
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("sse,sse2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_s...
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("sse,sse2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_s...
[["-", 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
296
x,n = map(int, input().split()) p = list(map(int, input().split())) ans = 101 num = 100 for i in range(101): if i not in p: if abs(x - i) < ans: ans = abs(x - i) num = i print (num)
x,n = map(int, input().split()) p = list(map(int, input().split())) ans = 100 num = 0 for i in range(102): if i not in p: if abs(x - i) < ans: ans = abs(x - i) num = i print (num)
[["-", 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]]
5
78
x,n = list(map(int,input().split())) if n == 0: print(x) exit() p = list(map(int,input().split())) p = [-1] + p + [101] import bisect p.sort() i = bisect.bisect_left(p,x) if p[i] != x: print(x) exit() for h in range(102): if p[i-h] != x-h: print(x-h) exit() elif p[i+h] != x+h: print(x+h) ...
x,n = list(map(int,input().split())) if n == 0: print(x) exit() p = list(map(int,input().split())) p = [-1] + p + [102] import bisect p.sort() i = bisect.bisect_left(p,x) if p[i] != x: print(x) exit() for h in range(102): if p[i-h] != x-h: print(x-h) exit() elif p[i+h] != x+h: print(x+h) ...
[["-", 0, 1, 0, 662, 12, 657, 12, 634, 0, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 634, 0, 612]]
5
142
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; set<int> s; for (int i = 0; i < N; i++) { int p; cin >> p; s.insert(p); } for (int i = 0;; i++) { if (!s.count(X + i)) { cout << X + i << endl; return 0; } if (!s.count(X - i)) { co...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; set<int> s; for (int i = 0; i < N; i++) { int p; cin >> p; s.insert(p); } for (int i = 0;; i++) { if (!s.count(X - i)) { cout << X - i << endl; return 0; } if (!s.count(X + i)) { co...
[["-", 51, 91, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 51, 91, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 51, 91, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 91, 28, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, ...
1
125
import sys X, N = map(int, input().split()) if N == 0: print(X) sys.exit() p = list(map(int, input().split())) forbid = [True]*102 for i in range(len(p)): if forbid[p[i]]: forbid[p[i]] = False pp = [] for i in range(len(forbid)): if forbid[i]: pp.append(i-X) num = pp[len(pp)...
import sys X, N = map(int, input().split()) if N == 0: print(X) sys.exit() p = list(map(int, input().split())) forbid = [True]*102 for i in range(len(p)): if forbid[p[i]]: forbid[p[i]] = False pp = [] for i in range(len(forbid)): if forbid[i]: pp.append(i-X) num = pp[len(pp)...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612]]
5
169
#include <iostream> using namespace std; int x, n, a, ans, maxv = 1000, curdif; int main() { cin >> x >> n; bool q[101]; for (int i = 0; i < 101; i++) { q[i] = false; } for (int i = 0; i < 101; i++) { cin >> a; q[a] = true; } for (int i = 0; i < 101; i++) { if (q[i]) { continue; ...
#include <iostream> using namespace std; int x, n, a, ans, maxv = 1000, curdif; int main() { cin >> x >> n; bool q[102]; for (int i = 0; i < 102; i++) { q[i] = false; } for (int i = 0; i < 102; i++) { cin >> a; q[a] = true; } for (int i = 0; i < 102; i++) { if (q[i]) { continue; ...
[["-", 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
167
#include <bits/stdc++.h> using namespace std; using ll = long long; const int Inf = 1e9 + 5; int main() { cin.tie(0); ios_base::sync_with_stdio(0); int x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } vector<int> a(n); int mn = Inf; for (int i = 0; i < n; i++) { cin >> a[i]; }...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int Inf = 1e9 + 5; int main() { cin.tie(0); ios_base::sync_with_stdio(0); int x, n; cin >> x >> n; if (n == 0) { cout << x; return 0; } vector<int> a(n); int mn = Inf; for (int i = 0; i < n; i++) { cin >> a[i]; }...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
254
from collections import defaultdict x,n = map(int,input().split()) if n==0: print(x) else: dd = defaultdict(int) arr = list(map(int,input().split())) for i in range(len(arr)): dd[x-arr[i]]+=1 print(dd) for i in range(101): if dd[i]==0: print(x-i) br...
from collections import defaultdict x,n = map(int,input().split()) if n==0: print(x) else: dd = defaultdict(int) arr = list(map(int,input().split())) for i in range(len(arr)): dd[x-arr[i]]+=1 for i in range(101): if dd[i]==0: print(x-i) break elif dd...
[["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
119
#include <bits/stdc++.h> using namespace std; int X, N, i, a[110], ans = 110, pre = 110; map<int, int> visited; int main() { cin >> X >> N; for (i = 0; i < N; i++) { cin >> a[i]; visited[a[i]] = true; } sort(a, a + N); for (i = -1; i <= 100; i++) { if (!visited[i] && abs(X - i) < pre) pre = ...
#include <bits/stdc++.h> using namespace std; int X, N, i, a[110], ans = 110, pre = 110; map<int, bool> visited; int main() { cin >> X >> N; for (i = 0; i < N; i++) { cin >> a[i]; visited[a[i]] = true; } sort(a, a + N); for (i = -1; i <= 101; i++) { if (!visited[i] && abs(X - i) < pre) pre =...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
151
#include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; int m[110], val, dist = 1000, idx = 0; for (int i = 0; i <= 102; i++) m[i] = 0; for (int i = 0; i < n; i++) { cin >> val; m[val]++; } for (int i = 0; i <= 103; i++) { if (m[i] && abs(x - i) < dist) { dist ...
#include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; int m[110], val, dist = 1000, idx = 0; for (int i = 0; i <= 102; i++) m[i] = 0; for (int i = 0; i < n; i++) { cin >> val; m[val]++; } for (int i = 0; i <= 103; i++) { if (!m[i] && abs(x - i) < dist) { dist...
[["+", 0, 57, 15, 339, 51, 16, 31, 91, 17, 111]]
1
139
#include <bits/stdc++.h> using namespace std; int main() { int x, m; cin >> x >> m; unordered_map<int, bool> mark; for (int i = 0; i < m; ++i) { int x; cin >> x; mark[x] = 1; } int ans = INT_MAX; int mn = INT_MAX; // vector<int>store; for (int i = -100; i <= 100; ++i) { if (mark[i] == ...
#include <bits/stdc++.h> using namespace std; int main() { int x, m; cin >> x >> m; unordered_map<int, bool> mark; for (int i = 0; i < m; ++i) { int x; cin >> x; mark[x] = 1; } int ans = INT_MAX; int mn = INT_MAX; // vector<int>store; for (int i = -100; i <= 101; ++i) { if (mark[i] == ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
164
x, n = map(int, input().split()) try: p_li = list(map(int, input().split())) except: print(x) exit() for i in range(1000): if not((x - i) in p_li): print(x - i) break if not((x - i) in p_li): print(x - i) break
x, n = map(int, input().split()) try: p_li = list(map(int, input().split())) except: print(x) exit() for i in range(100000): if not((x - i) in p_li): print(x - i) break if not((x + i) in p_li): print(x + i) break
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 28, 23, 0, 666, 0, 23, 0, 657, 17, 33], ["+", 28, 23, 0, 666, 0, 23, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
90
#include "bits/stdc++.h" using namespace std; #define int long long #define endl '\n' const int N = 200; set<int> marked; class node { public: int num, distance; bool operator<(const node &other) const { if (distance == other.distance) return num < other.num; return distance < other.distance; } };...
#include "bits/stdc++.h" using namespace std; #define int long long #define endl '\n' const int N = 200; set<int> marked; class node { public: int num, distance; bool operator<(const node &other) const { if (distance == other.distance) return num < other.num; return distance < other.distance; } };...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
214
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0,...
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0,...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
418
/* In the name of Allah. */ #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <set> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define gap ' ' #define INF 999999 const int MAXN = 2 * 1e5 + 5; int a[MAXN]; bool binarySearch(int l,...
/* In the name of Allah. */ #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <set> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define gap ' ' #define INF 999999 const int MAXN = 2 * 1e5 + 5; int a[MAXN]; bool binarySearch(int l,...
[["-", 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
325
from sys import stdin,stdout LI=lambda:list(map(int,input().split())) MAP=lambda:map(int,input().split()) IN=lambda:int(input()) S=lambda:input() import math from collections import Counter,defaultdict x,n=MAP() if n==0: print(x) exit() a=LI() l=-1;r=-1 for i in range(1,100): if x-i not in a: l=x-...
from sys import stdin,stdout LI=lambda:list(map(int,input().split())) MAP=lambda:map(int,input().split()) IN=lambda:int(input()) S=lambda:input() import math from collections import Counter,defaultdict x,n=MAP() if n==0: print(x) exit() a=LI() l=-1;r=-1 for i in range(101): if x-i not in a: l=x-i ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
172
X,N = map(int,input().split()) if N==0: print(X) else: P = list(map(int,input().split())) hash_p = [0]*101 for i in P: hash_p[i] += 1 for i in range(N): if hash_p[X-i]==0: print(X-i) break if hash_p[X+i]==0: print(X+i) break
X,N = map(int,input().split()) if N==0: print(X) else: P = list(map(int,input().split())) hash_p = [0]*102 for i in P: hash_p[i] += 1 for i in range(N+1): if hash_p[X-i]==0: print(X-i) break if hash_p[X+i]==0: print(X+i) break
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
104
x,n = map(int, input().split()) if n==0: print(x) exit() p=list(map(int,input().split())) mi = 101 ans=-1 for i in range(-1,101): if i in p: continue if abs(x-i) < mi: ans = i mi = abs(x-i) print(ans)
x,n = map(int, input().split()) if n==0: print(x) exit() p=list(map(int,input().split())) mi = 101 ans=-1 for i in range(-1,102): if i in p: continue if abs(x-i) < mi: ans = i mi = abs(x-i) print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
94
import numpy as np X,N = map(int, input().split()) if N == 0: print(X) else: p = list(map(int, input().split())) main = set(np.arange(101)) main = main - set(p) main1 = abs(np.array(list(main))) idx = abs(main1 - X).argmin() print(main1[idx])
import numpy as np X,N = map(int, input().split()) if N == 0: print(X) else: p = list(map(int, input().split())) main = set(np.arange(102)) main = main - set(p) main1 = abs(np.array(list(main))) idx = abs(main1 - X).argmin() print(main1[idx])
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
100
import sys x, n = map(int, input().split()) if n == 0: print(x) sys.exit() p = [int(x) for x in input().split()] diff = 0 while(True): if not x + diff in p: print(x+diff) sys.exit() if diff < 0: diff *= -1 diff += 1 else: # 0以上 diff *= -1 diff -= 1
import sys x, n = map(int, input().split()) if n == 0: print(x) sys.exit() p = [int(x) for x in input().split()] diff = 0 while(True): if not x + diff in p: print(x+diff) sys.exit() if diff < 0: diff *= -1 else: # 0以上 diff *= -1 diff -= 1
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612]]
5
99
x, n = map(int, input().split()) if n == 0: print(x) exit() p = np.array(list(map(int, input().split()))) for i in range(100): 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(100): if not x-i in p: print(x-i) exit() elif not x+i in p: print(x+i) exit()
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
92
x, n = map(int, input().split()) if n == 0: print(x) exit() p = np.array(list(map(int, input().split()))) for i in range(100): if not x-i in p: print(x-i) exit() elif not x+i in p: print(x+i) exit()
import numpy as np x, n = map(int, input().split()) if n == 0: print(x) exit() p = np.array(list(map(int, input().split()))) for i in range(100): if not x-i in p: print(x-i) exit() elif not x+i in p: print(x+i) exit()
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 0, 656, 0, 596, 141, 704, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 0, 272], ["+", 36, 36, 0, 656, 0, 596, 141, 704, 705, 22]]
5
92
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdint.h> #include <string> #include <vector> using namespace std; #define PI (3.14159265358979323846) #define INF (2147483647) #define INF_LL (9223372036854775807) ...
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdint.h> #include <string> #include <vector> using namespace std; #define PI (3.14159265358979323846) #define INF (2147483647) #define INF_LL (9223372036854775807) ...
[["-", 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
290
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); if (N == 0) { cout << X; return 0; } for (int i = 0; i < N; i++) { cin >> p[i]; } int dis = 10000; int ans = 0; int flag = 1; for (int i = 100; i >= -100; i--) { flag = 1; for...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p(N); if (N == 0) { cout << X; return 0; } for (int i = 0; i < N; i++) { cin >> p[i]; } int dis = 10000; int ans = 0; int flag = 1; for (int i = 120; i >= -100; i--) { flag = 1; for...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
177
// https://atcoder.jp/contests/abc170/tasks/abc170_c #include <bits/stdc++.h> using namespace std; #define watch(x) cerr << (#x) << " is " << (x) << endl; #define endl '\n' #define pii pair<int, int> #define fi first #define se second signed main() { ios::sync_with_stdio(0); cin.sync_with_stdio(0); cin.tie(0); ...
// https://atcoder.jp/contests/abc170/tasks/abc170_c #include <bits/stdc++.h> using namespace std; #define watch(x) cerr << (#x) << " is " << (x) << endl; #define endl '\n' #define pii pair<int, int> #define fi first #define se second signed main() { ios::sync_with_stdio(0); cin.sync_with_stdio(0); cin.tie(0); ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
168
#include <bits/stdc++.h> using namespace std; int main() { int k, n; cin >> k >> n; set<int> s; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); } int ans = 1; int i = k - 1; int j = k + 1; while (1) { if (s.find(i) == s.end()) { ans = i; break; } ...
#include <bits/stdc++.h> using namespace std; int main() { int k, n; cin >> k >> n; set<int> s; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); } int ans = 1; int i = k; int j = k; while (1) { if (s.find(i) == s.end()) { ans = i; break; } if (s.fi...
[["-", 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
149
/***************************************** **** Solution by SlavicG **** *****************************************/ #include <algorithm> #include <assert.h> #include <bits/stdc++.h> #include <cmath> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #incl...
/***************************************** **** Solution by SlavicG **** *****************************************/ #include <algorithm> #include <assert.h> #include <bits/stdc++.h> #include <cmath> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #incl...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
834
#pragma GCC optimize("O2") #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC diagnostic ignored "-Wunused-label" #pragma GCC diagnostic ignored "-Wsign-compare" #include <bits/stdc++.h> using namespace std; #define trav(a, A) for (auto &a : A) #define f fi...
#pragma GCC optimize("O2") #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC diagnostic ignored "-Wunused-label" #pragma GCC diagnostic ignored "-Wsign-compare" #include <bits/stdc++.h> using namespace std; #define trav(a, A) for (auto &a : A) #define f fi...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
213
#include <cmath> #include <iostream> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) using namespace std; int arr[1000]; int main() { int x, n; cin >> x >> n; int min = 0; int max = 101; int p; FOR(i, 0, n) { cin >> p; arr[p] = 1; } if (n == 0) { cout...
#include <cmath> #include <iostream> #include <string> #include <vector> #define FOR(i, a, b) for (int i = (a); i < (b); i++) using namespace std; int arr[1000]; int main() { int x, n; cin >> x >> n; int min = -1; int max = 102; int p; FOR(i, 0, n) { cin >> p; arr[p] = 1; } if (n == 0) { cou...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
218
x, n = map(int, input().split()) lst = [] if n > 0: lst = list(map(int, input().split())) a = 100 b = 0 for i in range(0, 102): if i in lst: continue if a > abs(x-i): a = abs(x-i) b = i print(i)
x, n = map(int, input().split()) lst = [] if n > 0: lst = list(map(int, input().split())) a = 100 b = 0 for i in range(0, 102): if i in lst: continue if a > abs(x-i): a = abs(x-i) b = i print(b)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
89
#include <algorithm> #include <cfenv> #include <climits> #include <cmath> #include <cstdint> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #...
#include <algorithm> #include <cfenv> #include <climits> #include <cmath> #include <cstdint> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
1,677
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N; int p[100]; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int i = 0; i < X; i++) { if (find(p, p + N, X - i) == p + N) { cout << X - i << endl; break; } if (find(p, p + N, X + i) == p +...
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N; int p[100]; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } for (int i = 0; i <= X; i++) { if (find(p, p + N, X - i) == p + N) { cout << X - i << endl; break; } if (find(p, p + N, X + i) == p ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
134
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N; int p[10]; cin >> X >> N; bool samef = false; for (int i = 0; i < N; i++) { cin >> p[i]; if (X == p[i]) samef = true; } if (samef == false) cout << X; else { sort(p, p + N); int xIndex; for (int i ...
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N; int p[100]; cin >> X >> N; bool samef = false; for (int i = 0; i < N; i++) { cin >> p[i]; if (X == p[i]) samef = true; } if (samef == false) { cout << X; } else { sort(p, p + N); int xIndex; for (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, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 31, 22], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 75, 76, 0...
1
245
<?php list($X,$N) = array_map('intval',explode(" ",trim(fgets(STDIN)))); //$N==0の時2行目が空行となるので$Xをそのまま表示して終わり if($N == 0){ echo $X."\n"; exit; } $array = array_map('intval',explode(" ",trim(fgets(STDIN)))); //被検索対象の数字の中に検索したい数字がなければ検索したい数字で決定して終わる if(in_array($X,...
<?php list($X,$N) = array_map('intval',explode(" ",trim(fgets(STDIN)))); //$N==0の時2行目が空行となるので$Xをそのまま表示して終わり if($N == 0){ echo $X."\n"; exit; } $array = array_map('intval',explode(" ",trim(fgets(STDIN)))); //被検索対象の数字の中に検索したい数字がなければ検索したい数字で決定して終わる if(in_array($X,...
[["+", 0, 57, 75, 76, 8, 9, 0, 1, 0, 141], ["+", 0, 57, 75, 76, 8, 9, 0, 1, 0, 35], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 612], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 612]]
6
212
#include <algorithm> #include <cmath> #include <fstream> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main(void) { int x, n; cin >> x >> n; int min = 100; int an...
#include <algorithm> #include <cmath> #include <fstream> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main(void) { int x, n; cin >> x >> n; int min = 100; int an...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
165
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N, x; bool T = true; cin >> X >> N; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } vector<int> a = {-1, 1}; for (int j = 0; j < 100; j++) { for (int i : a) { x = X + i * j; for (int k = 0;...
#include <bits/stdc++.h> using namespace std; int main(void) { int X, N, x; bool T = true; cin >> X >> N; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } vector<int> a = {-1, 1}; for (int j = 0; j < N + 1; j++) { for (int i : a) { x = X + i * j; for (int k = ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
177
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1e9 + 7; void solve() { int x, n; cin >> x >> n; vector<int> hash(n); if (n == 0) { cout << x; return; } for (int &x : hash) cin >> x; // sort(hash.begin(),hash.end()); int diff = INF; int ans; for (int...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1e9 + 7; void solve() { int x, n; cin >> x >> n; vector<int> hash(n); if (n == 0) { cout << x; return; } for (int &x : hash) cin >> x; // sort(hash.begin(),hash.end()); int diff = INF; int ans; for (int...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
175
package main import ( "fmt" ) func main() { var x, n int fmt.Scan(&x, &n) p := make(map[int]bool) num := 0 for i := 0; i < n; i++ { fmt.Scan(&num) p[num] = true } min := 1000 ans := 101 for j := 100; j >= 0; j-- { if !p[j] { abs := Abs(x, j) if min >= abs { min = abs ans = j } ...
package main import ( "fmt" ) func main() { var x, n int fmt.Scan(&x, &n) p := make(map[int]bool) num := 0 for i := 0; i < n; i++ { fmt.Scan(&num) p[num] = true } min := 101 ans := 101 for j := 101; j >= 0; j-- { if !p[j] { abs := Abs(x, j) if min >= abs { min = abs ans = j } ...
[["-", 0, 435, 8, 196, 0, 431, 12, 432, 0, 433], ["+", 0, 435, 8, 196, 0, 431, 12, 432, 0, 433], ["-", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["+", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["+", 36, 36, 36, 36, 36, 36, 0, 434, 0, 165]]
7
169
#include <bits/stdc++.h> using namespace std; #define ll long long #define fast \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie...
#include <bits/stdc++.h> using namespace std; #define ll long long #define fast \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19]]
1
235
#include <iostream> using namespace std; int main() { int x, n, flag = 0, min = 0, max = 0; cin >> x >> n; int p[n]; for (int i = 0; i < n; i++) cin >> p[i]; for (int i = x; i > 0; i--) { for (int j = 0; j < n; j++) { if (p[j] == i) flag = 1; } if (flag == 0) { min = i; ...
#include <iostream> using namespace std; int main() { int x, n, flag = 0, min = 0, max = 101; cin >> x >> n; int p[n]; for (int i = 0; i < n; i++) cin >> p[i]; for (int i = x; i > 0; i--) { for (int j = 0; j < n; j++) { if (p[j] == i) flag = 1; } if (flag == 0) { min = i; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
207
X, N = map(int, input().split(' ')) if N != 0: P_n = list(map(int, input().split(' '))) for i in range(X, 101): if i not in set(P_n): min_1 = i break for i in range(X, -100, -1): if i not in set(P_n): min_2 = i break if abs(min_1-X) == abs...
X, N = map(int, input().split(' ')) if N != 0: P_n = list(map(int, input().split(' '))) for i in range(X, 150): if i not in set(P_n): min_1 = i break for i in range(X, -150, -1): if i not in set(P_n): min_2 = i break if abs(min_1-X) == abs...
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612]]
5
149
#include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <string> #include <unordered_map> #include <unordered_set> #include <utilit...
#include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <string> #include <unordered_map> #include <unordered_set> #include <utilit...
[["-", 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 <algorithm> #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> ...
#include <algorithm> #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> ...
[["-", 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> using namespace std; #define ll long long int int main() { ll x, n; cin >> x >> n; ll arr[n]; for (ll i = 0; i <= n - 1; i++) { cin >> arr[i]; } unordered_set<ll> us1; for (ll i = 0; i <= n - 1; i++) { us1.insert(arr[i]); } ll ans = x; ll dif = INT_MAX; for (ll...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll x, n; cin >> x >> n; ll arr[n]; for (ll i = 0; i <= n - 1; i++) { cin >> arr[i]; } unordered_set<ll> us1; for (ll i = 0; i <= n - 1; i++) { us1.insert(arr[i]); } ll ans = x; ll dif = INT_MAX; for (ll...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22]]
1
215
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; int main() { ll x, y; cin >> x >> y; map<ll, ll> mp; for (ll i = 0; i < y; i++) { ll a; cin >> a; mp[a] = 1; } if (y == 0) { cout << x << endl; return 0; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; int main() { ll x, y; cin >> x >> y; map<ll, ll> mp; for (ll i = 0; i < y; i++) { ll a; cin >> a; mp[a] = 1; } if (mp[x] == 0) { cout << x << endl; return ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73]]
1
159
#include <algorithm> #include <bitset> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <tuple> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x - 1 << endl; return 0; ...
#include <algorithm> #include <bitset> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <tuple> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } ...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
281
x, n = list(map(int, input().split())) if n == 0: inputs = [] else: inputs = list(map(int, input().split())) nums = [0] * 202 diff = 1000 n = 100 for i in inputs: nums[i] = 1 for i in range(0, 101): d = abs(i - x) if nums[i] == 1: continue if d < diff: diff = d n = i print(n)
x, n = list(map(int, input().split())) if n == 0: inputs = [] else: inputs = list(map(int, input().split())) nums = [0] * 201 diff = 1000 n = 100 for i in inputs: nums[i] = 1 for i in range(0, 201): d = abs(i - x) if nums[i] == 1: continue if d < diff: diff = d n = i print(n)
[["-", 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, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
113
X,N=map(int,input().split()) if N==0: print(X) else: w=input() w=w.split() t=list(w) b=list(range(-100,101)) tt=[int(a) for a in t] ttt=set(tt) bb=set(b) c=bb^ttt cc=list(c) u=1000 for s in cc: if abs(s-X)<u: u=abs(s-X) if (X-u) in cc: ...
X,N=map(int,input().split()) if N==0: print(X) else: w=input() w=w.split() t=list(w) b=list(range(-150,151)) tt=[int(a) for a in t] ttt=set(tt) bb=set(b) c=bb^ttt cc=list(c) u=1000 for s in cc: if abs(s-X)<u: u=abs(s-X) if (X-u) in cc: ...
[["-", 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
141
X, N = map(int, input().split()) if N==0: print(X) exit(0) p = [int(i) for i in input().split()] for i in range(X): for s in [-1,1]: a = X + i*s if a not in p: print(a) exit(0)
X, N = map(int, input().split()) if N==0: print(X) exit(0) p = [int(i) for i in input().split()] for i in range(101): for s in [-1,1]: a = X + i*s if a not in p: print(a) exit(0)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
86
x, n = map(int, input().split()) lis = [] if n == 0: print(x) else: lis = list(map(int, input().split())) if x not in lis: print(x) else: y = x + 1 z = x - 1 while True: print(y,z) if y in lis and z in lis: y += 1 z -= 1 elif z not in lis: print(z) ...
x, n = map(int, input().split()) lis = [] if n == 0: print(x) else: lis = list(map(int, input().split())) if x not in lis: print(x) else: y = x + 1 z = x - 1 while True: if y in lis and z in lis: y += 1 z -= 1 elif z not in lis: print(z) break ...
[["-", 0, 52, 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, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
116
#include <bits/stdc++.h> using namespace std; #define rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (end)); \ i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) int main() { int x; int n; int r...
#include <bits/stdc++.h> using namespace std; #define rep(i, begin, end) \ for (__typeof(end) i = (begin) - ((begin) > (end)); \ i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) int main() { int x; int n; int r...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
233
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> vec(N + 1); for (int i = 0; i < N; i++) { cin >> vec.at(i); } vec.at(N) = 130; for (int u = 0; u < N; u++) { for (int v = u + 1; v < N; v++) { if (vec.at(u) == vec.at(v)) { vec.at(v) = 12...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> vec(N + 1); for (int i = 0; i < N; i++) { cin >> vec.at(i); } vec.at(N) = 130; for (int u = 0; u < N; u++) { for (int v = u + 1; v < N; v++) { if (vec.at(u) == vec.at(v)) { vec.at(v) = 12...
[["-", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46], ["+", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46]]
1
403
inp = [int(a) for a in input().split()] X = inp[0] N = inp[1] if N == 0: print(X) else: P = [int(b) for b in input().split()] found = 0 num = 1 answer = X while(found == 0): if not (X - num in P): found = 1 answer = X - num elif not (X + num in P): found = 1 answer = X + num...
inp = [int(a) for a in input().split()] X = inp[0] N = inp[1] if N == 0: print(X) else: P = [int(b) for b in input().split()] found = 0 num = 0 answer = X while(found == 0): if not (X - num in P): found = 1 answer = X - num elif not (X + num in P): found = 1 answer = X + num...
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
118
#include <bits/stdc++.h> using namespace std; // def #define debug(x) cout << #x << ": " << x << '\n' #define out(x) cout << x << '\n' #define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define rep(i, n) for (int i = 0; i < (int)(n);...
#include <bits/stdc++.h> using namespace std; // def #define debug(x) cout << #x << ": " << x << '\n' #define out(x) cout << x << '\n' #define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define rep(i, n) for (int i = 0; i < (int)(n);...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
354
#include <bits/stdc++.h> 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; vector<bool> p(101, true); rep(i, n) { int t; cin >> t; p[t] = false; } int ans = 102; rep(i, 101) { if (p[i]...
#include <bits/stdc++.h> 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; vector<bool> p(102, true); rep(i, n) { int t; cin >> t; p[t] = false; } int ans = 103; rep(i, 102) { if (p[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, 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
130
x, n = map(int, input().split()) if n == 0: print(x) exit(0) p = list(map(int, input().split())) a = [i for i in range(-100,101)] b = sorted(list(set(a) - set(p))) min_v = 1000 min_id = 0 for i in range(len(b)): if abs(x - b[i]) < min_v: min_v = abs(x - b[i]) min_id = i print(b[min_id])
x, n = map(int, input().split()) if n == 0: print(x) exit(0) p = list(map(int, input().split())) a = [i for i in range(201)] b = sorted(list(set(a) - set(p))) min_v = 1000 min_id = 0 for i in range(len(b)): if abs(x - b[i]) < min_v: min_v = abs(x - b[i]) min_id = i print(b[min_id])
[["-", 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
129
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); vector<int> y(101, 1); for (int i = 0; i < n; i++) { cin >> p[i]; y[p[i]] = 0; } int a = 0; for (int i = x; i < 101; i++) { if (y[i]) { a = i; break; } } int b = 0; for...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); vector<int> y(102, 1); for (int i = 0; i < n; i++) { cin >> p[i]; y[p[i]] = 0; } int a = 0; for (int i = x; i < 102; i++) { if (y[i]) { a = i; break; } } int b = 0; for...
[["-", 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
178
#include <iostream> #include <string> using namespace std; #define N_MAX 100 int X; // 1~100 int N; // 0~100 int p[N_MAX]; // 1~100 void input() { cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } } void solve() { // pに含まれない整数のうち、最もXに近いものを答えよ。 // 複数存在する場合は小さい方を答えよ。 int ans = ...
#include <iostream> #include <string> using namespace std; #define N_MAX 100 int X; // 1~100 int N; // 0~100 int p[N_MAX]; // 1~100 void input() { cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p[i]; } } void solve() { // pに含まれない整数のうち、最もXに近いものを答えよ。 // 複数存在する場合は小さい方を答えよ。 int ans = ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
181
#include <iostream> using ll = long long; #define rep(i, a, b) for (ll i = a; i < ll(b); i++) #define repr(i, a, b) for (ll i = a; i >= ll(b); i--) #define endl "\n" #define ALL(x) x.begin(), x.end() #define ALLR(x) x.rbegin(), x.rend() using namespace std; int x, n; bool p[101]; int main() { cin >> x >> n; rep(i,...
#include <iostream> using ll = long long; #define rep(i, a, b) for (ll i = a; i < ll(b); i++) #define repr(i, a, b) for (ll i = a; i >= ll(b); i--) #define endl "\n" #define ALL(x) x.begin(), x.end() #define ALLR(x) x.rbegin(), x.rend() using namespace std; int x, n; bool p[101]; int main() { cin >> x >> n; rep(i,...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
156
X,N = map(int,input().split()) if N==0: print(X) else: P = list(map(int,input().split())) Q = [n for n in range(-101,101) if n not in P] a = 10000 d1 = 10000 for q in Q: d2 = abs(q-X) if d2<d1: d1 = d2 a = q print(a)
X,N = map(int,input().split()) if N==0: print(X) else: P = list(map(int,input().split())) Q = [n for n in range(-1000,1000) if n not in P] a = 10000 d1 = 10000 for q in Q: d2 = abs(q-X) if d2<d1: d1 = d2 a = q print(a)
[["-", 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
98
#include <bits/stdc++.h> using namespace std; int main() { int n, x, t; set<int> s; cin >> x >> n; for (int i = 0; i < n; ++i) { cin >> t; s.insert(t); } vector<pair<int, int>> diff; for (int i = -100; i <= 100; ++i) { if (s.count(i)) continue; diff.emplace_back(abs(x - i), i); }...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, t; set<int> s; cin >> x >> n; for (int i = 0; i < n; ++i) { cin >> t; s.insert(t); } vector<pair<int, int>> diff; for (int i = -200; i <= 200; ++i) { if (s.count(i)) continue; diff.emplace_back(abs(x - i), 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
189
# coding: utf-8 # Your code here! def main(): X, N = map(int, input().split()) if N == 0: print(X) return 0 p_list = list(map(int, input().split())) ans = X i = 1 while True: tmp_n = X - i if tmp_n not in p_list: ans = tmp_n break ...
# coding: utf-8 # Your code here! def main(): X, N = map(int, input().split()) if N == 0: print(X) return 0 p_list = list(map(int, input().split())) ans = X i = 0 while True: tmp_n = X - i if tmp_n not in p_list: ans = tmp_n break...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
100
import sys # input = sys.stdin.buffer.readline def main(): x, n = map(int, input().split()) if n == 0: print(x) sys.exit() p = tuple(map(int, input().split())) cnt = 1 while True: xt = x - cnt if xt not in p: print(xt) sys.exit() xt2 = ...
import sys # input = sys.stdin.buffer.readline def main(): x, n = map(int, input().split()) if n == 0: print(x) sys.exit() p = tuple(map(int, input().split())) cnt = 0 while True: xt = x - cnt if xt not in p: print(xt) sys.exit() xt2 = ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
114
#include <bits/stdc++.h> #include <cmath> #define SZ(x) ((int)x.size()) #include <map> #include <set> #include <vector> #define ll long long #define REP(i, a, b) for (ll i = a; i < b; i++) #define pb push_back #include <cctype> #include <queue> #include <string> #define ii pair<int, int> #include <sstream> #define lli...
#include <bits/stdc++.h> #include <cmath> #define SZ(x) ((int)x.size()) #include <map> #include <set> #include <vector> #define ll long long #define REP(i, a, b) for (ll i = a; i < b; i++) #define pb push_back #include <cctype> #include <queue> #include <string> #define ii pair<int, int> #include <sstream> #define lli...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
516
def I(): return int(input()) def LI(): return list(map(int,input().split())) def MI(): return map(int,input().split()) def LLI(n): return [list(map(int, input().split())) for _ in range(n)] #bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す #つまりlist[i] < x となる i の個数 #bisect.bisect_right(list, key)はlistのなかでkey以下の...
def I(): return int(input()) def LI(): return list(map(int,input().split())) def MI(): return map(int,input().split()) def LLI(n): return [list(map(int, input().split())) for _ in range(n)] #bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す #つまりlist[i] < x となる i の個数 #bisect.bisect_right(list, key)はlistのなかでkey以下の...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
173
#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> a(N); bool ok; int minCount = 101; int ans = 101; for (int i = 0; i < N; i++) { cin >> a.at(i); } for (int i = 0; i < 100; i++) { ok = true; f...
#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> a(N); bool ok; int minCount = 101; int ans = 101; for (int i = 0; i < N; i++) { cin >> a.at(i); } for (int i = 0; i <= 101; i++) { ok = true; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95]]
1
184
#include <bits/stdc++.h> using namespace std; typedef long long ll; const long long INF = 1LL << 60; ll GCD(ll x, ll y) { if (y == 0) return x; else return GCD(y, x % y); } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } const int MOD = 1000000007; int main() { int n, m; cin >> n >> m; set<int> s...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const long long INF = 1LL << 60; ll GCD(ll x, ll y) { if (y == 0) return x; else return GCD(y, x % y); } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } const int MOD = 1000000007; int main() { int n, m; cin >> n >> m; set<int> s...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
217
#include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; #define ordered_set \ tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, ...
#include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; #define ordered_set \ tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, ...
[["-", 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
679
#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; vector<int> p(n); rep(i, n) { cin >> p[i]; } vector<int> line; rep(i, n * 4) { line.push_back(x - 2 * n + i); } int ans = 10...
#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; vector<int> p(n); rep(i, n) { cin >> p[i]; } vector<int> line; rep(i, n * 4) { line.push_back(x - 2 * n + i); } int ans = 10...
[["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 28, 22]]
1
226
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll x, n; cin >> x >> n; bool f[110] = {}; for (int i = 0; i < n; i++) { ll a; cin >> a; f[a] = 1; } ll num = 1e9, ans; for (int i = n + 1; i >= 0; i--) { if (f[i]) continue; if (abs(x - i) <= num) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll x, n; cin >> x >> n; bool f[110] = {}; for (int i = 0; i < n; i++) { ll a; cin >> a; f[a] = 1; } ll num = 1e9, ans; for (int i = 101; i >= 0; i--) { if (f[i]) continue; if (abs(x - i) <= num) { ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
134