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
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, int(n) + 1) #define RREP(i, n) RFOR(i, 0, n) #define RREP1(i, n) RFOR(i, 1, int(n) + 1) #def...
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, int(n) + 1) #define RREP(i, n) RFOR(i, 0, n) #define RREP1(i, n) RFOR(i, 1, int(n) + 1) #def...
[["+", 0, 14, 8, 9, 0, 43, 0, 153, 0, 154], ["+", 0, 171, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 48], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 0, 171, 0,...
1
313
#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() int main() { int n, k; std::cin >> n; std::cin >> k; std::vector<int> d(k); rep(i, k) std::cin >> d[i]; // rep(i,k)std::cout << d[i] << std::endl; for (int i = n;; i++)...
#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() int main() { int n, k; std::cin >> n; std::cin >> k; std::vector<int> d(k); rep(i, k) std::cin >> d[i]; // rep(i,k)std::cout << d[i] << std::endl; for (int i = n;; i++)...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 24], ["-", 49, 50, 51, 4, 0, 16, 31, 2, 63, 22], ["-", 51, 4, 0, 16, 31, 2, 3, 4, 0, 24], ["-", 51, 4, 0, 16, 31, 2, 3, 4, 0, 22], ["-", 51, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 43, 49,...
1
203
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, m, n) for (int i...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 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, 26, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 7, 26, 2...
1
207
def c_IrohaObsession(N, K, D): d = [str(i) for i in D] for i in range(N, 10000): for c in str(i): if c in d: break else: break return i N,K = [int(i) for i in input().split()] D = [int(i) for i in input().split()] print(c_IrohaObsession(N, K, D))
def c_IrohaObsession(N, K, D): d = [str(i) for i in D] i = N while True: for c in str(i): if c in d: break else: return i i += 1 N,K = [int(i) for i in input().split()] D = [int(i) for i in input().split()] print(c_IrohaObsession(N, K, D))
[["-", 0, 656, 0, 14, 8, 196, 0, 7, 0, 88], ["-", 0, 656, 0, 14, 8, 196, 0, 7, 0, 267], ["-", 0, 14, 8, 196, 0, 7, 12, 652, 63, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, ...
5
100
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int a[10] = {0}; for (int i = 0; i < k; ++i) { int aa; cin >> aa; a[aa]++; } for (int i = 0; i <= 9; ++i) { cout << a[i]; } cout << endl; while (1) { int tmp = n; int flg = 0; while (tmp) { ...
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int a[10] = {0}; for (int i = 0; i < k; ++i) { int aa; cin >> aa; a[aa]++; } while (1) { int tmp = n; int flg = 0; while (tmp) { for (int i = 0; i <= 9; ++i) { if (tmp % 10 == i && a[i]) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15,...
1
182
#include <bits/stdc++.h> #define REPI(i, n) for (int i = 0; i < n; i++) #define REPJ(j, n) for (int j = 0; j < n; j++) using namespace std; bool f(int n, bool *array) { for (; n > 0; n /= 10) { if (array[n % 10]) return 1; } return 0; } int main() { cin.tie(0); ios::sync_with_stdio(false); in...
#include <bits/stdc++.h> #define REPI(i, n) for (int i = 0; i < n; i++) #define REPJ(j, n) for (int j = 0; j < n; j++) using namespace std; bool f(int n, bool *array) { for (; n > 0; n /= 10) { if (array[n % 10]) return 1; } return 0; } int main() { cin.tie(0); ios::sync_with_stdio(false); in...
[["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 7...
1
157
#include <algorithm> #include <array> #include <bitset> #include <cstdlib> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <type_traits> #include <utility> #inclu...
#include <algorithm> #include <array> #include <bitset> #include <cstdlib> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <type_traits> #include <utility> #inclu...
[["-", 8, 9, 0, 52, 15, 339, 51, 11, 17, 32], ["-", 0, 52, 15, 339, 51, 11, 12, 16, 31, 22], ["-", 0, 52, 15, 339, 51, 11, 12, 16, 17, 85], ["-", 0, 52, 15, 339, 51, 11, 12, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 90], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9...
1
196
N, K = tuple(map(int, input().split())) D = list(map(int, input().split())) set_D = set(D) for i in range(N, 10000): tmp_set = set([int(c) for c in str(i)]) if len(set_D.intersection(tmp_set)) > 0: continue else: print(i) exit()
N, K = tuple(map(int, input().split())) D = list(map(int, input().split())) set_D = set(D) i = N while True: tmp_set = set([int(c) for c in str(i)]) if len(set_D.intersection(tmp_set)) > 0: i += 1 continue else: break print(i)
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 6...
5
93
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <sstream> #include <string.h> #include <string> #include <tuple> #include <vector> #define REP(i, x) for (int i{0}; i < (int)(x); i++) #define REPC(i, x) for (int i{0}; i <= (int)(x); i++) #define RR...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <numeric> #include <queue> #include <sstream> #include <string.h> #include <string> #include <tuple> #include <vector> #define REP(i, x) for (int i{0}; i < (int)(x); i++) #define REPC(i, x) for (int i{0}; i <= (int)(x); i++) #define RR...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 15, 16, ...
1
422
n, k = input().split() ds = list(map(int, input().split())) nums = [] for x in range(10): if x in ds: nums.append(1) else: nums.append(0) for x in range(n, n*10): ys = list(map(int,list(str(x)))) flag = False for y in ys: if nums[y]: flag = True bre...
n, k = map(int, input().split()) ds = list(map(int, input().split())) nums = [] for x in range(10): if x in ds: nums.append(1) else: nums.append(0) res = 0 for x in range(n, n*10): ys = list(map(int,list(str(x)))) flag = False for y in ys: if nums[y]: flag = Tr...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36...
5
117
#include <iostream> using namespace std; bool check(int d[], int num) { int dig; while (num) { dig = num % 10; if (d[dig] == 1) { return false; } num = num / 10; } return true; } int main(void) { int n, k; int j; int d[10] = {0}; cin >> n >> k; // cout << n << " " << k << endl;...
#include <iostream> using namespace std; bool check(int d[], int num) { int dig; while (num) { dig = num % 10; if (d[dig] == 1) { return false; } num = num / 10; } return true; } int main(void) { int n, k; int j; int d[10] = {0}; cin >> n >> k; // cout << n << " " << k << endl;...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15,...
1
155
#include <iostream> #include <math.h> #include <vector> using namespace std; int main() { int N, K, min = 0, t = 0; bool answer = true; cin >> N >> K; vector<char> D(K); for (int i = 0; i < K; i++) { cin >> D[i]; } for (int i = N; i < 10000; i++) { answer = true; for (int j = 0; j < to_string(...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int N, K; bool answer = true; cin >> N >> K; vector<char> D(K); for (int i = 0; i < K; i++) { cin >> D[i]; } for (int i = N;; i++) { answer = true; for (int j = 0; j < to_string(i).si...
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0,...
1
174
#include <bits/stdc++.h> using namespace std; #define lli long long int #define uli unsigned long long int #define INF 99999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = m - 1; i >= n; i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(), N.end()), N.end())...
#include <bits/stdc++.h> using namespace std; #define lli long long int #define uli unsigned long long int #define INF 99999999999 #define rep(i, m, n) for (lli i = m; i < n; i++) #define rrep(i, m, n) for (lli i = m - 1; i >= n; i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(), N.end()), N.end())...
[["-", 8, 9, 0, 52, 8, 9, 0, 9, 0, 45], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 9, 0, 57, 64, 93, 0, 94], ["-", 8, 9, 0, 9, 0, 57, 64, 93, 0, 35], ["-", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95], ["-", 8, 9, 0, 52, 8, 9, 0, 9, 0, 46], ["-", 8, 9, 0, 57, 15, 339, ...
1
356
N,K = map(int,input().split()) D = list(map(int,input().split())) isNotMin = True temp = N * 1 while isNotMin: for i in str(temp): if int(i) in D: temp += 1 break else: print(temp) isNotMin = False break
N,K = map(int,input().split()) D = list(map(int,input().split())) isNotMin = True temp = N * 1 while isNotMin: for i in str(temp): if int(i) in D: temp += 1 isNotMin = True break else: isNotMin = False print(temp)
[["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 146], ["+", 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, 147], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["-"...
5
74
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools,pdb sys.setrecursionlimit(10**7) inf = 10 ** 20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def ...
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools,pdb sys.setrecursionlimit(10**7) inf = 10 ** 20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 70], ["-", 0...
5
399
#include <algorithm> #include <functional> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> D; //長さKの配列D、入力された数値のみが末尾に入る。 for (int i = 0; i < K; i++) { int d; cin >> d; D.push_back(d); } int an...
#include <algorithm> #include <functional> #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; //前提:解は必ず存在する int main() { int N, K; cin >> N >> K; vector<int> D; //配列D、嫌いな数字を入れていく。 for (int i = 0; i < K; i++) { int d; cin >> d; D.push_back(d); } ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 14, 8, 9, 0, ...
1
178
s=input().split() money,num=int(s[0]),int(s[1]) no_list=input().split() flag=0 for i in range(money,10000): for money_element in list(str(i)): if money_element in no_list: flag=1 break if flag==0: print(i) break
s=input().split() money,num=int(s[0]),int(s[1]) no_list=input().split() for i in range(money,100000): flag=0 for money_element in list(str(i)): if money_element in no_list: flag=1 break if flag==0: print(i) break
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7,...
5
80
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned long ...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; typedef long long ll; typedef unsigned long ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, ...
1
310
n, k = map(int, input().split()) d = list(map(str, input().split())) num = [0 for _ in range(10)] for v in d: num[int(v)] = 1 for j in range(1, 1000): v = j * n v_l = list(str(v)) flag = True for i in v_l: if num[int(i)] == 1: flag = False break if flag: ...
n, k = map(int, input().split()) d = list(map(str, input().split())) num = [0 for _ in range(10)] for v in d: num[int(v)] = 1 for j in range(10 * n): v = n + j v_l = list(str(v)) flag = True for i in v_l: if num[int(i)] == 1: flag = False break if flag: ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 8...
5
116
#include <bits/stdc++.h> using namespace std; map<int, int> m; int main() { string n; int answer = 0, k; cin >> n >> k; for (int i = 0; i < k; i++) { int temp; cin >> temp; m[temp] = 1; } for (int i = 0; i < n.size(); i++) { int num = n[i] - '0'; for (; num < 10; num++) { if (m[n...
#include <bits/stdc++.h> using namespace std; map<int, int> m; int main() { string n; int answer = 0, k; cin >> n >> k; for (int i = 0; i < k; i++) { int temp; cin >> temp; m[temp] = 1; } for (int i = 0; i < n.size(); i++) { int num = n[i] - '0'; int init = num; for (; num < 10; nu...
[["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 0, 35], ["-", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["-", 15, 339, 51, 16, 31, 23, 0, 16, 17, 60], ["-", 15, 339, 51, 16,...
1
178
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namesp...
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <utility> #include <vector> using namesp...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 7, 1...
1
471
inputted = input().split(" ") N=int(inputted[0]) K=int(inputted[1]) s = [i for i in input() if i != ' '] num=0 while True: num+=1 match=[i for i in str(num) if i not in s] if num>=N and len(match)==len(str(N)): print(num) break
inputted = input().split(" ") N=int(inputted[0]) K=int(inputted[1]) s = [i for i in input() if i != ' '] num=0 while True: num+=1 match=[i for i in str(num) if i in s] if num>=N and len(match)==0: print(num) break
[["-", 0, 662, 12, 658, 0, 678, 0, 666, 667, 699], ["-", 0, 57, 15, 679, 12, 666, 0, 652, 63, 22], ["-", 15, 679, 12, 666, 0, 652, 3, 4, 0, 24], ["-", 12, 666, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-...
5
96
#include <iostream> #define MAXN 10 using namespace std; int N; int K; int D[MAXN]; int ans; bool checkDigit(int n) { while (n != 0) { for (int i = 0; i < K; i++) { if (n % 10 == D[i]) { return false; } else if (n % 10 > D[i]) { break; } } n /= 10; } return true; } ...
#include <iostream> #define MAXN 10 using namespace std; int N; int K; int D[MAXN]; int ans; bool checkDigit(int n) { while (n != 0) { for (int i = 0; i < K; i++) { if (n % 10 == D[i]) { return false; } // else if (n % 10 > D[i]) { // break; //} } n /= 10; } ret...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["-", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], [...
1
161
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <set> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; ++i) #define INPUT_INT1(n) \ int n; ...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <set> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; ++i) #define INPUT_INT1(n) \ int n; ...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 64, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 64...
1
310
package main import ( "fmt" "bufio" "os" "strconv" "strings" ) var stdin []string func main() { scanner := bufio.NewScanner(os.Stdin) var tmp string for scanner.Scan() { tmp = scanner.Text() if tmp == "" { break } else { stdin = appen...
package main import ( "fmt" "bufio" "os" "strconv" "strings" ) var stdin []string func main() { scanner := bufio.NewScanner(os.Stdin) var tmp string for scanner.Scan() { tmp = scanner.Text() if tmp == "" { break } else { stdin = appen...
[["-", 0, 435, 8, 196, 0, 431, 31, 432, 0, 22], ["-", 0, 434, 0, 435, 8, 196, 0, 431, 0, 466], ["-", 0, 431, 12, 432, 0, 2, 63, 438, 439, 22], ["-", 0, 431, 12, 432, 0, 2, 63, 438, 0, 131], ["-", 0, 431, 12, 432, 0, 2, 63, 438, 119, 120], ["-", 0, 431, 12, 432, 0, 2, 3, 4, 0, 24], ["-", 0, 431, 12, 432, 0, 2, 3, 4, 0, ...
7
342
n, k = map(int, input().split()) d = list(map(int, input().split())) ans = n while True: for i in str(ans): if i in d: break else: print(ans) exit() ans += 1
n, k = map(int, input().split()) d = input().split() ans = n while True: for i in str(ans): if i in d: break else: print(ans) exit() ans += 1
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 662, 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, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-", 12, 652...
5
65
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UncheckedIOException; import java.io.Writer; import java.nio.charset.Charset; import java...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UncheckedIOException; import java.io.Writer; import java.nio.charset.Charset; import java...
[["+", 8, 498, 0, 195, 8, 196, 0, 97, 0, 22], ["+", 8, 498, 0, 195, 8, 196, 0, 97, 0, 102], ["+", 0, 195, 8, 196, 0, 97, 0, 7, 0, 88], ["+", 0, 195, 8, 196, 0, 97, 0, 7, 0, 24], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 97, 0, 7, 502, 503, 49, 200, 141, 22], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 49...
3
696
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <sstream> #include <string> #include <utility> #include <vector> #define FOR(idx, begin, end) for (int idx = (begin); idx < int(end); ++idx) #define DBG(x) cerr << #x << ": " << x << "\n" using namespace std; typedef long long lint; ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <sstream> #include <string> #include <utility> #include <vector> #define FOR(idx, begin, end) for (int idx = (begin); idx < int(end); ++idx) #define DBG(x) cerr << #x << ": " << x << "\n" using namespace std; typedef long long lint; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 33], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], [...
1
201
#include <iostream> #include <math.h> using namespace std; int main() { int n, k; cin >> n >> k; int d, D[10]; for (int i = 0; i < k; i++) { cin >> d; D[d] = 1; } int num = n; while (1) { int tmp = num, judge = 1; while (tmp) { if (D[tmp % 10]) judge = 0; tmp /= 10;...
#include <iostream> #include <math.h> using namespace std; int main() { int n, k; cin >> n >> k; int d, D[10] = {}; for (int i = 0; i < k; i++) { cin >> d; D[d] = 1; } while (1) { int tmp = n, judge = 1; while (tmp) { if (D[tmp % 10]) judge = 0; tmp /= 10; } i...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 30, 0, 14, 8...
1
120
(function(in , n, s, t) { console.log(.slice(1).sort().join('')); in = in .split('\n'); n = Number(in [0].split(' ')[0]); s = String(n); t = in [1].split(' '); while (true) { for (var i = 0; i < t.length; i++) { if (s.indexOf(t[i]) >= 0) { s = String(++n); break; } } if (i == t.length) { ...
(function(p, n, s, t) { p = p.split('\n'); n = Number(p[0].split(' ')[0]); s = String(n); t = p[1].split(' '); while (true) { for (var i = 0; i < t.length; i++) { if (s.indexOf(t[i]) >= 0) { s = String(++n); break; } } if (i == t.length) { break; } } console.log(n); }(require("fs").rea...
[["-", 0, 23, 0, 2, 63, 63, 54, 495, 0, 22], ["+", 0, 23, 0, 2, 63, 63, 54, 495, 0, 22], ["-", 8, 556, 0, 1, 0, 2, 63, 558, 500, 22], ["-", 8, 556, 0, 1, 0, 2, 63, 558, 0, 131], ["-", 8, 556, 0, 1, 0, 2, 63, 558, 559, 560], ["-", 8, 556, 0, 1, 0, 2, 3, 3, 0, 24], ["-", 0, 1, 0, 2, 3, 3, 0, 42, 0, 131], ["-", 63, 558, 5...
2
176
#include <algorithm> #include <boost/multiprecision/cpp_int.hpp> #include <cstdint> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (int i = 0; i < ...
#include <algorithm> #include <boost/multiprecision/cpp_int.hpp> #include <cstdint> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (int i = 0; i < ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+"...
1
306
n,k=gets.split.map(&:to_i) d=gets.split.map(&:to_i) y = (0..9).to_a - d if (n.to_s.split('').map { |e| e.to_i } - y).empty? puts n exit end head = y.select { |e| e > 0 }.sort.first min = y.sort.first digits = n.to_s.size if n.to_s[0].to_i < head puts head.to_s + min.to_s * (digits - 1) else x = (head.to_s + min...
n,k=gets.split.map(&:to_i) d=gets.split.map(&:to_i) y = (0..9).to_a - d if (n.to_s.split('').map { |e| e.to_i } - y).empty? puts n exit end head = y.select { |e| e > 0 }.sort.first min = y.sort.first digits = n.to_s.size if n.to_s[0].to_i < head puts head.to_s + min.to_s * (digits - 1) else x = (head.to_s + min...
[["+", 196, 737, 8, 736, 0, 121, 15, 738, 17, 98], ["+", 0, 121, 15, 738, 12, 652, 486, 739, 0, 24], ["+", 0, 738, 31, 652, 486, 652, 486, 652, 486, 22], ["+", 0, 738, 31, 652, 486, 652, 486, 652, 17, 131], ["+", 0, 738, 31, 652, 486, 652, 486, 652, 735, 22], ["+", 486, 739, 0, 738, 31, 652, 486, 652, 17, 131], ["+", 4...
4
156
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <functional> #include <iostream> #include <limits> #include <math.h> #include <numeric> #include <queue> #include <type_traits> #include <vector> #define INF (1ll << 60) #define MOD 1000000007 #define BOUND 27182818284 typedef long long ll; type...
#include <algorithm> #include <bits/stdc++.h> #include <cstdio> #include <functional> #include <iostream> #include <limits> #include <math.h> #include <numeric> #include <queue> #include <type_traits> #include <vector> #define INF (1ll << 60) #define MOD 1000000007 #define BOUND 27182818284 typedef long long ll; type...
[["+", 64, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 91, 28, 69, 28, 22], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 91, 28, 69, 341, 342, 0, 7...
1
442
#include <iostream> #include <unordered_set> using namespace std; int main() { string N; int K; cin >> N >> K; unordered_set<int> s; int x; for (int i = 0; i < K; i++) { cin >> x; s.insert(x); } bool dp[100010] = {0}; for (int i = 1; i < 100000; i++) { if (i <= 9) { if (s.find(i) ==...
#include <iostream> #include <unordered_set> using namespace std; int main() { int N; int K; cin >> N >> K; unordered_set<int> s; int x; for (int i = 0; i < K; i++) { cin >> x; s.insert(x); } bool dp[100010] = {0}; for (int i = 1; i < 100000; i++) { if (i <= 9) { if (s.find(i) == s....
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 3, 4, 0, 16, 31, 2, 63, 118, 28, 22], ["+", 0, 16, 31, 2, 63, 118, 28, 2, 63, 22], ["+", 31, 2, 63, 118, 28, 2, 3, 4, 0, 24], ["+", 31, 2, 63, 118, 28, 2, 3, 4, 0, 22], ["+", 31, 2, 63, 118, 28, 2, 3, 4, 0, 25], ["-", 0, 7, 10, 4...
1
200
#include <iostream> #include <vector> using namespace std; int pow_10(int b) { int c = 1; for (int i = 0; i < b; ++i) { c = c * 10; } return c; } // aのb乗 bool good_number(int N, unsigned int K, const vector<int> &bad_number) { bool check = true; for (unsigned int i = 0; i < K; ++i) { if (N == bad_...
#include <iostream> #include <vector> using namespace std; int pow_10(int b) { int c = 1; for (int i = 0; i < b; ++i) { c = c * 10; } return c; } // aのb乗 bool good_number(int N, unsigned int K, const vector<int> &bad_number) { bool check = true; for (unsigned int i = 0; i < K; ++i) { if (N == bad_...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 3, 4, 0, 16, 31, 2, 63, 118, 28, 22], ["+", 3, 4, 0, 16, 31, 2, 63, 118, 17, 131], ["+", 3, 4, 0, 16, 31, 2, 63, 118, 119, 120], ["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3,...
1
584
#include <iostream> #include <string> int main() { int n, k; std::cin >> n >> k; std::string d = ""; char buf; for (int i = 0; i < k; ++i) { std::cin >> buf; d += buf; } bool flg = false; std::string nStr = std::to_string(n); while (!flg) { nStr = std::to_string(n); for (int i = 0; ...
#include <iostream> int main() { int n, k; std::cin >> n >> k; std::string d = ""; char buf; for (int i = 0; i < k; ++i) { std::cin >> buf; d += buf; } bool flg = false; std::string nStr; while (!flg) { nStr = std::to_string(n); for (int i = 0; i < k; ++i) { if (std::string::n...
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 43, 49, 50, 51, 2, 63, 343, 345, 348], ["-", 0, 43, 49, 50, 51, 2, 63, 343, 0, 349], ["-", 0, 43, 49, 50, 51, 2, 63, 343, 141, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ...
1
153
N, K = map(int,input().split()) D = list(map(int,input().split())) while True: for n in str(N): if(n in D): break else: break N += 1 print(N)
N, K = map(int,input().split()) D = input().split() while True: for n in str(N): if(n in D): break else: break N += 1 print(N)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 662, 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, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-", 12, 652...
5
62
#include <bits/stdc++.h> using namespace std; int N, K; vector<int> D(10), E(10); int m; void dfs(int a) { if (a >= N) { m = min(a, m); return; } else { for (int i = 0; i <= 9; i++) { bool w = true; for (int j = 0; j < K; j++) { if (i == D[j]) w = false; } if (...
#include <bits/stdc++.h> using namespace std; int N, K, m; vector<int> D(10); void dfs(int a) { if (a >= N) { m = min(a, m); return; } else { for (int i = 0; i <= 9; i++) { bool w = true; for (int j = 0; j < K; j++) { if (i == D[j]) w = false; } if (w) { ...
[["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 24], ["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 25], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["-", 36, 36...
1
227
import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(), k = sc.nextInt(); int[] d = new int[k]; for (int i = 0; i < k; i++) { d[i] = sc.nextInt(); } while (true) { for (int i ...
import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(), k = sc.nextInt(); int[] d = new int[k]; for (int i = 0; i < k; i++) { d[i] = sc.nextInt(); } while (true) { boolean mat...
[["+", 8, 196, 0, 52, 8, 196, 0, 503, 39, 523], ["+", 0, 52, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 52, 8, 196, 0, 503, 49, 200, 0, 32], ["+", 0, 52, 8, 196, 0, 503, 49, 200, 51, 147], ["+", 8, 196, 0, 52, 8, 196, 0, 503, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22...
3
154
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int n, k; char d[10]; cin >> n >> k >> d; string s; bool flag = false; while (1) { s = to_string(n); for (int i = 0; i < s.length(); i++) { for (int j = 0; j < k; j++) { if (s[i] == d[j]) { ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int n, k; char d[10]; cin >> n >> k; for (int i = 0; i < k; i++) { cin >> d[i]; } string s; bool flag = false; while (1) { s = to_string(n); for (int i = 0; i < s.length(); i++) { for (int j =...
[["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 7, 10, ...
1
146
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; int a[10] = {0}; for (int i = 0; i < k; i++) { int x; cin >> x; a[x] = 1; } for (int i = n; i < 10000; i++) { int x = i; bool flag = true; while (x) { int d; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; int a[10] = {0}; for (int i = 0; i < k; i++) { int x; cin >> x; a[x] = 1; } int i = n; while (true) { int x = i; bool flag = true; while (x) { int d; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 7, 26, 27...
1
146
#include <bits/stdc++.h> using namespace std; bool check(int x, vector<int> d) { string s = to_string(x); for (int i = 0; i < d.size(); i++) { for (int j = 0; j < s.size(); j++) { if (s[i] - '0' == d[i]) return false; } } return true; } int main() { int n, k; cin >> n >> k; vector<...
#include <bits/stdc++.h> using namespace std; bool check(int x, vector<int> d) { string s = to_string(x); for (int i = 0; i < d.size(); i++) { for (int j = 0; j < s.size(); j++) { if (d[i] == s[j] - '0') return false; } } return true; } int main() { int n, k; cin >> n >> k; vector<...
[["-", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 12, 16, 31, 69, 341,...
1
170
#include <bits/stdc++.h> #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define int long long typedef long long ll; using namespace std; const int MOD = 1000000007; const int INF = 1010000000; const double EPS = 1e-10; const array<pair<int, int>, 4> fd{make_pair(1, 0), make_pair(-...
#include <bits/stdc++.h> #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define int long long typedef long long ll; using namespace std; const int MOD = 1000000007; const int INF = 1010000000; const double EPS = 1e-10; const array<pair<int, int>, 4> fd{make_pair(1, 0), make_pair(-...
[["-", 0, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 51, 22], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 25], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 46]]
1
249
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define all(c) (c).begin(), (c...
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define all(c) (c).begin(), (c...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, ...
1
230
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> d(k); for (int i = 0; i < k; i++) { cin >> d[i]; } for (int i = n; i < 100000; i++) { if (find(d.begin(), d.end(), i / 10000) == d.end() && find(d...
#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> d(k); for (int i = 0; i < k; i++) { cin >> d[i]; } for (int i = n; i < 100000; i++) { if ((i / 10000 == 0 || find(d.begin(), d.end(), i / 10000) == d.end(...
[["+", 31, 16, 31, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 31, 22], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 17, 85], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 12, 13], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 17, 60], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 23, 0, 16, 17, 10...
1
220
#include <bits/stdc++.h> // #include <iostream> // #include <vector> // #include <map> // #include <algorithm> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) template <typename T> T gcd(T a, T b) { if (...
#include <bits/stdc++.h> // #include <iostream> // #include <vector> // #include <map> // #include <algorithm> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) template <typename T> T gcd(T a, T b) { if (...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 7, 26, 27...
1
353
#include <iostream> using namespace std; int main() { int N, K; cin >> N >> K; int a[10], d; for (int i = 0; i < 10; ++i) a[i] = 0; for (int i = 0; i < K; ++i) { cin >> d; ++a[d]; } int min = 0; while (a[min]) ++min; int ndig[6], ld; for (d = 0; d < 6; ++d) { if (N > 0 && N < 10...
#include <iostream> using namespace std; int main() { int N, K; cin >> N >> K; int a[10], d; for (int i = 0; i < 10; ++i) a[i] = 0; for (int i = 0; i < K; ++i) { cin >> d; ++a[d]; } int min = 0; while (a[min]) ++min; int ndig[6], ld; for (d = 0; d < 6; ++d) { if (N > 0 && N < 10...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9...
1
270
# encoding: utf-8 N, K = map(int, input().split()) D = list(map(int, input().split())) Db = [] for Di in range(10): if Di not in D: Db.append(Di) # print("#", Db) for level in range(6): if N // (10 ** level) < 1: break # print("#", level) # memo = [None] * (5 * 10000) def pay(pos, tmp): # print(...
# encoding: utf-8 N, K = map(int, input().split()) D = list(map(int, input().split())) Db = [] for Di in range(10): if Di not in D: Db.append(Di) # print("#", Db) for level in range(6): if N // (10 ** level) < 1: break # print("#", level) # memo = [None] * ((level + 1) * 10000) def pay(pos, tmp): ...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 679, 17, 354], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 20], ["-", 8, 196, 0, 37, 0, 657, 31, 657, 31, 612], ["-", 8, 196, 0, 37, 0, 657, 31,...
5
163
#include <algorithm> #include <iostream> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<ULL> VULL; class MYCP { public: static const LL TEISUU = 1000 * 1000 * 1000 + 7; sta...
#include <algorithm> #include <iostream> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<ULL> VULL; class MYCP { public: static const LL TEISUU = 1000 * 1000 * 1000 + 7; sta...
[["+", 64, 9, 0, 1, 0, 2, 63, 343, 345, 348], ["+", 64, 9, 0, 1, 0, 2, 63, 343, 0, 349], ["+", 64, 9, 0, 1, 0, 2, 63, 343, 141, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 3...
1
1,262
price, len_hate_set = map(int, input().split()) hate_set = set([int(i) for i in input().split()]) ans = 0 while True: if all(map(lambda x: int(x) in set(range(0, 10)) - hate_set, [int(str(ans)[i]) for i in range(len(str(ans)))])) and ans >= price: return ans ans += 1
def abc042_c(): price, len_hate_set = map(int, input().split()) hate_set = set([int(i) for i in input().split()]) ans = price while True: if all(map(lambda x: int(x) in set(range(0, 10)) - hate_set, [int(str(ans)[i]) for i in range(len(str(ans)))])) and ans >= price: ...
[["+", 36, 36, 36, 36, 0, 656, 0, 14, 0, 669], ["+", 36, 36, 36, 36, 0, 656, 0, 14, 141, 22], ["+", 36, 36, 0, 656, 0, 14, 54, 54, 0, 24], ["+", 36, 36, 0, 656, 0, 14, 54, 54, 0, 25], ["+", 36, 36, 36, 36, 0, 656, 0, 14, 0, 102], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 22], ...
5
105
#include <bits/stdc++.h> using namespace std; int n, k; int d[10]; int judge(int x) { while (x) { if (d[x % 10] != 0) return 0; x /= 10; } return 1; } int main() { cin >> n >> k; for (int i = 0; i < k; i++) { int dd; cin >> dd; d[dd]++; } int ans = 0; while (1) { ans +=...
#include <bits/stdc++.h> using namespace std; int n, k; int d[10]; int judge(int x) { while (x) { if (d[x % 10] != 0) return 0; x /= 10; } return 1; } int main() { cin >> n >> k; for (int i = 0; i < k; i++) { int tmp; cin >> tmp; d[tmp]++; } int ans = n; while (1) { if ...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 49, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 49, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, ...
1
126
#include <bits/stdc++.h> using namespace std; string num; int k, len; char least = '0'; bool disliked[10]; inline void setGreaterUtil(int pos) { for (int i = pos; i < len; i++) num[i] = least; } void setGreater(int pos) { if (disliked[num[pos] - '0']) { if (num[pos] == '9') { num[pos] = '0'; ...
#include <bits/stdc++.h> using namespace std; string num; int k, len; char least = '0'; bool disliked[10]; inline void setGreaterUtil(int pos) { for (int i = pos; i < len; i++) num[i] = least; } void setGreater(int pos) { if (num[pos] == '9') { if (disliked[0]) setGreaterUtil(pos); setGreater(...
[["-", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 70], ["-", 51, 69, 341, 342, 0, 16, 31, 69, 28, 22], ["-", 341, 342, 0, 16, 31, 69, 341, 342, 0, 70], ["-", 341, 342, 0, 16, 31, 69, 341, 342, 0, 22], ["-", 341, 342, 0, 16, 31, 69, 341, 342, 0, 73], ["-", 15, 339, 51, 69, 341, 342...
1
342
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) using namespace std; bool check(int N, vector<int> D, int K) { while (N > 0) { int t = N % 10; REP(i, K) { if (t == D[i]) { ...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) using namespace std; bool check(int N, vector<int> D) { while (N > 0) { int t = N % 10; REP(i, D.size()) { if (t == D[i]) { ...
[["-", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2,...
1
181
function main(input) { var inputs = input.split("\n"); var money = inputs[0].split(" ")[0]; var kRegexp = new RegExp(inputs[1].replace(" ", "|")); while (kRegexp.test(String(money))) { money++; } return money; } console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));
function main(input) { var inputs = input.split("\n"); var money = Number(inputs[0].split(" ")[0]); var kRegexp = new RegExp("[" + inputs[1].replace(" ", "") + "]"); while (kRegexp.test(String(money))) { money++; } return money; } console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));
[["+", 8, 556, 0, 198, 0, 200, 51, 2, 63, 22], ["+", 0, 198, 0, 200, 51, 2, 3, 3, 0, 24], ["+", 0, 198, 0, 200, 51, 2, 3, 3, 0, 25], ["+", 3, 3, 0, 16, 31, 16, 31, 557, 0, 62], ["+", 3, 3, 0, 16, 31, 16, 31, 557, 0, 491], ["+", 51, 350, 3, 3, 0, 16, 31, 16, 17, 72], ["-", 3, 3, 0, 2, 3, 3, 0, 557, 0, 491], ["+", 0, 200...
2
106
#include <algorithm> #include <iomanip> #include <iostream> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <map> #include <math.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (a); i > (b); --i) #define SZ(a) a.size() #define ll long long #define ull un...
#include <algorithm> #include <iomanip> #include <iostream> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <map> #include <math.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (a); i > (b); --i) #define SZ(a) a.size() #define ll long long #define ull un...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
235
#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 rall(x) (x).rbegin(), (x).rend() #define itn int typedef long long ll; typedef pair<ll, ll> p; int main() { int n, k; cin >> n >> k; vector<string> v(k, "@"); for ...
#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 rall(x) (x).rbegin(), (x).rend() #define itn int typedef long long ll; typedef pair<ll, ll> p; int main() { int n, k; cin >> n >> k; vector<string> v(k, "@"); for ...
[["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 146], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 0, 35], ["-", 0, 338, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1...
1
141
#include <iostream> using namespace std; bool usable(int n, int a[]) { bool flg = false; // 0以外の数字が出てきているか int b[5]; b[4] = n % 10; b[3] = ((n - b[4]) % 100) / 10; b[2] = ((n - b[3] * 10 - b[4]) % 1000) / 100; b[1] = ((n - b[2] * 100 - b[3] * 10 - b[4]) % 10000) / 1000; b[0] = ((n - b[1] * 1000 - b[2] * 1...
#include <iostream> using namespace std; bool usable(int n, int a[]) { bool flg = false; // 0以外の数字が出てきているか int b[5]; b[4] = n % 10; b[3] = ((n - b[4]) % 100) / 10; b[2] = ((n - b[4] - b[3] * 10) % 1000) / 100; b[1] = ((n - b[4] - b[3] * 10 - b[2] * 100) % 10000) / 1000; b[0] = ((n - b[4] - b[3] * 10 - b[2...
[["-", 31, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["-", 31, 23, 0, 16, 31, 16, 12, 16, 17, 48], ["-", 31, 23, 0, 16, 31, 16, 12, 16, 12, 13], ["-", 31, 23, 0, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 23, 0, 16, 12, 16, 17...
1
320
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().solve(); } void solve() { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int n = String.valueOf(N).length(); int K = sc.nextInt(); int ans = 0; boolean[] ...
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().solve(); } void solve() { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int n = String.valueOf(N).length(); int K = sc.nextInt(); int ans = 0; boolean c ...
[["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 0, 32], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 146], ["+", 8, 498, 0, 195, 8, 196, 0, 503, 0, 35], ["+", 0, 195, 8, 196, 0, 503, 39, 224, 468, 523], ["-", 8, 196, 0, 1, 0, 11, 31, 504, 516, 22], ["-", 8, 196, 0, 1, 0, 11, 31, 5...
3
209
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int a[10] = {}; while (k--) { int t; cin >> t; a[t]++; } while (true) { string s = to_string(n); bool next = false; for (auto c : s) { for (int i = 0; i < 10; i++) { if (a[i] != 0 && c - '0'...
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int a[10] = {}; while (k--) { int t; cin >> t; a[t]++; } while (true) { string s = to_string(n); bool next = false; for (auto c : s) { for (int i = 0; i < 10; i++) { if (a[i] != 0 && c - '0'...
[["+", 0, 52, 8, 9, 0, 338, 8, 9, 0, 46], ["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45]]
1
138
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> #define REP(i, n) for (LL i = 0; i < n; i++) #define REPR(i, n) for (LL i = n; i >= 0; i--)...
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> #define REP(i, n) for (LL i = 0; i < n; i++) #define REPR(i, n) for (LL i = n; i >= 0; i--)...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 30, 0, 14,...
1
316
#include <bits/stdc++.h> using namespace std; #define forx(i, a, b) for (int i = (a); i < (b); i++) #define rep(j, n) for (int j = 0; j < (n); j++) typedef long long ll; vector<bool> p(10); int judge(int n) { while (n != 0) { int b = n % 10; rep(i, 10) { if (b == p[i]) return false; } ...
#include <bits/stdc++.h> using namespace std; #define forx(i, a, b) for (int i = (a); i < (b); i++) #define rep(j, n) for (int j = 0; j < (n); j++) typedef long long ll; vector<bool> p(10); int judge(int n) { while (n != 0) { int b = n % 10; if (p[b] == true) return false; n /= 10; } return t...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 8, 9, 0, 52, 8, 9, 0, 9, 0, 45], ["-", 0, 9,...
1
175
#include <iostream> using namespace std; int main() { int N, K; cin >> N >> K; int D[10]; for (int i = 0; i < K; i++) { cin >> D[i]; } int n = N; while (1) { int a[5]; int nc = n; bool flag = true; for (int i = 0; i < 5; i++) { a[i] = nc % 10; nc -= a[i]; nc /= 10; ...
#include <iostream> using namespace std; int main() { int N, K; cin >> N >> K; int D[10]; for (int i = 0; i < K; i++) { cin >> D[i]; } int n = N; while (1) { int a[5]; int nc = n; bool flag = true; for (int i = 0; i < 5; i++) { a[i] = nc % 10; nc -= a[i]; nc /= 10; ...
[["+", 64, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 1...
1
239
a = [] a = gets.split.map(&:to_i) b = [] b = gets.split.map(&:to_i) puts b.join (" ") d = [] n = 0 ans = 1 for i in 0..100000 n = i ans = 1 d = n.to_s.split("") for k in 0..d.length-1 if b.include?(d[k].to_i) ans = nil end end #ans = nil #puts ans if n >= a[0] && ans puts n ...
a = [] a = gets.split.map(&:to_i) b = [] b = gets.split.map(&:to_i) #puts b.join (" ") d = [] n = 0 ans = 1 for i in 0..100000 n = i ans = 1 d = n.to_s.split("") for k in 0..d.length-1 if b.include?(d[k].to_i) ans = nil end end #ans = nil #puts ans if n >= a[0] && ans puts n ...
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 486, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 17, 131], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 739, 0, 24], ["-", 0, 652, 3, 4, 0, 739, 0, 557, 0, 62], ["-", 0, 652, 3, 4, 0, 739, 0, 557, 0, 6], ["-"...
4
115
#include <bits/stdc++.h> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vec vector #define pq priority_queue #define all(v) (v).begin(), (v).end() #define uniqueV(x) \ sort(x.begin(), x.end()); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vec vector #define pq priority_queue #define all(v) (v).begin(), (v).end() #define uniqueV(x) \ sort(x.begin(), x.end()); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, ...
1
346
#include <algorithm> #include <bits/stdc++.h> #include <vector> using namespace std; int main() { vector<int> hates; int hate; int n, k; int i; int cnt; int a, b, c, d, s; a = b = c = d = s = 0; bool can; cin >> n >> k; for (i = 0; i < k; i++) { cin >> hate; hates.push_back(hate); } ...
#include <algorithm> #include <bits/stdc++.h> #include <vector> using namespace std; int main() { vector<int> hates; int hate; int n, k; int i; int cnt; int a, b, c, d, s; a = b = c = d = s = 0; bool can; cin >> n >> k; for (i = 0; i < k; i++) { cin >> hate; hates.push_back(hate); } ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
351
#include <bits/stdc++.h> //--------------------------- using namespace std; //--------------------------- #define REP(i, n) for (int i = 0; i < (n); i++) #define P(x) cout << (x) << "\n" #define MOD 1000000007 // 1e9+7 #define PI acos(-1.0) #define ll long long int // 10^18 #define INF 1000000001 // 1e9+1 int dx[4]...
#include <bits/stdc++.h> //--------------------------- using namespace std; //--------------------------- #define REP(i, n) for (int i = 0; i < (n); i++) #define P(x) cout << (x) << "\n" #define MOD 1000000007 // 1e9+7 #define PI acos(-1.0) #define ll long long int // 10^18 #define INF 1000000001 // 1e9+1 int dx[4]...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 7, 0, 25], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 14, 49, 53, 49, 22], ["-", 8, 9, 0, 14, 49, 53, 54, 55, 0, 24], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 14, 49, 53, 54...
1
223
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> v; int num; for (int i = 0; i < K; i++) { cin >> num; v.push_back(num); } int n, ans = 0; bool flg = false; ans = N; while (!flg) { N = ans; while (N !=...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> v; int num; for (int i = 0; i < K; i++) { cin >> num; v.push_back(num); } int n, ans = 0; bool flg = false; ans = N; while (!flg) { N = ans; while (N !=...
[["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, ...
1
184
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define int long long #define INF 1145141919810893 signed main() { int N, K; int D[10]; int c = 0; int keta[4]; cin >> N >> K; REP(i, K) { cin >> D[i]; } REP(i, 10000) { if (i < N) continue; c = 0; ...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define int long long #define INF 1145141919810893 signed main() { int N, K; int D[10]; int c = 0; int keta[5]; cin >> N >> K; REP(i, K) { cin >> D[i]; } REP(i, 1000000) { if (i < N) continue; c = 0...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 9, 0, 1, 0, 11, 12...
1
198
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; int d[k]; for (int i = 0; i < k; i++) { cin >> d[i]; } int tmp = n; vector<int> x; while (tmp != 0) { x.insert(x.begin(), tmp % 10); tmp /= 10; } while (1) { boo...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; int d[k]; for (int i = 0; i < k; i++) { cin >> d[i]; } int tmp = n; vector<int> x; while (tmp != 0) { x.insert(x.begin(), tmp % 10); tmp /= 10; } while (1) { boo...
[["-", 0, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
297
import java.io.*; import java.util.*; public class Main { static int MOD = 1000000007; static double EPS = 1e-9; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(in.readLine());...
import java.io.*; import java.util.*; public class Main { static int MOD = 1000000007; static double EPS = 1e-9; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(in.readLine());...
[["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 15, 15, 0, 24], ["+", 0, 57, 15, 15, 0, 16, 31, 504, 516, 22], ["+", 0, 57, 15, 15, 0, 16, 31, 504, 0, 70], ["+", 0, 57, 15, 15, 0, 16, 31, 504, 71, 499], ["+", 0, 57, 15, 15, 0, 16, 31, 504, 0, 73], ["+", 64, 196, 0, 57, 15, 15, 0, 16, 17, 60]...
3
424
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n, k, d0, i, j, l, len, a, sum; int aa[6]; bool f; vector<int> d, e; cin >> n >> k; for (i = 0; i < k; i++) { cin >> d0; d.push...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n, k, d0, i, j, l, len, a, sum; int aa[6]; bool f; vector<int> d, e; cin >> n >> k; for (i = 0; i < k; i++) { cin >> d0; d.push...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 8, 9, 0, 1, 0, 11, 12, 74, 0, 24], ["+", 0, 1, 0, 11, 12, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 1, 0, 11, 12, 74, 0, 25], ["+", 0, 1, 0, 11, 12, 74, 51, 2, 63, 22], ["+", 0, 11, 12, 74, 51, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 74, 51, ...
1
261
#include <cstdio> #include <set> int main() { int n, nd[5], k, i, tmp; scanf("%d%d", &n, &k); for (i = 0; i < 4; i++) { nd[i] = n - (n / 10) * 10; n = n / 10; } nd[4] = 0; std::set<int> s; for (i = 0; i < k; i++) { scanf("%d", &tmp); s.insert(tmp); } i = 3; while (i >= 0 && s.count(...
#include <cstdio> #include <set> int main() { int n, nd[5], k, i, tmp; scanf("%d%d", &n, &k); for (i = 0; i < 4; i++) { nd[i] = n - (n / 10) * 10; n = n / 10; } nd[4] = 0; std::set<int> s; for (i = 0; i < k; i++) { scanf("%d", &tmp); s.insert(tmp); } i = 3; while (nd[i] == 0) { ...
[["+", 0, 52, 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], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 52, 15, 339, ...
1
297
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define INF int main() { int n, k; cin >> n >> k; int d[k]; rep(i, k) { cin >> d[i]; } for (int i = n; i < 10000; i++) { int ii = i; int di[5]; bool flag = true; while (ii > 0 && flag) { int ama...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define INF int main() { int n, k; cin >> n >> k; int d[k]; rep(i, k) { cin >> d[i]; } for (int i = n; i < 1000000; i++) { int ii = i; bool flag = true; while (ii > 0 && flag) { int ama = ii % 10; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["-", 0, 7, 8, 9, 0, 43, 49, 80, 49, 22], ["-", 0, 7, 8, 9, 0, 43, 49, 80, 0, 70], ["-", 0, 7, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 7, 8, 9, 0, 43, 49, 80...
1
155
#include <bits/stdc++.h> #include <string> using namespace std; typedef long long ll; // typedef pair<long long,long long> P; // typedef pair<long long,P> P1; // typedef pair<P,P> P2; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000000 #define mod 1000000007 #define fi firs...
#include <bits/stdc++.h> #include <string> using namespace std; typedef long long ll; // typedef pair<long long,long long> P; // typedef pair<long long,P> P1; // typedef pair<P,P> P2; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000000 #define mod 1000000007 #define fi firs...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], [...
1
1,008
def C_IrohasObsession(): N, K = map(int, input().split()) D = list(map(int, input().split())) ans = 0 for x in range(N, 10000): for y in str(x): if int(y) in D: break else: ans = int(x) break if N > ans: for x in range(1,10)...
def C_IrohasObsession(): N, K = map(int, input().split()) D = list(map(int, input().split())) ans = 0 for x in range(N, 10000): for y in str(x): if int(y) in D: break else: ans = int(x) break if N > ans: for x in range(1,10)...
[["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 267], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, ...
5
118
cost, hate = map(int, input().split()) hate_num = list(map(int, input().split())) hate_str = list(str(hate_num)) pay = cost flag = True while flag: pay_str = list(str(pay)) for i in range(len(pay_str)): if set([pay_str[i]]) - set(hate_str) != set([pay_str[i]]): pay += 10**(len(pay_str)-1-i)...
cost, hate = map(int, input().split()) hate_num = list(map(int, input().split())) hate_str = list(str(hate_num)) pay = cost flag = True while flag: pay_str = list(str(pay)) for i in range(len(pay_str)): if set([pay_str[i]]) - set(hate_str) != set([pay_str[i]]): pay += 1 flag = T...
[["-", 64, 196, 0, 1, 0, 677, 12, 657, 31, 612], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 17, 578], ["-", 0, 1, 0, 677, 12, 657, 12, 23, 0, 24], ["-", 12, 23, 0, 657, 31, 657, 31, 652, 63, 22], ["-", 0, 657, 31, 657, 31, 652, 3, 4, 0, 24], ["-", 0, 657, 31, 657, 31, 652, 3, 4, 0, 22], ["-", 0, 657, 31, 657, 31, 652, 3, 4,...
5
124
n, k = map(int,input().split()) l = list(input().split()) #print(l) l1 = [i for i in range(10) if i not in l] #print(l1) l2 = [False]*len(str(n)) for i in range(n,10000000): for j in range(len(str(n))): if str(i)[j] not in l: l2[j] = True a = i else: break if all(l2): print(a) brea...
n, k = map(int,input().split()) l = list(input().split()) #print(l) l1 = [i for i in range(10) if i not in l] #print(l1) for i in range(n,100000): l2 = [False]*len(str(i)) for j in range(len(str(i))): if str(i)[j] not in l: l2[j] = True a = i else: break if all(l2): print(a) brea...
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 6...
5
122
N, K = map(int, input().split()) D = list(map(int, input().split())) n = len(str(N)) C = [] for k in range(10): if not k in D: C.append(k) def num(a): if len(a) == n: if int(a) >= N: return a return 114514 d=1145141919 for c in C: d =min(d, int(num(a + str(c...
N, K = map(int, input().split()) D = list(map(int, input().split())) n = len(str(N)) C = [] for k in range(10): if not k in D: C.append(k) def num(a): if a!='' and (len(a) > n or int(a)>=N): if int(a) >= N: return a return 114514 d=1145141919 for c in C: d ...
[["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 667, 79], ["+", 0, 57, 15, 679, 31, 666, 0, 557, 0, 654], ["+", 0, 57, 15, 679, 31, 666, 0, 557, 0, 655], ["+", 0, 14, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 8, 196, 0, 57, 15, 679, 12, 23, 0, 24], ["-", 0, 14, 8, 196, 0, 57, 15, 66...
5
129
#include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define dofloat cout << fixed << setprecision(8) #define pb push_back #define mp make_pair #define fi first #define se second #define bitcount __builtin_popcount #define all(vec) vec.begin(), vec.end() #define rall(vec) vec.rbeg...
#include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define dofloat cout << fixed << setprecision(8) #define pb push_back #define mp make_pair #define fi first #define se second #define bitcount __builtin_popcount #define all(vec) vec.begin(), vec.end() #define rall(vec) vec.rbeg...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["-", 75, ...
1
703
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Main main = new Main(); main.solve(); } public void solve() { Scanner...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Main main = new Main(); main.solve(); } public void solve() { Scanner...
[["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 22], ["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 0, 32], ["-", 8, 498, 0, 195, 8, 196, 0, 503, 0, 35], ["-", 8, 196, 0, 52, 15, 15, 0, ...
3
267
#include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <numeric> #include <vector> using namespace std; using ll = long long; ll dp[51][51][3000]; int main() { int n, k; cin >> n >> k; vector<int> d(k); for (int i = 0; i < k; i++) { cin >> d[i]; } s...
#include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <numeric> #include <vector> using namespace std; using ll = long long; int main() { int n, k; cin >> n >> k; vector<int> d(k); for (int i = 0; i < k; i++) { cin >> d[i]; } string nstr; while (t...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 43, 49, 80, 49, 80, 49, 80, 49, 22], ["-", 0, 43, 49, 80, 49, 80, 49, 80, 0, 70], ["-", 0, 43, 49, 80, 49, 80, 49, 80, 81, 13], ["-", 0, 43, 49, 80, 49, 80, 49, 80, 0, 73], ["-", 0, 30, 0, 43, 49, 80, 49, 80, 0, 70], ["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-...
1
201
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define ll long long #define Di 3.1415926 #include <math.h> #include <set> #include <string> #define INF 0x3f3f3f3f using namespace std; ll gcd(ll a, ll b) { return a % b ? gcd(b, a % b) : b; } int a[200]; int s[100]; bool judge(int i) { wh...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define ll long long #define Di 3.1415926 #include <math.h> #include <set> #include <string> #define INF 0x3f3f3f3f using namespace std; ll gcd(ll a, ll b) { return a % b ? gcd(b, a % b) : b; } int a[200]; int s[100]; bool judge(int i) { wh...
[["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 0, 35], ["-", 15, 339, 51, 6...
1
198
/* * * 1. sprawdz corner cases * 2. sprawdz limity, jesli sie da pozamieniaj wszystkie lokalne zmienne na LL! * 3. MINIMALNE I MAKSYMALNE WEJŚCIE I WYJŚCIE * 4. lokalne zmienne, iteracja po tablicach dwuwymiarowych uwazaj * 5. SPRAWDZ CZY input jest POSORTOWANY jaki jest niezmiennik * * */ #include <algo...
/* * * 1. sprawdz corner cases * 2. sprawdz limity, jesli sie da pozamieniaj wszystkie lokalne zmienne na LL! * 3. MINIMALNE I MAKSYMALNE WEJŚCIE I WYJŚCIE * 4. lokalne zmienne, iteracja po tablicach dwuwymiarowych uwazaj * 5. SPRAWDZ CZY input jest POSORTOWANY jaki jest niezmiennik * * */ #include <algo...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, ...
1
595
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<char> d; bool loop = true; for (int i = 0; i < k; i++) { char a; cin >> a; d.push_back(a); } while (loop) { loop = false; string s = to_string(n); for (int i = 0; i < s.size(); i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<char> d; bool loop = true; for (int i = 0; i < k; i++) { char a; cin >> a; d.push_back(a); } while (loop) { loop = false; string s = to_string(n); for (int i = 0; i < s.size(); i++) { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 140], ["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 16, 31, 16, 31, 2, 63, 118, 17, 131], ["-", 0, 16, 31, ...
1
162
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayList<Integer> d = new ArrayList<Integer>(k); for (int i = 0; i < k;...
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayList<Integer> d = new ArrayList<Integer>(k); for (int i = 0; i < k;...
[["+", 0, 7, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 0, 32], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 51, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 503, 0, 35], ["-", 15, 15, 0, 492, 3, 4, 0, 16, 31, 22], ["+", 15, 15, 0, 492, 3, 4, 0, 16, 31, 22], ["+...
3
215
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[] A = new int[K]; for (int i = 0; i < K; i++) { A[i] = sc.nextInt(); } sc.close(); boolean flag = false; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[] A = new int[K]; for (int i = 0; i < K; i++) { A[i] = sc.nextInt(); } sc.close(); int count = 0; compl...
[["-", 8, 498, 0, 195, 8, 196, 0, 503, 39, 523], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 147], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 57, 64, 196, 0, 1,...
3
219
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define rep(i, n) for (int i = 0; i < n; i++) #define mod 1000000007 // 10^9+7 #define INF 99999999999 // 10^12-1 #define dev 998244353 // tenka1 #define P pair<int, int> #define F first #define S second int n, k; int x[13...
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define rep(i, n) for (int i = 0; i < n; i++) #define mod 1000000007 // 10^9+7 #define INF 99999999999 // 10^12-1 #define dev 998244353 // tenka1 #define P pair<int, int> #define F first #define S second int n, k; int x[13...
[["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 0, 21], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, ...
1
213
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 def LI(): return list(map(int,input().split())) def I(): return int(input()) def LS(): return input().split() def S(): return input() def main(): n,k=LI() l=LS() for i i...
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 def LI(): return list(map(int,input().split())) def I(): return int(input()) def LS(): return input().split() def S(): return input() def main(): n,k=LI() l=LS() for i i...
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 146], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 674, 0, 675], ["-", 0, 57, 75, 76, 8, 196, 0, 93, 0, 94], ["+", 75,...
5
151
l=[str(x) for x in range(100000)] n,k=map(int,input().split()) if n==9999 and k==1: exit() l2=list(map(str,input().split())) ind=l.index(str(n)) while True: a=l[ind] f=False for x in l2: if x in a: f=True if not f: break ind+=1 print(a)
l=[str(x) for x in range(100000)] n,k=map(int,input().split()) l2=list(map(str,input().split())) ind=l.index(str(n)) while True: a=l[ind] f=False for x in l2: if x in a: f=True if not f: break ind+=1 print(a)
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 12, ...
5
108
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int price = sc.nextInt(); int k = sc.nextInt(); List<Integer> hate = new ArrayList<Integer>(); for (int i = 0; i < k; i++...
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int price = sc.nextInt(); int k = sc.nextInt(); List<Integer> hate = new ArrayList<Integer>(); for (int i = 0; i < k; i++...
[["-", 0, 52, 8, 196, 0, 1, 0, 27, 0, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 27, 0, 29], ["-", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 52, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 95], ["+", 0, 52, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 57, 7...
3
269
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; vector<int> D(k); vector<int> m(10); for (int i = 0; i < k; i++) { cin >> D[i]; m[D[i]] = 1; } for (int i = 0; i <= 10000; i++) { int z = i; bool r = false; while (z) { if (...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, k; cin >> n >> k; vector<int> D(k); vector<int> m(10); for (int i = 0; i < k; i++) { cin >> D[i]; m[D[i]] = 1; } for (int i = 0; i <= 99999; i++) { int z = i; bool r = false; while (z) { if (...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9,...
1
157
N, K = gets.split.map(&:to_i) D_array = gets.split.map(&:to_i) ans = 0 N.upto(10000) do |i| next if D_array.any? { |d| i.to_s.chars.map(&:to_i).include?(d) } ans = i break end puts ans
N, K = gets.split.map(&:to_i) D_array = gets.split.map(&:to_i) ans = 0 N.upto(10*N) do |i| next if D_array.any? { |d| i.to_s.chars.map(&:to_i).include?(d) } puts i exit end
[["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 612], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 31, 612], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 17, 48], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 12, 743], ["-", 0, 652, 196, 737, 8, 736, 0, 662, 31, 22], ["-", 0, 652, 196, 737, 8, 736, 0, 662, 0, 32], ["+", 0, 652, 196, 737, 8, 736, 0, 652, ...
4
70
k, n = gets.split deny = gets.split.map(&:to_i) while 1 do deny.each do |d| if k.include?(d.to_s) break else puts k exit end end k = (k.to_i + 1).to_s end
k, n = gets.split deny = gets.split.map(&:to_i) while 1 do if !deny.any? { |d| k.include?(d.to_s) } puts k exit end k = (k.to_i + 1).to_s end
[["+", 0, 493, 0, 89, 8, 170, 0, 121, 0, 121], ["+", 0, 89, 8, 170, 0, 121, 15, 748, 17, 111], ["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 652, 196, 737, 0, 170], ["+", 8, 170, 0, 121, 15, 748, 439, 652, 735, 22], ["+", 0, 121, 15, 748, 439, 652, 196, 196, 0, 45], ["-", 0, 652, 196, 737, 8, 7...
4
56
def dfs(i, s, l): if i == len(s): return '' for j in l: if j >= int(s[i]): ans = dfs(i + 1, s, l) if ans is not None: ans += str(j) return ans return None n, k = map(int, input().split()) ns = str(n) d = list(map(int, input().split()))...
def dfs(i, s, l): if i == len(s): return '' for j in l: if j == int(s[i]): ans = dfs(i + 1, s, l) if ans is not None: ans += str(j) return ans elif j > int(s[i]): ans = str(l[0]) * (len(s) - i - 1) + str(j) r...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 64, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25], ["+", 64, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+",...
5
201
#include <bits/stdc++.h> using namespace std; int main() { int d; string s; cin >> s >> d; bool a[10]; memset(a, true, sizeof(a)); for (int i = 0; i < d; i++) { int x; cin >> x; a[x] = false; } int carry = 0; bool flag = false, flag2 = true; char ch; for (int i = 1; i < 10; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int d; string s; cin >> s >> d; bool a[10]; memset(a, true, sizeof(a)); for (int i = 0; i < d; i++) { int x; cin >> x; a[x] = false; } int carry = 0; char ch; for (int i = 1; i < 10; i++) { if (a[i]) { ch = i + 48; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 147], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 146], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 57, 75,...
1
310
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class Main { public static void main(String[] args) throws IOException { String[] strs; ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class Main { public static void main(String[] args) throws IOException { String[] strs; ...
[["-", 8, 196, 0, 1, 0, 492, 500, 509, 500, 22], ["-", 8, 196, 0, 1, 0, 492, 500, 509, 0, 131], ["-", 8, 196, 0, 1, 0, 492, 500, 509, 119, 22], ["-", 0, 195, 8, 196, 0, 1, 0, 492, 0, 131], ["-", 0, 195, 8, 196, 0, 1, 0, 492, 141, 22], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 22], [...
3
319
#include <algorithm> #include <cstring> #include <iostream> #include <string> using namespace std; int n[10]; int temp; int a, num; bool check(int mon) { while (mon) { if (n[mon % 10]) return false; mon /= 10; } return true; } int main() { while (cin >> a >> num) { memset(n, 0, sizeof(n)); ...
#include <algorithm> #include <cstring> #include <iostream> #include <string> using namespace std; int n[10]; int temp; int a, num; bool check(int mon) { while (mon) { temp = mon % 10; if (n[temp] == 1) return false; mon = mon / 10; } return true; } int main() { while (cin >> a >> num) { m...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 15, 339, 51, 69, 341, 342, 0, 16, 31, 22], ["-", 15, 339, 51, 69,...
1
139
#include <bits/stdc++.h> using namespace std; int solve(int value, int size, vector<int> digits, int N) { int size_value = log10(value) + 1; if (size_value == size) return value; int ans = 1000000; for (int i = 0; i < 10; i++) { if (!digits[i]) { int number = solve(value * 10 + i, size, dig...
#include <bits/stdc++.h> using namespace std; int solve(int value, int size, vector<int> digits, int N) { if (value >= N) return value; int ans = 1000000; for (int i = 0; i < 10; i++) { if (!digits[i]) { int number = solve(value * 10 + i, size, digits, N); if (number >= N) { ans...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["-", 49, 50, 51, 16, 31, 2, 3, 4, 0, 24], ["-", 49, 50, 51, 16, 31, 2, 3, 4, 0, 22], ["-", 49, 50, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 43,...
1
252
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> D(N); for (int i = 0; i < K; i++) cin >> D[i]; int an...
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdio.h> #include <string> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> D(K); for (int i = 0; i < K; i++) cin >> D[i]; long l...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15...
1
163
N, K = map(int, input().split()) D = set(map(str, input().split())) for i in range(N, 10000): if len(D & set(list(str(i)))) == 0: print(i) break
N, K = map(int, input().split()) D = set(map(str, input().split())) i = N while(1): if len(D & set(list(str(i)))) == 0: print(i) break i += 1
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 36, ...
5
67