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 <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long; const int INF = 1001001001; int min(int a, int b) { return (a < b) ? a : b; } int main() { int x, n; cin >> x >> n; int p[n]; for ...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long; const int INF = 1001001001; int min(int a, int b) { return (a < b) ? a : b; } int main() { int x, n; cin >> x >> n; int p[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
222
#include <bits/stdc++.h> #define faster \ ios ::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long long #define ull unsi...
#include <bits/stdc++.h> #define faster \ ios ::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long long #define ull unsi...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 20], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 19], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 1...
1
237
#include <bits/stdc++.h> using namespace std; signed main() { int x, n, p, ans = -1; bool isp[201] = {}; cin >> x >> n; for (int i = 0; i < n; i++) { cin >> p; isp[p] = true; } for (int i = 100; i >= 0; i--) { if (isp[i] == false) { if (abs(x - i) <= abs(x - ans)) { ans = i; ...
#include <bits/stdc++.h> using namespace std; signed main() { int x, n, p, ans = 100000; bool isp[102] = {}; cin >> x >> n; for (int i = 0; i < n; i++) { cin >> p; isp[p] = true; } for (int i = 101; i >= 0; i--) { if (isp[i] == false) { if (abs(x - i) <= abs(x - ans)) { ans = i;...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 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]]
1
125
#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; if (n == 0) { cout << x << endl; return 0; } int p[101]; rep(i, 101) p[i] = 0; rep(i, n) { int tmp; cin >> tmp; p[tmp] = 1; } ...
#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; if (n == 0) { cout << x << endl; return 0; } int p[101]; rep(i, 101) p[i] = 0; rep(i, n) { int tmp; cin >> tmp; p[tmp] = 1; } ...
[["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["+", 0, 57, 75, 76, 0, 9, 0, 93, 0, 35]]
1
190
def resolve(): import sys input = sys.stdin.readline # 整数 1 つ # n = int(input()) # 整数複数個 x, n = map(int, input().split()) # 整数 N 個 (改行区切り) # N = [int(input()) for i in range(N)] # 整数 N 個 (スペース区切り) # N = list(map(int, input().split())) # 整数 (縦 H 横 W の行列) # A = [list(map(in...
def resolve(): import sys input = sys.stdin.readline # 整数 1 つ # n = int(input()) # 整数複数個 x, n = map(int, input().split()) # 整数 N 個 (改行区切り) # N = [int(input()) for i in range(N)] # 整数 N 個 (スペース区切り) # N = list(map(int, input().split())) # 整数 (縦 H 横 W の行列) # A = [list(map(in...
[["+", 0, 57, 75, 76, 8, 196, 0, 93, 0, 94]]
5
176
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define ALL(a) (a).begin(), (a).end() #define REP(i, n) for (size_t i = 0; i < (n); i++) #define nvec(T, v, n) ...
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; #define ALL(a) (a).begin(), (a).end() #define REP(i, n) for (size_t i = 0; i < (n); i++) #define nvec(T, v, n) ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
353
#include <algorithm> #include <iostream> #include <vector> int main() { int X, N; std::cin >> X >> N; std::vector<int> p(N); for (int i = 0; i < N; i++) std::cin >> p[i]; // ソートする std::sort(p.begin(), p.end()); // ない数を見る int tmp1 = -999; for (int j = 0; j <= 100; j++) { // ない数か? bool is...
#include <algorithm> #include <iostream> #include <vector> int main() { int X, N; std::cin >> X >> N; std::vector<int> p(N); for (int i = 0; i < N; i++) std::cin >> p[i]; // ソートする std::sort(p.begin(), p.end()); // ない数を見る int tmp1 = -999; for (int j = 0; j <= 101; j++) { // ない数か? bool is...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
183
#include <bits/stdc++.h> using namespace std; #define fi(a) scanf("%d", &a); #define fli(a) scanf("%ld", &a); #define fll(a) scanf("%lld", &a); #define pi(a) printf("%d\n", a); #define ppi(i, a) printf("Case %d: %d\n", i, a); #define ll long long #define fast ...
#include <bits/stdc++.h> using namespace std; #define fi(a) scanf("%d", &a); #define fli(a) scanf("%ld", &a); #define fll(a) scanf("%lld", &a); #define pi(a) printf("%d\n", a); #define ppi(i, a) printf("Case %d: %d\n", i, a); #define ll long long #define fast ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22]]
1
209
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline x, n, *p = map(int, read().split()) min_d = 1000000 if n == 0: print(x) exit() for i in range(101): if i in p: continue d = abs(x - i) if d < min_d: min_d = d ans = i print(ans)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline x, n, *p = map(int, read().split()) min_d = 1000000 if n == 0: print(x) exit() for i in range(110): if i in p: continue d = abs(x - i) if d < min_d: min_d = d ans = i print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
91
from math import * x,n=map(int,input().split()) p=[] if n>0: p=[int(i) for i in input().split()] mn=float('inf') ans=-1 for i in range(-1,101): if not i in p: if abs(x-i) < mn: ans=i mn=abs(x-i) print(ans)
from math import * x,n=map(int,input().split()) p=[] if n>0: p=[int(i) for i in input().split()] mn=float('inf') ans=-1 for i in range(-1,102): if not i in p: if abs(x-i) < mn: ans=i mn=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
101
import numpy as np def resolve(): x, n = map(int, input().split()) if n == 0: print(x) return P = set(map(int, input().split())) if x not in P: print(x) return P_not = np.array(list(set(list(range(-1, 101))) - P)) diff = np.abs(P_not - x) print(P_not[diff.ar...
import numpy as np def resolve(): x, n = map(int, input().split()) if n == 0: print(x) return P = set(map(int, input().split())) if x not in P: print(x) return P_not = np.array(list(set(list(range(-1, 102))) - P)) diff = np.abs(P_not - x) print(P_not[diff.ar...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
112
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<vector<int>> vvi; typedef vector<int> vi; typedef vector<str...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef vector<vector<int>> vvi; typedef vector<int> vi; typedef vector<str...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
291
//////////////////////// #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; namespace my { char itoc(int i) { return i + '0'; } int ctoi(char c) { return c - '0'; } ll gcd(ll a, ll b) { a = abs(a); b = abs(b); if (a < b) swap(a, b); while (b != 0) { a %= b; s...
//////////////////////// #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; namespace my { char itoc(int i) { return i + '0'; } int ctoi(char c) { return c - '0'; } ll gcd(ll a, ll b) { a = abs(a); b = abs(b); if (a < b) swap(a, b); while (b != 0) { a %= b; s...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
434
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main(void) { int X, N, ans = 0; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int p[N]; rep(i, N) { cin >> p[i]; } sort(p...
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main(void) { int X, N, ans = 0; cin >> X >> N; if (N == 0) { cout << X << endl; return 0; } int p[N]; rep(i, N) { cin >> p[i]; } sort(p...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 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,...
1
187
#include <bits/stdc++.h> #define fin \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ii pair<int, int> #define F fi...
#include <bits/stdc++.h> #define fin \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ii pair<int, int> #define F fi...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
415
// include<bits/stdc++.h> #include <iostream> #include <vector> using namespace std; using ll = long long; const int N = 1005, INF = 1000000005; bool vis[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int x, n; cin >> x >> n; for (int i = 0; i < n; i++) { int v; cin >> ...
// include<bits/stdc++.h> #include <iostream> #include <vector> using namespace std; using ll = long long; const int N = 1005, INF = 1000000005; bool vis[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int x, n; cin >> x >> n; for (int i = 0; i < n; i++) { int v; cin >> ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["-", 0, 7, 8, 9...
1
172
#include <bits/stdc++.h> using namespace std; // NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER // ABC 170, task , 2020/06/14 // ms, /* */ int main(void) { vector<int> inP(101); for (int i = 0; i < 101; i++) inP[i] = 1; int X, N, p, ans; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p; ...
#include <bits/stdc++.h> using namespace std; // NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER // ABC 170, task , 2020/06/14 // ms, /* */ int main(void) { vector<int> inP(200); for (int i = 0; i < 200; i++) inP[i] = 1; int X, N, p, ans; cin >> X >> N; for (int i = 0; i < N; i++) { cin >> p; ...
[["-", 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
154
import numpy as np # スペース区切りの整数の入力 X, N = map(int, input().split()) if N == 0: print(0) exit(0) P = np.array(list(map(int, input().split()))) ## sec2 for i in range(100): if sum(P == X - i) == 0: print(X - i) exit(0) if sum(P == X + i) == 0: print(X + i) exit(0)
import numpy as np # スペース区切りの整数の入力 X, N = map(int, input().split()) if N == 0: print(X) exit(0) P = np.array(list(map(int, input().split()))) ## sec2 for i in range(101): if sum(P == X - i) == 0: print(X - i) exit(0) if sum(P == X + i) == 0: print(X + i) exit(0)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
109
from sys import stdin A = list(map(int,stdin.readline().split())) B = list(map(int,stdin.readline().split())) C = [x for x in range(-100,101)] C = set(C) B = set(B) C = C.difference(B) C = list(C) X=A[0] N=A[1] record=200 number=0 K=0 if N==0: print(X) K=1 for t in C: diff=abs(t-X) if diff<record: ...
from sys import stdin A = list(map(int,stdin.readline().split())) B = list(map(int,stdin.readline().split())) C = [x for x in range(-10,110)] C = set(C) B = set(B) C = C.difference(B) C = list(C) X=A[0] N=A[1] record=200 number=1000 K=0 if N==0: print(X) K=1 for t in C: diff=abs(t-X) if diff<record: ...
[["-", 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], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
162
#include <bits/stdc++.h> using namespace std; #define PI 3.14159265358979323 #define ll long long int #define vi vector<int> #define vl vector<ll> #define all(v) (v).begin(), (v).end() #define pb push_back ll power(ll a, ll b) { // a^b ll res = 1; while (b > 0) { if (b & 1) { res = (res * a); b--; ...
#include <bits/stdc++.h> using namespace std; #define PI 3.14159265358979323 #define ll long long int #define vi vector<int> #define vl vector<ll> #define all(v) (v).begin(), (v).end() #define pb push_back ll power(ll a, ll b) { // a^b ll res = 1; while (b > 0) { if (b & 1) { res = (res * a); b--; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
354
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vi = vector<int>; #define _GLIBCXX_DEBUG #define IO_STREAM \ cin.tie(0); \ ios::sync_with_std...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vi = vector<int>; #define _GLIBCXX_DEBUG #define IO_STREAM \ cin.tie(0); \ ios::sync_with_std...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
283
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; } else { vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } int ans1 = 0; int ans2 = 0; int count = 0; for (int j = X; j > 1; j--) { co...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X << endl; } else { vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } int ans1 = 0; int ans2 = 0; int count = 0; for (int j = X; j > 0; j--) { co...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
274
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int arr[201]; memset(arr, 0, sizeof(arr)); int c; for (int i = 0; i < n; i++) { cin >> c; arr[c + 100] = 1; } if (arr[x + 100] == 0) { printf("%d\n", x); } else { for (int i = 1; i <= 100; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int arr[202]; memset(arr, 0, sizeof(arr)); int c; for (int i = 0; i < n; i++) { cin >> c; arr[c + 100] = 1; } if (arr[x + 100] == 0) { printf("%d\n", x); } else { for (int i = 1; i <= 101; i++) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 17, 72], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 12, 13]]
1
174
#include <iostream> #include <vector> using namespace std; int main() { int X, N; cin >> X; cin >> N; vector<int> p(N); for (int i = 0; i < N; ++i) { cin >> p[i]; } int cand = X; int abs = 0; int sign = 1; while (true) { bool b = false; cand = X + abs * sign; abs++; sign = -s...
#include <iostream> #include <vector> using namespace std; int main() { int X, N; cin >> X; cin >> N; vector<int> p(N); for (int i = 0; i < N; ++i) { cin >> p[i]; } int cand = X; int abs = 0; int sign = 1; while (true) { bool b = false; cand = cand + abs * sign; abs++; sign =...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
151
x, n = map(int, input().split()) if n != 0: p = list(map(int, input().split())) for i in range(1,100): # print("-i:",p.count(x-i)) # print("+i:",p.count(x+i)) if p.count(x-i) == 0: print(x-i) break elif p. count(x+i) == 0: 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(100): # print("-i:",p.count(x-i)) # print("+i:",p.count(x+i)) if p.count(x-i) == 0: print(x-i) break elif p. count(x+i) == 0: 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, 21]]
5
94
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; for (int i = 0; i < N; i++) { cin >> p[i]; } vector<int> lost(1); lost.at(0) = 10000000; for (int i = 0; i <= 100; i++) { bool add = true; for (int j = 0; j < N; j++) { if (i == p[j]) { ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; int p[N]; for (int i = 0; i < N; i++) { cin >> p[i]; } vector<int> lost(1); lost.at(0) = 10000000; for (int i = -1; i <= 101; i++) { bool add = true; for (int j = 0; j < N; j++) { if (i == p[j]) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
239
x, n = map(int, input().split()) if n ==0: print(x) else: p = list(map(int, input().split())) p.sort() #print(p) ans = 1000 xx = 0 for i in range(100): if not i in p: if x-i>=0 and ans>x-i: ans = x-i xx = i elif i-x>0 and a...
x, n = map(int, input().split()) if n ==0: print(x) else: p = list(map(int, input().split())) p.sort() #print(p) ans = 1000 xx = 0 for i in range(102): if not i in p: if x-i>=0 and ans>x-i: ans = x-i xx = i elif i-x>0 and a...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
116
#include <algorithm> #include <bits/stdc++.h> //#include<conio.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p; for (int i = 0; i < N; i++) { int P; cin >> P; p.push_back(P); } if (N == 0) { cout << X << endl; //_getch(); return 0; } auto result = ...
#include <algorithm> #include <bits/stdc++.h> //#include<conio.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> p; for (int i = 0; i < N; i++) { int P; cin >> P; p.push_back(P); } if (N == 0) { cout << X << endl; //_getch(); return 0; } auto result = ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
238
#include <bits/stdc++.h> using namespace std; int main() { int x, n, pn, min; int p[105] = {}; cin >> x >> n; min = 1000; if (n == 0) cout << x << endl; else { for (int i = 0; i < n; i++) { cin >> pn; p[pn] = 1; } for (int i = 1; i < 101; i++) { if (p[i] == 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, pn, min; int p[105] = {}; cin >> x >> n; min = 1000; if (n == 0) cout << x << endl; else { for (int i = 0; i < n; i++) { cin >> pn; p[pn] = 1; } for (int i = 0; i < 102; i++) { if (p[i] == 0) { ...
[["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
169
#include <bits/stdc++.h> using namespace std; #define ALL(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int X, N; cin >> X >> N; vector<int> A(N); rep(i, N) cin >> A.at(i); int t = 0; int ans = 100000; int Z = 10000; int F = 0; if (N == 0) { cout << X << endl;...
#include <bits/stdc++.h> using namespace std; #define ALL(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int X, N; cin >> X >> N; vector<int> A(N); rep(i, N) cin >> A.at(i); int t = 0; int ans = 100000; int Z = 10000; int F = 0; if (N == 0) { cout << X << endl;...
[["-", 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], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
231
#include <bits/stdc++.h> typedef long long lint; using namespace std; lint gcd(lint x, lint y) { if (x == 0) { return y; } else { return gcd(y % x, x); } } lint lcm(lint x, lint y) { return x / gcd(x, y) * y; } lint C(lint n, lint k) { if (n == k) { return 1; } else if (n < k) { return 0; ...
#include <bits/stdc++.h> typedef long long lint; using namespace std; lint gcd(lint x, lint y) { if (x == 0) { return y; } else { return gcd(y % x, x); } } lint lcm(lint x, lint y) { return x / gcd(x, y) * y; } lint C(lint n, lint k) { if (n == k) { return 1; } else if (n < k) { return 0; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
355
#include <cmath> #include <cstdlib> #include <iostream> #include <vector> using namespace std; using graph = vector<vector<int>>; using ll = long long; using p = pair<int, int>; bool isContain(int a, vector<int> p) { int n = p.size(); for (int i = 0; i < (n); ++i) { if (a == p[i]) { return true; } ...
#include <cmath> #include <cstdlib> #include <iostream> #include <vector> using namespace std; using graph = vector<vector<int>>; using ll = long long; using p = pair<int, int>; bool isContain(int a, vector<int> p) { int n = p.size(); for (int i = 0; i < (n); ++i) { if (a == p[i]) { return true; } ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
224
package main import ( "fmt" "math" "sort" ) // go run ./main.go < in func main() { var x, n int fmt.Scan(&x, &n) if n == 0 { fmt.Println(x) } else { var inputMap = make(map[int]bool) for i := 0; i < n; i++ { var x int fmt.Scan(&x) inputMap[x] = true } var nums []int for i := 0; i <= 10...
package main import ( "fmt" "math" "sort" ) // go run ./main.go < in func main() { var x, n int fmt.Scan(&x, &n) if n == 0 { fmt.Println(x) } else { var inputMap = make(map[int]bool) for i := 0; i < n; i++ { var x int fmt.Scan(&x) inputMap[x] = true } var nums []int for i := -200; i <=...
[["-", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["+", 0, 430, 10, 431, 12, 432, 0, 91, 17, 33], ["+", 0, 430, 10, 431, 12, 432, 0, 91, 439, 433], ["-", 75, 196, 0, 7, 0, 430, 15, 16, 12, 433], ["+", 75, 196, 0, 7, 0, 430, 15, 16, 12, 433]]
7
227
def main(): x,y = list(map(int, input().split())) if y == 0: print(x) exit() nums = list(map(int, input().split())) ans = 101 for i in range(1, 200): if i not in nums: ans = ans if abs(ans-x) <= abs(i-x) else i print(ans) if __name__ == '__main__': mai...
def main(): x,y = list(map(int, input().split())) if y == 0: print(x) exit() nums = list(map(int, input().split())) ans = 0 for i in range(1, 200): if i not in nums: ans = ans if abs(ans-x) <= abs(i-x) else i print(ans) if __name__ == '__main__': main(...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
105
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; //マクロ #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORD(i, a, b) for (ll i = (a); i >= (b); i--) #defi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; //マクロ #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORD(i, a, b) for (ll i = (a); i >= (b); i--) #defi...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
264
#include <algorithm> #include <climits> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> non; for (int i = 0; i < n; i++) { int tmp; cin...
#include <algorithm> #include <climits> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; int main() { int x, n; cin >> x >> n; vector<int> non; for (int i = 0; i < n; i++) { int tmp; cin...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
178
X,N = map(int,input().split()) if N == 0: print(X) exit() P = [int(i) for i in input().split()] mn = 1000 for i in reversed(range(101)): if i in P: continue if mn >= abs(X-i): ans = i mn = min(mn,abs(X-i)) print(ans)
X,N = map(int,input().split()) if N == 0: print(X) exit() P = [int(i) for i in input().split()] mn = 1000 for i in reversed(range(102)): if i in P: continue if mn >= abs(X-i): ans = i mn = min(mn,abs(X-i)) print(ans)
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
96
#include <bits/stdc++.h> using namespace std; int main() { int j, n, i, ans = 0, mx = INT_MAX, x, y, c = 0; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } int a[n + 2]; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 1; i <= 1000; i++) { c = 0; for (j = 0; j < n; j++) ...
#include <bits/stdc++.h> using namespace std; int main() { int j, n, i, ans = 0, mx = INT_MAX, x, y, c = 0; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } int a[n + 2]; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i <= 1000; i++) { c = 0; for (j = 0; j < n; j++) ...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
183
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << endl; return 0; } else { vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } sort(p.begin(), p.end()); int zure = 0; int target = X; for (zure = ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; if (N == 0) { cout << X; return 0; } else { vector<int> p(N); for (int i = 0; i < N; i++) { cin >> p.at(i); } sort(p.begin(), p.end()); int zure = 0; int target = X; for (zure = 0; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
231
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int p[n]; if (n == 0) { cout << x << endl; return 0; } bool flag = 1; for (int i = 0; i < n; i++) { cin >> p[i]; } int i = 1; while (i != 1000) { int y = x - i; int z = x + i; if (x >=...
#include <bits/stdc++.h> using namespace std; int main() { int x, n; cin >> x >> n; int p[n]; if (n == 0) { cout << x << endl; return 0; } bool flag = 1; for (int i = 0; i < n; i++) { cin >> p[i]; } int i = 0; while (i != 1000) { int y = x - i; int z = x + i; if (x >=...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
215
def main(): X, N = map(int, input().split()) if N == 0: return X P = list(map(int, input().split())) delta = [] for n in range(-1, 102): if n in P: delta.append(float('inf')) else: delta.append(abs(X - n)) minD = min(delta) for i, d in enumerate(delta): if d == min...
def main(): X, N = map(int, input().split()) if N == 0: return X P = list(map(int, input().split())) delta = [] for n in range(-1, 102): if n in P: delta.append(float('inf')) else: delta.append(abs(X - n)) minD = min(delta) for i, d in enumerate(delta): if d == min...
[["-", 0, 57, 64, 196, 0, 37, 0, 657, 17, 72], ["+", 0, 57, 64, 196, 0, 37, 0, 657, 17, 33]]
5
120
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) absv = x for i in range(-1, 100): if i in p: pass else: if absv > abs(x - i): absv = abs(x - i) value = x - i print(x - value)
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) absv = x value = x for i in range(-1, 102): if i in p: pass else: if absv > abs(x - i): absv = abs(x - i) value = x - i print(x - value)
[["+", 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, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
95
[_x, _n] = list(map(int, input().split(" "))) if _n == 0: print(_x) else: _list = list(map(int, input().split(" "))) _answer = 0 _flag = False if _x not in _list or _n == 0: _answer = _x _flag = True else: for _i in range(_n): if _i / 2 == 0: if _x - _i//2 - 1 not in _list and _fl...
[_x, _n] = list(map(int, input().split(" "))) if _n == 0: print(_x) else: _list = list(map(int, input().split(" "))) _answer = 0 _flag = False if _x not in _list or _n == 0: _answer = _x _flag = True else: for _i in range(_n): if _i % 2 == 0: if _x - _i//2 - 1 not in _list and _fl...
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 85], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109]]
5
156
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { var x, n int var in []int var ou1 = map[int]int{} var ou2 = map[int]int{} fmt.Scanf("%d %d", &x, &n) sc := bufio.NewScanner(os.Stdin) sc.Scan() inst := strings.Split(sc.Text(), " ") for _, i := range inst { t, _ := strconv....
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { var x, n int var in []int var ou1 = map[int]int{} var ou2 = map[int]int{} fmt.Scanf("%d %d", &x, &n) sc := bufio.NewScanner(os.Stdin) sc.Scan() inst := strings.Split(sc.Text(), " ") for _, i := range inst { t, _ := strconv....
[["-", 8, 196, 0, 431, 12, 432, 0, 437, 439, 22], ["+", 8, 196, 0, 431, 12, 432, 0, 437, 439, 22], ["-", 36, 36, 36, 36, 36, 36, 0, 434, 0, 165], ["+", 36, 36, 36, 36, 36, 36, 0, 434, 0, 165]]
7
253
#include <algorithm> #include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i <= 100; i++) { for (int j = -100; j <= 100; j++) { if (abs(x - j...
#include <algorithm> #include <iostream> using namespace std; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i <= 101; i++) { for (int j = 0; j <= 101; j++) { if (abs(x - j) =...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
165
x,n = map(int, input().split()) if n ==0: print(x) if n != 0: i = list(map(int, input().split())) if x not in i: print(x) break else: p = 1 while True: z = x - p if z not in i: print(z) break z = x + p if z not in i: print(z) break p = p ...
x,n = map(int, input().split()) if n ==0: print(x) if n != 0: i = list(map(int, input().split())) if x not in i: print(x) else: p = 1 while True: z = x - p if z not in i: print(z) break z = x + p if z not in i: print(z) break ...
[["-", 0, 656, 0, 57, 64, 196, 0, 93, 0, 94]]
5
103
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } //例外1 if (N == 0) { cout << X << endl; return 0; } //例外2 int check = 0; for (int i = 0; i < N; i++) { if (vec.at(i) == X) ...
#include <bits/stdc++.h> using namespace std; int main() { int X, N; cin >> X >> N; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } //例外1 if (N == 0) { cout << X << endl; return 0; } //例外2 int check = 0; for (int i = 0; i < N; i++) { if (vec.at(i) == X) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
270
function Main(input) { input = input.split("\n"); let target = parseInt(input[0].split(" ")[0]); let zerocheck = parseInt(input[0].split(" ")[1]); if (zerocheck == 0) { console.log(target); } else { let str = input[1].split(" "); for (let i = 0; i < str.length; i++) { let num = parseInt(str[...
function Main(input) { input = input.split("\n"); let target = parseInt(input[0].split(" ")[0]); let zerocheck = parseInt(input[0].split(" ")[1]); if (zerocheck == 0) { console.log(target); } else { let str = input[1].split(" "); for (let i = 0; i < str.length; i++) { let num = parseInt(str[...
[["-", 0, 556, 0, 7, 10, 570, 0, 200, 51, 555], ["+", 0, 556, 0, 7, 10, 570, 0, 200, 51, 555]]
2
231
X, N = gets.split.map(&:to_i) result = [] if N == 0 print X else n_ary = gets.split.map(&:to_i) ary = [] (1..100).each do |i| ary.push i end n_ary.each do |j| ary.delete(j) end result.push ary.min_by{|x| (x-X).abs} puts result.min end
X, N = gets.split.map(&:to_i) result = [] if N == 0 print X else n_ary = gets.split.map(&:to_i) ary = [] (-100..300).each do |i| ary.push i end n_ary.each do |j| ary.delete(j) end result.push ary.min_by{|x| (x-X).abs} puts result.min end
[["-", 75, 95, 0, 652, 486, 739, 0, 475, 756, 612], ["-", 75, 95, 0, 652, 486, 739, 0, 475, 17, 757], ["+", 0, 652, 486, 739, 0, 475, 756, 748, 17, 33], ["+", 75, 95, 0, 652, 486, 739, 0, 475, 17, 757], ["+", 75, 95, 0, 652, 486, 739, 0, 475, 444, 612]]
4
92
import sys input = sys.stdin.readline def main(): x, n = [int(i) for i in input().split()] p = set([int(i) for i in input().split()]) ans = x for i in range(1, 101): if i in p: continue if i <= x: ans = i elif x - ans > i - x: ans = i ...
# import numpy as np import sys input = sys.stdin.readline def main(): x, n = [int(i) for i in input().split()] p = set([int(i) for i in input().split()]) ans = x for i in range(-1, 102): if i in p: continue if i <= x: ans = i else: if x - ...
[["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121]]
5
109
#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); for (int i = 0; i < n; i++) cin >> p[i]; sort(p.begin(), p.end()); if (n == 0) cout << x << endl; el...
#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); for (int i = 0; i < n; i++) cin >> p[i]; sort(p.begin(), p.end()); if (n == 0) cout << x << endl; el...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
195
# coding: utf-8 # Your code here! x,n = map(int, input().split()) if n > 0: p = list(map(int , input().split())) else: p = [] a = list(set(list(range(1,1001))) - set(p)) values = [] for i in a: values = values + [[abs(x-i), i]] values.sort(key=lambda x: x[0]) mins = values[0][0] b = [] for i in values: ...
# coding: utf-8 # Your code here! x,n = map(int, input().split()) if n > 0: p = list(map(int , input().split())) else: p = [] a = list(set(list(range(-100,102))) - set(p)) values = [] for i in a: values = values + [[abs(x-i), i]] values.sort(key=lambda x: x[0]) mins = values[0][0] b = [] for i in values: ...
[["-", 0, 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], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
154
n = input().split() X = int(n[0]) N = int(n[1]) try: n2 = input() except: pass if N == 0: print(X) else: n2 = n2.split() p = [int(item) for item in n2] for i in range(101): if i == 0: if X not in p: print(X) tmp = [] if (X + i not in p ): ...
n = input().split() X = int(n[0]) N = int(n[1]) try: n2 = input() except: pass if N == 0: print(X) else: n2 = n2.split() p = [int(item) for item in n2] for i in range(101): if i == 0: if X not in p: print(X) break tmp = [] ...
[["+", 64, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
146
#include <bits/stdc++.h> using namespace std; int main() { int x, n, ans = 100, tmp = 100; cin >> x >> n; vector<int> p(n), test(100); for (int i = 0; i <= 100; i++) test.at(i) = i; for (int i = 0; i < n; i++) { cin >> p.at(i); test.erase(remove(test.begin(), test.end(), p.at(i)), test.end()); ...
#include <bits/stdc++.h> using namespace std; int main() { int x, n, ans = 100, tmp = 100; cin >> x >> n; vector<int> p(n), test(102); for (int i = 0; i <= 101; i++) test.at(i) = i; for (int i = 0; i < n; i++) { cin >> p.at(i); test.erase(remove(test.begin(), test.end(), p.at(i)), test.end()); ...
[["-", 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
170
# -*- coding: utf-8 -*- x, n = map(int, input().split()) aa = 0 if n == 0: aa = 1 if aa == 0: p = list(map(int, input().split())) p.sort() i = 0 flg = 0 dis = [] while flg == 0: if i > 100: flg = 1 if i in p: dis.append(5000) else: di...
# -*- coding: utf-8 -*- x, n = map(int, input().split()) aa = 0 if n == 0: aa = 1 if aa == 0: p = list(map(int, input().split())) p.sort() i = 0 flg = 0 dis = [] while flg == 0: if i > 100: flg = 1 if i in p: dis.append(5000) else: d...
[["+", 0, 57, 64, 196, 0, 7, 12, 652, 63, 22], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 25]]
5
132
#include <iostream> #include <sstream> using namespace std; #include <algorithm> #include <bits/stdc++.h> #include <iterator> #include <utility> #define go return 0 #define rep(i, n) for (int i = 0; i < n; ++i) #define rep(j, m) for (int j = 0; j < m; ++j) #define REP(i, n) for (int i = 1; i <= n; ++i) #define all(v) (...
#include <iostream> #include <sstream> using namespace std; #include <algorithm> #include <bits/stdc++.h> #include <iterator> #include <utility> #define go return 0 #define rep(i, n) for (int i = 0; i < n; ++i) #define rep(j, m) for (int j = 0; j < m; ++j) #define REP(i, n) for (int i = 1; i <= n; ++i) #define all(v) (...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
304
#include <bits/stdc++.h> #define int long long using namespace std; int n, m, a[101], ans1 = 1e9, ans2; bool cmp(int x, int y) { return x < y; } signed main() { int l = 1; scanf("%lld%lld", &m, &n); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); sort(a + 1, a + n + 1, cmp); for (int i = 1; i <= 101; i...
#include <bits/stdc++.h> #define int long long using namespace std; int n, m, a[101], ans1 = 1e9, ans2; bool cmp(int x, int y) { return x < y; } signed main() { int l = 1; scanf("%lld%lld", &m, &n); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); sort(a + 1, a + n + 1, cmp); for (int i = 0; i <= 101; i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
186
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n[110], i, j, k, x, y, p, q; cin >> a >> b; if (b == 0) cout << a << endl; else { for (i = 0; i < b; i++) cin >> n[i]; y = a; for (i = 1;; i++) { p = 0; q = 0; x = a - i; y = y + 1; for (j = ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n[110], i, j, x, y, p, q; cin >> a >> b; if (b == 0) cout << a << endl; else { for (i = 0; i < b; i++) cin >> n[i]; y = a - 1; for (i = 0;; i++) { p = 0; q = 0; x = a - i; y = y + 1; for (j =...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 10, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 10, 11, 12, 13]]
1
222
#include <bits/stdc++.h> using namespace std; #define llt long long int #define modm 1000000007 int main() { int n, m, ans = INT_MAX, num, res = 0; string s1, s2; cin >> n >> m; int arr[m]; res = n; set<int> s; bool pres[101] = {false}; for (int i = 0; i < m; i++) { cin >> num; pres[num] = tru...
#include <bits/stdc++.h> using namespace std; #define llt long long int #define modm 1000000007 int main() { int n, m, ans = INT_MAX, num, res = 0; string s1, s2; cin >> n >> m; int arr[m]; res = n; set<int> s; bool pres[102] = {false}; for (int i = 0; i < m; i++) { cin >> num; pres[num] = tru...
[["-", 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, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
156
#include <bits/stdc++.h> #include <sstream> using namespace std; typedef long long ll; // loop #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++) #define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--) // STL #def...
#include <bits/stdc++.h> #include <sstream> using namespace std; typedef long long ll; // loop #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++) #define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--) // STL #def...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
273
#include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define mll map<ll, ll> #define pb push_back #define mp make_pair #define endl "\n" #define MAX 1e18 #define F first #define S second #define all(s) s.begin(), s.end() #define mod 998244353 ll lcm(ll a, ll b) { return (a * b) / (_...
#include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define mll map<ll, ll> #define pb push_back #define mp make_pair #define endl "\n" #define MAX 1e18 #define F first #define S second #define all(s) s.begin(), s.end() #define mod 998244353 ll lcm(ll a, ll b) { return (a * b) / (_...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
287
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define sz(x) int(x.size()) using ll = long long; using P = pair<int, int>; const ll LLINF = numeric_limits<long long>::max(); const int mod =...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) #define sz(x) int(x.size()) using ll = long long; using P = pair<int, int>; const ll LLINF = numeric_limits<long long>::max(); const int mod =...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
256
#include <bits/stdc++.h> typedef long long ll; using namespace std; using Graph = vector<vector<int>>; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define REPA(i, a) \ for (ll i = 0; i < (ll)(a.siz...
#include <bits/stdc++.h> typedef long long ll; using namespace std; using Graph = vector<vector<int>>; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define REPA(i, a) \ for (ll i = 0; i < (ll)(a.siz...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
442
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <string> #include <vector> #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <string> #include <vector> #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
395
#include <bits/stdc++.h> #include <cmath> #include <math.h> #include <stdio.h> using namespace std; #define vsort(vec) sort(vec.begin(), vec.end()) #define vreverse(vec) reverse(vec.begin(), vec.end()) using ll = long long; using ull = unsigned long long; const ll INF = 1001001001; // 10億7。   100000007 //最大公約数 ll gcd...
#include <bits/stdc++.h> #include <cmath> #include <math.h> #include <stdio.h> using namespace std; #define vsort(vec) sort(vec.begin(), vec.end()) #define vreverse(vec) reverse(vec.begin(), vec.end()) using ll = long long; using ull = unsigned long long; const ll INF = 1001001001; // 10億7。   100000007 //最大公約数 ll gcd...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
356
import sys x,n=map(int,input().split()) if n==0: print(x) sys.exit() p=list(map(int,input().split())) jud=[0 for i in range(101)] for i in p: jud[i]=1 if jud[x]==0: print(x) sys.exit() diff=1 while 1: if x >= diff and jud[x-diff]==0: print(x-diff) break if x + diff < 101 and jud[x+diff]==0: pr...
import sys x,n=map(int,input().split()) if n==0: print(x) sys.exit() p=list(map(int,input().split())) jud=[0 for i in range(102)] for i in p: jud[i]=1 if jud[x]==0: print(x) sys.exit() diff=1 while 1: if x >= diff and jud[x-diff]==0: print(x-diff) break if x + diff < 102 and jud[x+diff]==0: pr...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612]]
5
142
#include <bits/stdc++.h> #define mod 1000000009 #define int long long #define garou \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); using namespace std; int pow(int p, int r) { int ans = 1; while (r ...
#include <bits/stdc++.h> #define mod 1000000009 #define int long long #define garou \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); using namespace std; int pow(int p, int r) { int ans = 1; while (r ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
322
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) check = [True]*101 for i in p: check[i] = False mini = 100000 index = 1 for i in range(0,101): if check[i]: if mini > abs(x-i): #print(mini, abs(x-i)...
x, n = map(int, input().split()) if n == 0: print(x) else: p = list(map(int, input().split())) check = [True]*10001 for i in p: check[i] = False mini = 100000 index = 1 for i in range(0,1001): if check[i]: if mini > abs(x-i): #print(mini, abs(x...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
144
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long long int lli; typedef vector<ll> vl; #define pb push_back #define mp make_pair #define ff first #define ss second #define SQR(x) ((x) * (x)) #define loop(i, y) for (int i = 0; i < int(y); i++) #define FOR...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long long int lli; typedef vector<ll> vl; #define pb push_back #define mp make_pair #define ff first #define ss second #define SQR(x) ((x) * (x)) #define loop(i, y) for (int i = 0; i < int(y); i++) #define FOR...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
974
x,n = map(int,input().split()) if n==0: exit(print(x)) p = list(map(int,input().split())) p.sort() if x not in p: exit(print(x)) h=1000 l=1000 for i in range(x,101): if i not in p: h = i break for i in range(x,0,-1): if i not in p: l = i break if abs(x-h)>=abs(x-l): print(l) if a...
x,n = map(int,input().split()) if n==0: exit(print(x)) p = list(map(int,input().split())) p.sort() if x not in p: exit(print(x)) h=101 l=0 for i in range(x,101): if i not in p: h = i break for i in range(x,0,-1): if i not in p: l = i break if abs(x-h)>=abs(x-l): print(l) if abs(x...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
150
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; const ld PI = acos(-1); const ld EPS = 0.0000000001; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i =...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 1000000007; const ld PI = acos(-1); const ld EPS = 0.0000000001; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i =...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
235
x, n = map(int, input().split()) if n == 0: print(x) else: line = list(map(int, input().split())) for i in range(1, 100): a = x-i b = x+i if a not in line: print(a) exit() if b not in line: print(b) exit()
x, n = map(int, input().split()) if n == 0: print(x) else: line = list(map(int, input().split())) for i in range(0, 101): a = x-i b = x+i if a not in line: print(a) exit() if b not in line: print(b) exit()
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
90
#include <algorithm> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; int main() { int X, N; cin >> X >> N; vector<int> vec1(N); vector<int> vec2(N); for (int i = 0; i < N; i++) { cin >> vec1[i]; } for (int i = 0; i < N; i++) { vec2[i] = abs(X - vec1...
#include <algorithm> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; int main() { int X, N; cin >> X >> N; vector<int> vec1(N); vector<int> vec2(N); for (int i = 0; i < N; i++) { cin >> vec1[i]; } for (int i = 0; i < N; i++) { vec2[i] = abs(X - vec1...
[["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 17, 151]]
1
244
#include "bits/stdc++.h" using namespace ::std; typedef long long ll; typedef unsigned long long ull; int px[] = {0, 1, 0, -1, 1, -1, -1, 1}; int py[] = {1, 0, -1, 0, 1, 1, -1, -1}; int main() { int test, n, m, a, b; // scanf("%d", &test); scanf("%d%d", &n, &m); bool in[222]{}; for (int i = 0; i < m; +...
#include "bits/stdc++.h" using namespace ::std; typedef long long ll; typedef unsigned long long ull; int px[] = {0, 1, 0, -1, 1, -1, -1, 1}; int py[] = {1, 0, -1, 0, 1, 1, -1, -1}; int main() { int test, n, m, a, b; // scanf("%d", &test); scanf("%d%d", &n, &m); bool in[222]{}; for (int i = 0; i < m; +...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
221
#include <bits/stdc++.h> #define ll int #define ld long double #define mod 1000000007 #define pb push_back #define ff first #define ss second #define mp make_pair #define all(x) x.begin(), x.end() #define fastio \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define ll int #define ld long double #define mod 1000000007 #define pb push_back #define ff first #define ss second #define mp make_pair #define all(x) x.begin(), x.end() #define fastio \ ios_base::sync_with_stdio(false); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
174
x,n=map(int,input().split()) if n!=0: p=list(map(int,input().split())) else: print(x) exit() if x not in p: print(x) for i in range(1,100000000000): p_=x-i q=x+i if p_ not in p: print(p_) exit() if q not in p: print(q) exit()
x,n=map(int,input().split()) if n!=0: p=list(map(int,input().split())) else: print(x) exit() if x not in p: print(x) exit() for i in range(1,100000000000): p_=x-i q=x+i if p_ not in p: print(p_) exit() if q not in p: print(q) exit()
[["+", 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
103
package main import ( "fmt" "math" ) func main() { var x, n int fmt.Scan(&x, &n) if n == 0 { fmt.Print(x) return } var p = make([]int, n) for i := 0; i < n; i++ { var tmp int fmt.Scan(&tmp) p[i] = tmp } ans := 100 num := 0 for i := 0; i < 100; i++ { bl := false for _, e := range p { if i ...
package main import ( "fmt" "math" ) func main() { var x, n int fmt.Scan(&x, &n) if n == 0 { fmt.Print(x) return } var p = make([]int, n) for i := 0; i < n; i++ { var tmp int fmt.Scan(&tmp) p[i] = tmp } ans := 100 num := 0 for i := -1; i < 102; i++ { bl := false for _, e := range p { if i...
[["-", 0, 7, 0, 430, 10, 431, 12, 432, 0, 433], ["+", 0, 430, 10, 431, 12, 432, 0, 91, 17, 33], ["+", 0, 430, 10, 431, 12, 432, 0, 91, 439, 433], ["-", 8, 196, 0, 7, 0, 430, 15, 16, 12, 433], ["+", 8, 196, 0, 7, 0, 430, 15, 16, 12, 433]]
7
197
x,n=gets.split.map &:to_i if n==0 bs=[*0..100] else as=gets.split.map &:to_i bs=[*0..100]-as end p bs.min_by{|i|(i-x).abs}
x,n=gets.split.map &:to_i if n==0 bs=[*0..210] else as=gets.split.map &:to_i bs=[*0..210]-as end p bs.min_by{|i|(i-x).abs}
[["-", 0, 662, 12, 516, 0, 741, 0, 475, 444, 612], ["+", 0, 662, 12, 516, 0, 741, 0, 475, 444, 612], ["-", 12, 738, 31, 516, 0, 741, 0, 475, 444, 612], ["+", 12, 738, 31, 516, 0, 741, 0, 475, 444, 612]]
4
60
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const double Pi = acos(-1); const ll mod = 1e9 + 7; int main() { int x, n; cin >> x >> n; int ans = x; if (n > 0) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const double Pi = acos(-1); const ll mod = 1e9 + 7; int main() { int x, n; cin >> x >> n; int ans = x; if (n > 0) { ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
193
X, N = map(int, input().split()) if N == 0: Ps = {} print(X) exit() else: Ps = set(list(map(int, input().split()))) all_numbers = set(list(range(0, 101))) search_numbers = list(all_numbers - Ps) absolute_value = 1000 out = X for i in search_numbers: if abs(i - X) < absolute_value: absolut...
X, N = map(int, input().split()) if N == 0: Ps = {} print(X) exit() else: Ps = set(list(map(int, input().split()))) all_numbers = set(list(range(0, 102))) search_numbers = list(all_numbers - Ps) absolute_value = 1000 out = X for i in search_numbers: if abs(i - X) < absolute_value: absolut...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
112
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int X, N; cin >> X >> N; set<int> S; for (int i = 1; i <= 100; i++) { S.insert(i); } rep(i, N) { int p; cin >> p; S.erase(p); } int ans; int diff; ans = 0; diff = X; fo...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int X, N; cin >> X >> N; set<int> S; for (int i = 1; i <= 101; i++) { S.insert(i); } rep(i, N) { int p; cin >> p; S.erase(p); } int ans; int diff; ans = 0; diff = X; fo...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
170
x, n = gets.split.map(&:to_i) if n == 0 puts x exit end p = gets.split.map(&:to_i) h = Hash.new(0) p.each do |v| h[v] += 1 end min = Float::INFINITY -100.upto(100) do |i| next if h[i] > 0 min = (x - i).abs if min > (x - i).abs end if h[x - min] == 0 puts x - min else puts x + min end
x, n = gets.split.map(&:to_i) if n == 0 puts x exit end p = gets.split.map(&:to_i) h = Hash.new(0) p.each do |v| h[v] += 1 end min = Float::INFINITY -1.upto(101) do |i| next if h[i] > 0 min = (x - i).abs if min > (x - i).abs end if h[x - min] == 0 puts x - min else puts x + min end
[["-", 36, 36, 0, 493, 0, 652, 486, 748, 439, 612], ["+", 36, 36, 0, 493, 0, 652, 486, 748, 439, 612], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 612], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 612]]
4
117
#include <bits/stdc++.h> using namespace std; #define forr(i, a, n) for (int i = a; i < n; i++) #define loop(i, a, n) for (int i = a; i >= n; i--) int main() { ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(0); int a, b; cin >> a >> b; int c[b]; map<int, int> m; if (b == 0) { cout << a; ...
#include <bits/stdc++.h> using namespace std; #define forr(i, a, n) for (int i = a; i < n; i++) #define loop(i, a, n) for (int i = a; i >= n; i--) int main() { ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(0); int a, b; cin >> a >> b; int c[b]; map<int, int> m; if (b == 0) { cout << a; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
249
#include <iostream> using namespace std; int main(void) { int x, n; cin >> x >> n; int P[n]; int a = 100; int answer = 0; for (int i = 0; i < n; i++) { cin >> P[i]; } bool flag = true; for (int i = -100; i < 101; i++) { for (int j = 0; j < n; j++) { if (P[j] == i) { flag = false;...
#include <iostream> using namespace std; int main(void) { int x, n; cin >> x >> n; int P[n]; int a = 300; int answer = 100000; for (int i = 0; i < n; i++) { cin >> P[i]; } bool flag = true; for (int i = -100; i < 1000; i++) { for (int j = 0; j < n; j++) { if (P[j] == i) { flag = ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
157
x, n = gets.chomp.split(" ").map {|c| c.to_i} if n == 0 puts x exit end pl = gets.chomp.split(" ").map {|c| c.to_i} min_num = 0 min_abs = 1000 pl.sort! (0..101).each do |pi| p pi if pl.include?(pi) next end if min_abs > (x - pi).abs min_abs = (x - pi).abs min_num = pi end end puts min_num
x, n = gets.chomp.split(" ").map {|c| c.to_i} if n == 0 puts x exit end pl = gets.chomp.split(" ").map {|c| c.to_i} min_num = 0 min_abs = 1000 pl.sort! (0..101).each do |pi| if pl.include?(pi) next end if min_abs > (x - pi).abs min_abs = (x - pi).abs min_num = pi end end puts min_num
[["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22]]
4
111
def main(): x,n = map(int,input().split()) if n>0: p = list(map(int,input().split())) else: p = [] d = [i for i in range(0,102)] for i in range(len(d)): if d[i] in p: d[i] = 0 d = sorted(d) m = 10000 ans = 0 for i in range(len(d)): if d[i]=...
def main(): x,n = map(int,input().split()) if n>0: p = list(map(int,input().split())) else: p = [] d = [i for i in range(0,102)] for i in range(len(d)): if d[i] in p: d[i] = -1 d = sorted(d) m = 10000 ans = 0 for i in range(len(d)): if d[i]...
[["-", 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], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 664, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 664, 28, 612]]
5
164
#include <algorithm> #include <cmath> #include <cstdint> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using ll = long long; #define fast_io() \ ; ...
#include <algorithm> #include <cmath> #include <cstdint> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using ll = long long; #define fast_io() \ ; ...
[["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13]]
1
196
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int inf = 0xfff; const int maxn = 100005; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int a[200] = {0}; int main() { int x, n; cin >> x >> n; int b; for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int inf = 0xfff; const int maxn = 100005; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int a[200] = {0}; int main() { int x, n; cin >> x >> n; int b; for (int i = 1; i <= n; i++) { ...
[["-", 15, 339, 51, 91, 28, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 22]]
1
240
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define mod 998244353 #define pi 3.1415926535 #define fi first #define se second #define vll vector<ll> #define vpll vector<pair<ll, ll>> #define vvll vector<vll> #define str string #define umap unordered_map #define uset unordered_set #define rep...
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define mod 998244353 #define pi 3.1415926535 #define fi first #define se second #define vll vector<ll> #define vpll vector<pair<ll, ll>> #define vvll vector<vll> #define str string #define umap unordered_map #define uset unordered_set #define rep...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
434
import numpy as np x,n = map(int,input().split()) if n!=0: p = list(map(int,input().split())) q = [i for i in range(1,201)] r = set(q)-set(p) a = np.array(list(r)) f = [x]*(len(list(r))) b = np.array(f) c = a-b d = np.abs(c) e = np.argmin(d) print(int(c[int(e)])+x) else: ...
import numpy as np x,n = map(int,input().split()) if n!=0: p = list(map(int,input().split())) q = [i for i in range(-101,201)] r = set(q)-set(p) a = np.array(list(r)) f = [x]*(len(list(r))) b = np.array(f) c = a-b d = np.abs(c) e = np.argmin(d) print(int(c[int(e)])+x) else: ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 0, 659, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 659, 12, 652, 3, 4, 0, 664, 28, 612]]
5
143
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> #define modulus 1000000007 #define ll long long using namespace std; int n, x, mini = -1, res...
#include <algorithm> #include <iomanip> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <unordered_set> #include <vector> #define modulus 1000000007 #define ll long long using namespace std; int n, x, mini = -1, res...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
183
x,n = map(int,input().split()) if n!=0: p = list(map(int,input().split())) li = set([i for i in range(101)]) li = li-set(p) k=10**9 m=0 li=sorted(list(li)) for i in li: if k>abs(x-i): k=abs(x-i) m=i print(m) else: print(x)
x,n = map(int,input().split()) if n!=0: p = list(map(int,input().split())) li = set([i for i in range(102)]) li = li-set(p) k=10**9 m=0 li=sorted(list(li)) for i in li: if k>abs(x-i): k=abs(x-i) m=i print(m) else: print(x)
[["-", 0, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 0, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
114
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define ill long long #define fcout cout << fixed << setprecision(10) using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> #define rep(i, a, b) for (int i = (a); i < (b); i++) #define ill long long #define fcout cout << fixed << setprecision(10) using namespace std; int main() { int x, n; cin >> x >> n; vector<int> p(n); ...
[["-", 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
180
stand = [] emp = [100] ans = [] line = input().split() x = int(line[0]) if int(line[1]) == 0: ans = x elif int(line[1]) != 0: line2 = input().split() for i in range(1,101): stand.append(int(i)) for i in line2: if int(i) in stand: stand.remove(int(i)) for i in stand: candi = abs(x - i) ...
stand = [] emp = [100] ans = [] line = input().split() x = int(line[0]) if int(line[1]) == 0: ans = x elif int(line[1]) != 0: line2 = input().split() for i in range(-100,201): stand.append(int(i)) for i in line2: if int(i) in stand: stand.remove(int(i)) for i in stand: candi = abs(x...
[["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
140
X,N=map(int,input().split()) if N==0: print(X) exit() P=list(map(int,input().split())) for i in range(1,200): if (X-i) not in P: ans=X-i break if (X+i) not in P: ans=X+i break print(ans)
X,N=map(int,input().split()) if N==0: print(X) exit() P=list(map(int,input().split())) for i in range(0,200): if (X-i) not in P: ans=X-i break if (X+i) not in P: ans=X+i break print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
91
import sys X, N = map(int, input().split()) if N == 0: print(X) sys.exit() p = list(map(int, input().split())) mylist = [i for i in range(-1,102)] #print(mylist) mymin = float('INF') mynum = 0 for i in range(102): if abs(mylist[i] - X) < mymin and mylist[i] not in p: mymin = abs(mylist[i] - X) ...
import sys X, N = map(int, input().split()) if N == 0: print(X) sys.exit() p = list(map(int, input().split())) mylist = [i for i in range(-1,102)] #print(mylist) mymin = float('INF') mynum = 0 for i in range(103): if abs(mylist[i] - X) < mymin and mylist[i] not in p: mymin = abs(mylist[i] - X) ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
126
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
285
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } vector<int> p(n); for (int i ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; using pint = pair<int, int>; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { int x, n; cin >> x >> n; if (n == 0) { cout << x << endl; return 0; } vector<int> p(n); 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], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2,...
1
232
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define pb push_back typedef vector<int> vint; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int x, n; cin >> x >> n; vint p(n); fo...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define pb push_back typedef vector<int> vint; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int x, n; cin >> x >> n; vint p(n); fo...
[["-", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 29]]
1
183
#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 a, b; cin >> a >> b; if (b == 0) { cout << a; return 0; } set<int> S; rep(i, b) { int c; cin >> c; S.insert(c); } if (S.coun...
#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 a, b; cin >> a >> b; if (b == 0) { cout << a; return 0; } set<int> S; rep(i, b) { int c; cin >> c; S.insert(c); } if (!S.cou...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
269