submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s811963898
p04045
C++
#include<iostream> using namespace std; int n,k; bool check(int n, int d[]){ bool flag=true; int a; for(int i=n;i==0;i/=10){ a=i%10; for(int j=0;j<10;j++){ if(a==d[j]) flag=false; } } return flag; } int main(){ int d[10]=-1; cin>>n>>k; for(int i=0;i<k;i++){ cin>>d[i]; } for(int i=n;i<10000;i++){ bool flag=false; flag=check(i,d); if(flag) { cout << i << '\n'; break; } } return 0; }
a.cc: In function 'int main()': a.cc:19:13: error: array must be initialized with a brace-enclosed initializer 19 | int d[10]=-1; | ^~
s415725406
p04045
C++
#include<iostream> using namespace std; int d[10]=-1; int n,k; bool check(int n){ bool flag=true; int a; for(int i=n;i==0;i/=10){ a=i%10; for(int j=0;j<10;j++){ if(a==d[j]) flag=false; } } return flag } int main(){ cin>>n>>k; for(int i=0;i<k;i++){ cin>>d[i]; } for(int i=n;i<10000;i++){ bool flag=false; flag=check(i,d); if(flag) { cout << i << '\n'; break; } } return 0; }
a.cc:4:11: error: array must be initialized with a brace-enclosed initializer 4 | int d[10]=-1; | ^~ a.cc: In function 'bool check(int)': a.cc:16:14: error: expected ';' before '}' token 16 | return flag | ^ | ; 17 | } | ~ a.cc: In function 'int main()': a.cc:27:15: error: too many arguments to function 'bool check(int)' 27 | flag=check(i,d); | ~~~~~^~~~~ a.cc:7:6: note: declared here 7 | bool check(int n){ | ^~~~~
s307464468
p04045
Java
import java.util.*; public class C { public static StringBuilder output = new StringBuilder(); public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int arr[] = new int[10]; Arrays.fill(arr, 1); for (int i = 0; i < k; i++) { int c = in.nextInt(); arr[c]--; } Solver solver = new Solver(); solver.solve(arr, n); System.out.println(output); } } class Solver { public void solve(int arr[], int n) { while (helper(n, arr)) { n++; } C.output.append(n); } public boolean helper(int n, int arr[]) { while (n > 0) { if (arr[n % 10] == 0) { return true; } n /= 10; } return false; } }
Main.java:3: error: class C is public, should be declared in a file named C.java public class C { ^ 1 error
s867431587
p04045
Java
import java.util.*; public class C { public static StringBuilder output = new StringBuilder(); public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int arr[] = new int[10]; Arrays.fill(arr, 1); for (int i = 0; i < k; i++) { int c = in.nextInt(); arr[c]--; } Solver solver = new Solver(); solver.solve(arr, n); System.out.println(output); } } class Solver { public void solve(int arr[], int n) { String a = ""; int amt = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] != 0 && i > 0) { amt = n * i; break; } } C.output.append(amt); } }
Main.java:3: error: class C is public, should be declared in a file named C.java public class C { ^ 1 error
s628949732
p04045
Java
いろはちゃんはこだわりもので、嫌いな数字が K 個あり、それぞれ D 1 , D 2 , . . . , D K です。 いろはちゃんはお店でお買い物をしていて、 N 円の品物を買おうとしています。 もちろん、この品物は N 円以上のお金を支払えば買うことができます。 しかし、先ほど述べたようにいろはちゃんは強いこだわりがあるので、自分がお店に支払う金額の 10 進表記にいろはちゃんの嫌いな数字が出現しないような最も少ない金額を支払おうとします。 いろはちゃんが支払う金額を求めてください。
Main.java:1: error: illegal character: '\u3001' ????????????????????? ^ Main.java:3: error: illegal character: '\u3001' ???????? ^ Main.java:16: error: illegal character: '\u3002' ??? ^ Main.java:18: error: illegal character: '\u3001' ???????????????????? ^ Main.java:20: error: illegal character: '\u3002' ??????????????? ?????????? ^ Main.java:20: error: illegal character: '\u3001' ??????????????? ?????????? ^ Main.java:22: error: illegal character: '\u3002' ????????????????????? ???????????????????????????????????????????? ^ Main.java:22: error: illegal character: '\u3001' ????????????????????? ???????????????????????????????????????????? ^ Main.java:22: error: illegal character: '\u3001' ????????????????????? ???????????????????????????????????????????? ^ Main.java:24: error: illegal character: '\u3002' ?????????????????????????????????????????? ^ Main.java:26: error: illegal character: '\u3002' ????????????????????? ^ 11 errors
s912701527
p04045
C++
#include <iostream> #include <iomanip> #include <cmath> #include <vector> #include <algorithm> #include <set> #include <unordered_set> #include <queue> #include <stack> #include <map> #include <unordered_map> #define rep(i, n) for (int i = 0; i < n; i++) #define ALL(a) (a).begin(), (a).end() typedef long long ll; using namespace std; const int N = 2e5 + 5; using namespace std; int main() { int n , k; cin >> n >> k; vector<int>liked; int unliked[10]; rep(i , 10) { unliked[i] = 0; } rep(i, k) { int x; cin >> x; unliked[x]++; } rep(i, 10) { if (unliked[i] == 0) { liked.push_back(i); } } vector<int> digits; while (n > 9) { int d = n % 10; digits.push_back(d); n /=10; } digits.push_back(n); reverse(digits.begin(), digits.end()); for (auto d : digits) { for (auto l : liked) { if (l >= d) { cout << l; res += l; break; } } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:53:17: error: 'res' was not declared in this scope; did you mean 'rep'? 53 | res += l; | ^~~ | rep
s645794149
p04045
C++
#include <bits/stdc++.h> using namespace std; int main(){ int m; int n; int a[10], b; cin >> m; cin >> n; for (int i = 0; i < 10; i++){ a[i] = 0; } for (int i = 0; i < n; i++){ cin >> b; a[b]++; } for (int i = m; i < 100000; i++){ b = i; while (b != 0){ if (a[b % 10] != 0){ break; } b /= 10; } if (b == 0){ printf("%d", i) return 0; } } }
a.cc: In function 'int main()': a.cc:30:28: error: expected ';' before 'return' 30 | printf("%d", i) | ^ | ; 31 | return 0; | ~~~~~~
s019040160
p04045
C++
#include <bits/stdc++.h> using namespace std; int main(){ int m; int n; int a[10], b; cin >> m; cin >> n; for (int i = 0; i < 10; i++){ a[i] = 0; } for (int i = 0; i < n; i++){ cin >> b; a[b]++; } for (i = m; i < 100000; i++){ b = i; while (b != 0){ if (a[b % 10] != 0){ break; } b /= 10; } } }
a.cc: In function 'int main()': a.cc:21:10: error: 'i' was not declared in this scope 21 | for (i = m; i < 100000; i++){ | ^
s729155294
p04045
Java
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static class IO { BufferedReader br; StringTokenizer st; public IO() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } int [] readarray(int sz){ int [] ret = new int[sz]; for(int i = 0; i<sz; i++)ret[i] = nextInt(); return ret; } } public static void main(String[] args){ IO fs = new IO(); long n = fs.nextLong(),k = fs.nextLong(); Set<Long> st = new HashSet<Long>(); for(long i = 0; i<k; i++){ st.add(fs.nextLong()); } long ans = 0; long count = 0; long rem = 0; while(n!=0){ long dig = n%10; dig+=rem; while(st.contains(dig%10)dig+=1; long newdig = (dig)%10; rem = (dig)/10; ans += (newdig*power(10,count)); count+=1; n/=10; } while(rem!=0){ while(st.contains(rem%10))rem-=1; ans += (rem%10)*power(10,count); rem/=10; count+=1; } System.out.println(ans); } public static long power(long x,long y){ long res = 1; while(y>0){ if(y%2 == 1)res = (res*x); y>>=1; x = x*x; } return res; } }
Main.java:82: error: ')' expected while(st.contains(dig%10)dig+=1; ^ 1 error
s286233940
p04045
C++
#include<iostream> #include<vector> using namespace std; int main(){ int n,k,dd; cin>>n>>k; vector<int>> d(10,0); for(int i=0;i<n;i++){ cin>>dd; d[dd]=1; } for(int i=n;i<=10000;i++){ int flag=1; int tmp=i; while(tmp!=0){ if(d[tmp%10]==1){ flag=0; break; } tmp/=10; } if(flag){ cout<<i<<endl; break; } } return 0; }
a.cc: In function 'int main()': a.cc:7:13: error: expected unqualified-id before '>' token 7 | vector<int>> d(10,0); | ^~ a.cc:10:5: error: 'd' was not declared in this scope 10 | d[dd]=1; | ^ a.cc:17:10: error: 'd' was not declared in this scope 17 | if(d[tmp%10]==1){ | ^
s588340959
p04045
C++
#include<iostream> using namespace std; int main(){ int n,k,dd; cin>>n>>k; vector<int> d(10,0); for(int i=0;i<k;i++){ cin>>dd; d[dd]=1; } for(int i=n;i<100000;i++){ int flag=1; int tmp=i; while(tmp!=0){ if(d[tmp%10]==1){ flag=0; break; } tmp/=10; } if(flag){ cout<<i<<endl; break; } } return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'vector' was not declared in this scope 6 | vector<int> d(10,0); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:6:10: error: expected primary-expression before 'int' 6 | vector<int> d(10,0); | ^~~ a.cc:9:5: error: 'd' was not declared in this scope 9 | d[dd]=1; | ^ a.cc:15:11: error: 'd' was not declared in this scope 15 | if(d[tmp%10]==1){ | ^
s672929511
p04045
Java
import javax.persistence.criteria.CriteriaBuilder; import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K, size, i; N = input.nextInt(); K = input.nextInt(); i = 0; List<Integer> list = new Vector<>(); while (K-- > 0) { list.add(input.nextInt()); } String number = Integer.toString(N); size = number.length(); while (i < size) { int num = number.charAt(i) - 48; if (list.contains(num)) N++; else i++; number = Integer.toString(N); } System.out.println(N); } }
Main.java:1: error: package javax.persistence.criteria does not exist import javax.persistence.criteria.CriteriaBuilder; ^ 1 error
s219906291
p04045
C++
import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K; int ara[] = new int[10]; for (int i = 0; i < 10; i++) ara[i] = i; N = input.nextInt(); K = input.nextInt(); for (int i = 0; i < K; i++) { int num = input.nextInt(); ara[num] = 0; } Arrays.sort(ara); String st = ""; while (N >= 10) { for (int i = K; ; i++) { int n = N % 10; if (ara[i] >= n) { st = ara[i] + st; break; } } N = N / 10; } if (ara[K] == 0) K++; for (; K < 10; K++) { if (ara[K] >= N){ st = ara[K] + st; break; } } System.out.println(st); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s332837777
p04045
C++
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K; int ara[] = new int[10]; for (int i = 0; i < 10; i++) ara[i] = i; N = input.nextInt(); K = input.nextInt(); for (int i = 0; i < K; i++) { int num = input.nextInt(); ara[num] = 0; } Arrays.sort(ara); String st = ""; while (N >= 10) { for (int i = K; ; i++) { int n = N % 10; if (ara[i] >= n) { st = ara[i] + st; break; } } N = N / 10; } if (ara[K] == 0) K++; for (; K < 10; K++) { if (ara[K] >= N){ st = ara[K] + st; break; } } System.out.println(st); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Arrays; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main { | ^~~~~~
s276029113
p04045
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin >> n >> k; vector<int> d(k); for(int i=0;i<k;i++) cin >> d.at(i); for(int ans=n;ans<n*10;ans++){ string s=to_string(ans); bool jg=false; for(auto x:d){ if(s.find(x)!=-1) break; if(x==s.at(s.size()-1){ jg=true; break; } } if(jg){ cout << ans << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:19:29: error: expected ')' before '{' token 19 | if(x==s.at(s.size()-1){ | ~ ^ | ) a.cc:23:5: error: expected primary-expression before '}' token 23 | } | ^
s186458082
p04045
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin >> n >> k; vector<int> d(k); for(int i=0;i<k;i++) cin >> d.at(i); for(int ans=n;ans<n*10;ans++){ string s{ans}; bool jg=false; for(auto x:d){ if(s.find(x)!=-1) break; if(x==s.at(s.end()-1)){ jg=true; break; } } if(jg){ cout << ans << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:14:14: warning: narrowing conversion of 'ans' from 'int' to 'char' [-Wnarrowing] 14 | string s{ans}; | ^~~ a.cc:14:14: warning: narrowing conversion of 'ans' from 'int' to 'char' [-Wnarrowing] a.cc:19:17: error: no matching function for call to 'std::__cxx11::basic_string<char>::at(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >)' 19 | if(x==s.at(s.end()-1)){ | ~~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1287:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]' 1287 | at(size_type __n) const | ^~ /usr/include/c++/14/bits/basic_string.h:1287:20: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} 1287 | at(size_type __n) const | ~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:1309:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]' 1309 | at(size_type __n) | ^~ /usr/include/c++/14/bits/basic_string.h:1309:20: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} 1309 | at(size_type __n) | ~~~~~~~~~~^~~
s301763496
p04045
C++
#include <bits/stdc++.h> #define rep(i,n)for(long long i=0;i<(long long)(n);i++) #define all(a) a.begin(), a.end() using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } const ll MOD=1e9+7; const ll INF=1e18; const int MAX=510000; const double pi=acos(-1); int dx[8] = {1,0,-1,0,1,1,-1,-1}; int dy[8] = {0,1,0,-1,-1,1,1,-1}; // int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,k; cin >> n >> k; set<int>st; rep(i,k){ int d; cin >> d; st.insert(d); } for(int i=n;i<100000;i++){ string s = to_string(i); bool ok = true; rep(j,s.size()){ if(st.find(s[j]-'0')) ok = false; } if(ok){ cout <<i << endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:36:17: error: could not convert 'st.std::set<int>::find((((int)s.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))) - 48))' from 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} to 'bool' 36 | if(st.find(s[j]-'0')) ok = false; | ~~~~~~~^~~~~~~~~~ | | | std::set<int>::iterator {aka std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator}
s611236078
p04045
Java
import java.util.Arrays; import java.util.Scanner; public class solveAtCode { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K; int ara[] = new int[10]; for (int i = 0; i < 10; i++) ara[i] = i; N = input.nextInt(); K = input.nextInt(); for (int i = 0; i < K; i++) { int num = input.nextInt(); ara[num] = 0; } Arrays.sort(ara); String st = ""; while (N >= 10) { for (int i = K; ; i++) { int n = N % 10; if (ara[i] >= n) { st = ara[i] + st; break; } } N = N / 10; } if (ara[K] == 0) K++; for (; K < 10; K++) { if (ara[K] >= N){ st = ara[K] + st; break; } } System.out.println(st); } }
Main.java:4: error: class solveAtCode is public, should be declared in a file named solveAtCode.java public class solveAtCode { ^ 1 error
s001275298
p04045
Java
import java.util.Arrays; import java.util.Scanner; public class solve { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K; int ara[] = new int[10]; for (int i = 0; i < 10; i++) ara[i] = i; N = input.nextInt(); K = input.nextInt(); for (int i = 0; i < K; i++) { int num = input.nextInt(); ara[num] = 0; } Arrays.sort(ara); String st = ""; while (N >= 10) { for (int i = K; ; i++) { int n = N % 10; if (ara[i] >= n) { st = ara[i] + st; break; } } N = N / 10; } if (ara[K] == 0) K++; for (; K < 10; K++) { if (ara[K] >= N){ st = ara[K] + st; } } System.out.println(st); } }
Main.java:4: error: class solve is public, should be declared in a file named solve.java public class solve { ^ 1 error
s923137108
p04045
Java
package atCoder; import java.util.Arrays; import java.util.Scanner; public class solve { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K; int ara[] = new int[10]; for (int i = 0; i < 10; i++) ara[i] = i; N = input.nextInt(); K = input.nextInt(); for (int i = 0; i < K; i++) { int num = input.nextInt(); ara[num] = 0; } Arrays.sort(ara); String st = ""; while (N >= 10) { for (int i = K; ; i++) { int n = N % 10; if (ara[i] >= n) { st = ara[i] + st; break; } } N = N / 10; } if (ara[K] == 0) K++; for (; K < 10; K++) { if (ara[K] >= N){ st = ara[K] + st; } } System.out.println(st); } }
Main.java:6: error: class solve is public, should be declared in a file named solve.java public class solve { ^ 1 error
s868738258
p04045
Java
import java.util.Arrays; import java.util.Scanner; public class solve { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K; int ara[] = new int[10]; for (int i = 0; i < 10; i++) ara[i] = i; N = input.nextInt(); K = input.nextInt(); for (int i = 0; i < K; i++) { int num = input.nextInt(); ara[num] = 0; } Arrays.sort(ara); String st = ""; while (N >= 10) { for (int i = K; ; i++) { int n = N % 10; if (ara[i] >= n) { st = ara[i] + st; break; } } N = N / 10; } if (ara[K] == 0) K++; for (; K < 10; K++) { if (ara[K] >= N){ st = ara[K] + st; } } System.out.println(st); } }
Main.java:4: error: class solve is public, should be declared in a file named solve.java public class solve { ^ 1 error
s112653334
p04045
Java
import java.util.Arrays; import java.util.Scanner; public class solve { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N, K; int ara[] = new int[10]; for (int i = 0; i < 10; i++) ara[i] = i; N = input.nextInt(); K = input.nextInt(); for (int i = 0; i < K; i++) { int num = input.nextInt(); ara[num] = 0; } Arrays.sort(ara); String st = ""; while (N >= 10) { for (int i = K; ; i++) { int n = N % 10; if (ara[i] >= n) { st = ara[i] + st; break; } } N = N / 10; } if (ara[K] == 0) K++; for (; K < 10; K++) { if (ara[K] >= N){ st = ara[K] + st; } } System.out.println(st); } }
Main.java:4: error: class solve is public, should be declared in a file named solve.java public class solve { ^ 1 error
s827208404
p04045
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main() { vector<bool> avail = { false,false,false,false,false,false,false,false,false,false }; string N; int D; string res = ""; cin >> N >> D; int MIN = 11; int MAX = -1; for (int i = 0; i<D; i++) { int a; cin >> a; if (MIN>a) {MIN = a;} if (MAX<a) {MAX = a;} avail[a] = true; } bool new_size = false; bool test= true; while(test) { for (int i = 0; i<N.size();i++) { if (int(N[i])-48 > MAX) { new_size = true; res.push_back(avail[MIN]); } else if (true == avail[int(N[i])-48]) { res.push_back(avail[int(N[i])-48]); } else { for (int a = int(N[i])-48+1; a<avail.size(); a++) { if (true == avail[a]) { res.push_back(avail[a]); } } } } if (new_size == true) { res.push_back(avail[MIN]); } cout<< res<<endl; }
a.cc: In function 'int main()': a.cc:47:2: error: expected '}' at end of input 47 | } | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s154834690
p04045
Java
import java.util.*; public class Main { public static void main(String[] args) { int n=sc.nextInt(); int k=sc.nextInt(); HashSet<Integer> h=new HashSet<Integer>(); for(int j=1;j<=k;j++) h.add(sc.nextInt()); while(!comp(n,h))n++; System.out.println(n); } public static boolean comp(int k,HashSet<Integer> h) { String s=Integer.toString(k); for(int i=0;i<s.length();i++) { int o=s.charAt(i)-'0'; if(h.contains(o)) return false; } return true;}}
Main.java:6: error: cannot find symbol int n=sc.nextInt(); ^ symbol: variable sc location: class Main Main.java:7: error: cannot find symbol int k=sc.nextInt(); ^ symbol: variable sc location: class Main Main.java:10: error: cannot find symbol h.add(sc.nextInt()); ^ symbol: variable sc location: class Main 3 errors
s248022011
p04045
Java
public class Main { public static void main(String[] args) { int n=sc.nextInt(); int k=sc.nextInt(); HashSet<Integer> h=new HashSet<Integer>(); for(int j=1;j<=k;j++) h.add(sc.nextInt()); while(!comp(n,h))n++; System.out.println(n); } public static boolean comp(int k,HashSet<Integer> h) { String s=Integer.toString(k); for(int i=0;i<s.length();i++) { int o=s.charAt(i)-'0'; if(h.contains(o)) return false; } return true;}}
Main.java:13: error: cannot find symbol public static boolean comp(int k,HashSet<Integer> h) ^ symbol: class HashSet location: class Main Main.java:5: error: cannot find symbol int n=sc.nextInt(); ^ symbol: variable sc location: class Main Main.java:6: error: cannot find symbol int k=sc.nextInt(); ^ symbol: variable sc location: class Main Main.java:7: error: cannot find symbol HashSet<Integer> h=new HashSet<Integer>(); ^ symbol: class HashSet location: class Main Main.java:7: error: cannot find symbol HashSet<Integer> h=new HashSet<Integer>(); ^ symbol: class HashSet location: class Main Main.java:9: error: cannot find symbol h.add(sc.nextInt()); ^ symbol: variable sc location: class Main 6 errors
s350406161
p04045
C++
#include <cstdio> bool isOk(bool *isDisLike, int num){ while(num){ if(isDisLike[num % 10]) return false; num /= 10; } return true; } int main(){ int N, K; scanf(“%d %d”, &N, &K); bool isDisLike[10]; for(int l = 0, dislike; l < K; l++){ scanf(“%d”, &dislike); isDisLike[dislike] = true; } for(int n = N;;n++){ if(isOk(n)){ printf(“%d\n”, n); break; } } return 0; }
a.cc:13:9: error: extended character “ is not valid in an identifier 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:13:14: error: extended character ” is not valid in an identifier 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:16:11: error: extended character “ is not valid in an identifier 16 | scanf(“%d”, &dislike); | ^ a.cc:16:13: error: extended character ” is not valid in an identifier 16 | scanf(“%d”, &dislike); | ^ a.cc:22:14: error: extended character “ is not valid in an identifier 22 | printf(“%d\n”, n); | ^ a.cc:22:17: error: stray '\' in program 22 | printf(“%d\n”, n); | ^ a.cc:22:18: error: extended character ” is not valid in an identifier 22 | printf(“%d\n”, n); | ^ a.cc: In function 'int main()': a.cc:13:9: error: '\U0000201c' was not declared in this scope 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:13:11: error: 'd' was not declared in this scope 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:13:14: error: 'd\U0000201d' was not declared in this scope 13 | scanf(“%d %d”, &N, &K); | ^~ a.cc:21:13: error: invalid conversion from 'int' to 'bool*' [-fpermissive] 21 | if(isOk(n)){ | ^ | | | int a.cc:21:12: error: too few arguments to function 'bool isOk(bool*, int)' 21 | if(isOk(n)){ | ~~~~^~~ a.cc:3:6: note: declared here 3 | bool isOk(bool *isDisLike, int num){ | ^~~~
s024474597
p04045
C++
#include <cstdio> bool isOk(bool *isDisLike, int num) { while(num) { if(isDisLike[num % 10]) return false; num /= 10; } return true; } int main () { int N, K; scanf(“%d %d”, &N, &K); bool isDisLike[10]; for(int l = 0, dislike; l < K; l++) { scanf(“%d”, &dislike); isDisLike[dislike] = true; } for(int n = N;;n++) { if(isOk(n)) { printf(“%d\n”, n); break; } } return 0; }
a.cc:13:9: error: extended character “ is not valid in an identifier 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:13:14: error: extended character ” is not valid in an identifier 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:16:11: error: extended character “ is not valid in an identifier 16 | scanf(“%d”, &dislike); | ^ a.cc:16:13: error: extended character ” is not valid in an identifier 16 | scanf(“%d”, &dislike); | ^ a.cc:22:14: error: extended character “ is not valid in an identifier 22 | printf(“%d\n”, n); | ^ a.cc:22:17: error: stray '\' in program 22 | printf(“%d\n”, n); | ^ a.cc:22:18: error: extended character ” is not valid in an identifier 22 | printf(“%d\n”, n); | ^ a.cc: In function 'int main()': a.cc:13:9: error: '\U0000201c' was not declared in this scope 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:13:11: error: 'd' was not declared in this scope 13 | scanf(“%d %d”, &N, &K); | ^ a.cc:13:14: error: 'd\U0000201d' was not declared in this scope 13 | scanf(“%d %d”, &N, &K); | ^~ a.cc:21:13: error: invalid conversion from 'int' to 'bool*' [-fpermissive] 21 | if(isOk(n)) { | ^ | | | int a.cc:21:12: error: too few arguments to function 'bool isOk(bool*, int)' 21 | if(isOk(n)) { | ~~~~^~~ a.cc:3:6: note: declared here 3 | bool isOk(bool *isDisLike, int num) { | ^~~~
s484576370
p04045
C++
int main(){ // N円の商品を買う。 K個の数が嫌い。 int N, K; int temp; int hateNunbers[10]; cin >> N >> K; for (int i = 0; i < K; i++) { cin >> hateNunbers[i]; } int num = N; while(1){ string s = to_string(num); bool can = true; for(int i = 0;i < K; i++){ if(count(s.begin(),s.end(), hateNunbers[i])){ can = false; num++; break; } } if (can) { cout << num << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> N >> K; | ^~~ a.cc:12:8: error: 'string' was not declared in this scope 12 | string s = to_string(num); | ^~~~~~ a.cc:16:21: error: 's' was not declared in this scope 16 | if(count(s.begin(),s.end(), hateNunbers[i])){ | ^ a.cc:16:15: error: 'count' was not declared in this scope 16 | if(count(s.begin(),s.end(), hateNunbers[i])){ | ^~~~~ a.cc:23:10: error: 'cout' was not declared in this scope 23 | cout << num << endl; | ^~~~ a.cc:23:25: error: 'endl' was not declared in this scope 23 | cout << num << endl; | ^~~~
s726850082
p04045
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int cost = Integer.parseInt(sc.next()); int dislikeN = Integer.parseInt(sc.next()); int[] dislikeArray = new int[10]; for(int i=0; i<10; i++){ dislikeArray[Integer.parseInt(sc.next())] = 1; } int pay = cost; int safety = 0; while(true){ for(int i=0; i<dislikeN; i++){ if(judge(dislikeArray[i], pay) && i==dislikeN-1){ System.out.println(pay); safety++; break; } } if(safety != 0){ break; } pay++; } } private static boolean judge(int check, int n){ while(true){ if(n%10 == check){ return false; } n = n/10; if(n == 0){ return true; } } }
Main.java:40: error: reached end of file while parsing } ^ 1 error
s323884049
p04045
C++
#include<iostream> bool fr(int z, int a[10]){ int r; while(z){ r=z%10; if(a[r]) return true; z/=10; } return false; } int f(int z,int a[10]){ int ans=z; while(fr(ans,a)) ans++; return ans; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s313174701
p04045
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int cost = Integer.parseInt(sc.next()); int dislike = Integer.parseInt(sc.next()); int[] numbers = new int[10]; for(int i=0; i<dislike; i++){ numbers[Integer.parseInt(sc.next())] = 1; } int[] likeNumbers = new int[10-dislike]; int j = 0; for(int i=0; i<10; i++){ if(numbers[i] != 1){ likeNumbers[j] = i; j++; } } j = 0; while(true){ if(cost/Math.pow(10, j) != 0){ j++; }else{ break; } } int pay = 0; for(int i=0; i<j; i++){ pay += Math.pow(likeNumbers[9-dislike], j-i); } if(cost == pay){ System.out.println(pay); } for(int s=j; 0<=s; s--){ for(int t=0; t<9; t++){ if(pay%Math.pow(10, s)+likeNumbers[9-dislike-t] < cost){ pay = pay%Math.pow(10, s)+likeNumbers[9-dislike-t+1]*Math.pow(10, s); break; } } } System.out.println(pay); } }
Main.java:41: error: incompatible types: possible lossy conversion from double to int pay = pay%Math.pow(10, s)+likeNumbers[9-dislike-t+1]*Math.pow(10, s); ^ 1 error
s225257798
p04045
Java
package atCoder; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int price = sc.nextInt(); int dislikeNumsCount = sc.nextInt(); String dislikeNums = null ; int dislikeNum = sc.nextInt(); dislikeNums += dislikeNum; for (int i = 0; i < dislikeNumsCount-1; i++) { dislikeNum = sc.nextInt(); dislikeNums += "||"+dislikeNum; } dislikeNums = "["+dislikeNums+"]"; int compare = price; String compareStr = String.valueOf(compare); while (compare >= price) { if (compareStr.contains(dislikeNums)) { compare++; } else { break; } } int payment = Integer.parseInt(compareStr); System.out.println(payment); }
Main.java:30: error: reached end of file while parsing } ^ 1 error
s316588091
p04045
C++
# include "stdio.h" int main(){ int n,k,t,c1=0,c2=0,c3=0; scanf("%d %d",&n,&k); int d[k], use[10] = {0}, num = 0; int i, j, l; for( i=0;i<k;i++) scanf("%d",&d[i]); //好きな数 for (i = 0 ; i<k ; i++) { use[d[i]] = 1; //use[]の中が0なら使用可能 } //桁数 t=n; while(t>0){ c1++; t= t/10; }; t=n; //各桁を保存 int keta[c1]; for(i=c1-1;i>=0;i--){ keta[i]=t%10; t=t/10; } int key=0; for(i=0;i<c1;i++){ if (key == 0) { if (use[keta[i]] == 0) { num += keta[i]; } else { for (j = keta[i] + 1 ;j < 10;j++) { if (use[j] == 0) { num += j; key=1; break; } } } } else { for (int l=0;l < 10;l++) { if (use[l] == 0) { num += l; break; } } } if(i<c1-1) num=num*10; } printf("%d\n",num); if (num == 0) { for (int l=1;l < 10;l++) { if (use[l] == 0) { for (i = 0;i <= c1;i++){ num = (num * 10 + l); } break; } } if (use[0] == 0) { for (i = 0;i < c1;i++) num = num / 10; for (i = 0;i < c1;i++) num = num * 10; } } printf("%d\n",num);
a.cc: In function 'int main()': a.cc:73:24: error: expected '}' at end of input 73 | printf("%d\n",num); | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s200902905
p04045
Java
import java.util.Scanner; import java.util.List; import java.util.ArrayList; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int price = sc.nextInt(); int dislikeNumsCount = sc.nextInt(); int payment=0; List<Integer> nums = new ArrayList<>(); for (int i=0;i<10;i++){ nums.add(i); } for(int i=0;i<dislikeNumsCount;i++){ int dislikeNum = sc.nextInt(); if(nums.contains(dislikeNum)){ nums.remove(nums.indexOf(dislikeNum)); } } if(price<10){ int onesDigit=0; while(true){ int onesDigit=nums.get(i); if(onesDigit>price){ break; } } payment=onesDigit; }else if(price>=10 && price<100){ int tensDigit=0; while(true){ tensDgit=nums.get(i); if(tenDigit*10>price){ break; } } int onesDigit=0; while(true){ onesDigit=nums.get(i); if(tensDigit*10+onesDigit>price){ break; } } payment=tensDigit*10+onesDigit; }else if(price>=100 && price<1000){ int hundredsDigit=0; while(true){ hundredsDigit=nums.get(i); if(hundredsDigit*100>price){ break; } } int tensDigit=0; while(true){ tensDigit=nums.get(i); if(hundredsDigit*100+tensDigit*10>price){ break; } } int onesDigit=0; while(true){ onesDigit=nums.get(i); if(hundredsDigit*100+tensDigit*10+onesDigit>price){ break; } } payment=hundredsDigit*100+tensDigit*10+onesDigit; }else if(price>=1000 && price<10000){ int thousandsDigit=0; while(true){ thousandsDigit=nums.get(i); if(thousandsDigit*1000>price){ break; } } int hundredsDigit=0; while(true){ hundredsDigit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100>price){ break; } } int tensDigit=0; while(true){ tenDgit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10>price){ break; } } int onesDigit=0; while(true){ onesDigit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit>price){ break; } } payment=thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit; } System.out.println(payment); sc.close(); } }
Main.java:24: error: variable onesDigit is already defined in method main(String[]) int onesDigit=nums.get(i); ^ Main.java:24: error: cannot find symbol int onesDigit=nums.get(i); ^ symbol: variable i location: class Main Main.java:34: error: cannot find symbol tensDgit=nums.get(i); ^ symbol: variable tensDgit location: class Main Main.java:34: error: cannot find symbol tensDgit=nums.get(i); ^ symbol: variable i location: class Main Main.java:35: error: cannot find symbol if(tenDigit*10>price){ ^ symbol: variable tenDigit location: class Main Main.java:41: error: cannot find symbol onesDigit=nums.get(i); ^ symbol: variable i location: class Main Main.java:51: error: cannot find symbol hundredsDigit=nums.get(i); ^ symbol: variable i location: class Main Main.java:58: error: cannot find symbol tensDigit=nums.get(i); ^ symbol: variable i location: class Main Main.java:65: error: cannot find symbol onesDigit=nums.get(i); ^ symbol: variable i location: class Main Main.java:75: error: cannot find symbol thousandsDigit=nums.get(i); ^ symbol: variable i location: class Main Main.java:82: error: cannot find symbol hundredsDigit=nums.get(i); ^ symbol: variable i location: class Main Main.java:89: error: cannot find symbol tenDgit=nums.get(i); ^ symbol: variable tenDgit location: class Main Main.java:89: error: cannot find symbol tenDgit=nums.get(i); ^ symbol: variable i location: class Main Main.java:96: error: cannot find symbol onesDigit=nums.get(i); ^ symbol: variable i location: class Main 14 errors
s562312267
p04045
Java
import java.util.Scanner; import java.util.List; import java.util.ArrayList; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int price = sc.nextInt(); int dislikeNumsCount = sc.nextInt(); int payment=0; List<Integer> nums = new ArrayList<>(); for (int i=0;i<10;i++){ nums.add(i); } for(int i=0;i<dislikeNumsCount;i++){ int dislikeNum = sc.nextInt(); if(nums.contains(dislikeNum)){ nums.remove(nums.indexOf(dislikeNum)); } } if(price<10){ int onesDigit=0; while(true){ int onesDigit=nums.get(i); if(onesDigit>price){ break; } } payment=onesDigit; }else if(price>=10 && price<100){ int tensDigit=0; int onesDigit=0; while(true){ tensDgit=nums.get(i); if(tenDigit*10>price){ break; } } while(true){ onesDigit=nums.get(i); if(tensDigit*10+onesDigit>price){ break; } } payment=tensDigit*10+onesDigit; }else if(price>=100 && price<1000){ int hundredsDigit=0; int tensDigit=0; int onesDigit=0; while(true){ hundredsDigit=nums.get(i); if(hundredsDigit*100>price){ break; } } while(true){ tensDigit=nums.get(i); if(hundredsDigit*100+tensDigit*10>price){ break; } } while(true){ onesDigit=nums.get(i); if(hundredsDigit*100+tensDigit*10+onesDigit>price){ break; } payment=hundredsDigit*100+tensDigit*10+onesDigit; }else if(price>=1000 && price<10000){ int thousandsDigit=0; int hundredsDigit=0; int tensDigit=0; int onesDigit=0; while(true){ thousandsDigit=nums.get(i); if(thousandsDigit*1000>price){ break; } } while(true){ hundredsDigit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100>price){ break; } } while(true){ tenDgit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10>price){ break; } } while(true){ onesDigit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit>price){ break; } payment=thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit; } System.out.println(payment); sc.close(); } }
Main.java:68: error: 'else' without 'if' }else if(price>=1000 && price<10000){ ^ Main.java:101: error: reached end of file while parsing } ^ 2 errors
s844397283
p04045
Java
import java.util.Scanner; import java.util.List; import java.util.ArrayList; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int price = sc.nextInt(); int dislikeNumsCount = sc.nextInt(); int payment=0; List<Integer> nums = new ArrayList<>(); for (int i=0;i<10;i++){ nums.add(i); } for(int i=0;i<dislikeNumsCount;i++){ int dislikeNum = sc.nextInt(); if(nums.contains(dislikeNum)){ nums.remove(nums.indexOf(dislikeNum)); } } if(price<10){ int onesDigit=0; while(int i=0;i<nums.size();i++){ int onesDigit=nums.get(i); if(onesDigit>price){ break; } } payment=onesDigit; }else if(price>=10 && price<100){ int tensDigit=0; int onesDigit=0; while(int i=0;i<nums.size();i++){ tensDgit=nums.get(i); if(tenDigit*10>price){ break; } } while(int i=0;i<nums.size();i++){ onesDigit=nums.get(i); if(tensDigit*10+onesDigit>price){ break; } } payment=tensDigit*10+onesDigit; }else if(price>=100 && price<1000){ int hundredsDigit=0; int tensDigit=0; int onesDigit=0; while(int i=0;i<nums.size();i++){ hundredsDigit=nums.get(i); if(hundredsDigit*100>price){ break; } } while(int i=0;i<nums.size();i++){ tensDigit=nums.get(i); if(hundredsDigit*100+tensDigit*10>price){ break; } } while(int i=0;i<nums.size();i++){ onesDigit=nums.get(i); if(hundredsDigit*100+tensDigit*10+onesDigit>price){ break; } payment=hundredsDigit*100+tensDigit*10+onesDigit; }else if(price>=1000 && price<10000){ int thousandsDigit=0; int hundredsDigit=0; int tensDigit=0; int onesDigit=0; while(int i=0;i<nums.size();i++){ thousandsDigit=nums.get(i); if(thousandsDigit*1000>price){ break; } } while(int i=0;i<nums.size();i++){ hundredsDigit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100>price){ break; } } while(int i=0;i<nums.size();i++){ tenDgit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10>price){ break; } } while(int i=0;i<nums.size();i++){ onesDigit=nums.get(i); if(thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit>price){ break; } payment=thousandsDigit*1000+hundredsDigit*100+tensDigit*10+onesDigit; } System.out.println(payment); sc.close(); } }
Main.java:23: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:23: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:23: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:23: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:33: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:33: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:33: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:33: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:39: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:39: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:39: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:39: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:50: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:50: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:50: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:50: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:56: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:56: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:56: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:56: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:62: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:62: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:62: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:62: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:73: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:73: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:73: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:73: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:79: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:79: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:79: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:79: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:85: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:85: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:85: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:85: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:91: error: '.class' expected while(int i=0;i<nums.size();i++){ ^ Main.java:91: error: > or ',' expected while(int i=0;i<nums.size();i++){ ^ Main.java:91: error: not a statement while(int i=0;i<nums.size();i++){ ^ Main.java:91: error: ';' expected while(int i=0;i<nums.size();i++){ ^ Main.java:68: error: 'else' without 'if' }else if(price>=1000 && price<10000){ ^ Main.java:101: error: reached end of file while parsing } ^ 42 errors
s069788390
p04045
C++
int main(){ int n,k,t,c1=0,c2=0,c3=0; scanf("%d %d",&n,&k); int d[k],use[10-k],num=0; for(int i=0;i<k;i++) scanf("%d",&d[i]); //好きな数 for(int j=0;j<10;j++){ for(int l=0;l<k;l++){ if(j!=d[l]) c2++; } if(c2==k){ use[num]=j; num++; } c2=0; } //桁数 t=n; while(t>0){ c1++; t= t/10; }; t=n; //各桁を保存 int keta[c1+1]; for(int i=0;i<c1;i++){ keta[i]=t%10; t=t/10; } keta[c1]=0; int key=0; for(int i=0;i<c1+1;i++){ do{ if(i==c1&&keta[c1]==0) break; for(int j=0;j<10-k;j++){ if(keta[i]==use[j]){ key=1; break; } } if(key==0) keta[i]++; if(keta[i]>=10){ keta[i]=0; keta[i+1]++; } }while(key==0); key=0; } int ans=0,pow=1; for(int i=0;i<c1+1;i++){ for(int j=0;j<i;j++){ pow=pow*10; } ans =ans+keta[i]*pow; pow=1; } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:3:5: error: 'scanf' was not declared in this scope 3 | scanf("%d %d",&n,&k); | ^~~~~ a.cc:61:5: error: 'printf' was not declared in this scope 61 | printf("%d\n",ans); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int main(){
s260226366
p04045
C++
#include<bits/stdc++.h> #define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define all(x) (x).begin() , (x).end() #define rep(i,a,b) for(int i=a;i<b;i++) #define endl '\n' #define MAX 1000000 #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) typedef long long int ll; using namespace std; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} const ll mod = 1e9+7; const double eps = 1e-9; const double pi = acos(-1); void solve(){ int k; int n; cin>>n>>k; bool arr[11]; memset(arr,false,sizeof(arr)); for(int i=0;i<k;i++) { int t; cin>>t; arr[t]=true; } for(int i=n;i<10000;i++) { string ans=to_string(i); bool flag=true; for(int j=0;j<(int)ans.size();j++) { if(arr[s[j]-'0']) { flag=false; break; } } if(flag) { cout<<ans<<"\n"; return; } } } int main(){ fastio int test=1; while(test--) solve(); return 0; }
a.cc: In function 'void solve()': a.cc:53:20: error: 's' was not declared in this scope 53 | if(arr[s[j]-'0']) { | ^
s418096354
p04045
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); List<String> list = new ArrayList<String>(); int[] ilist = new int[k]; for(int i = 0; i<k; i++){ String str = String.valueOf(iList[i]); list.add(str); } while(true){ boolean boo = true; String nstr = String.valueOf(n); for(String str : list){ if(nstr.contais(str)){ boo = false; break; } } if(boo){ break; } n++; } System.out.println(n); } }
Main.java:12: error: cannot find symbol String str = String.valueOf(iList[i]); ^ symbol: variable iList location: class Main Main.java:20: error: cannot find symbol if(nstr.contais(str)){ ^ symbol: method contais(String) location: variable nstr of type String 2 errors
s682605329
p04045
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); String[] ilist = new String[k]; for(int i = 0; i<k; i++){ ilist[i] = String.valueOf(sc.nextInt()); } while(true){ boolean boo = true; String nstr = String.valueOf(n); for(String str : ilist){ if(nstr.contais(str)){ boo = false; break; } } if(boo){ break; } n++; } System.out.println(n); } }
Main.java:7: error: illegal character: '\u3000' String[] ilist =?new String[k]; ^ Main.java:7: error: not a statement String[] ilist =?new String[k]; ^ 2 errors
s297770838
p04045
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); List<String> list = new ArrayList<String>(); int[] ilist = new int[k]; for(int i = 0; i<k; i++){ String str = String.valueOf(iList[i]); list.add(str); } while(true){ boolean boo = true; String nstr = String.valueOf(n); for(String str : list){ if(nstr.contais(str)){ boo = false; break; } } if(boo){ break; } n++; } System.out.println(n); } }
Main.java:9: error: illegal character: '\u3000' int[] ilist =?new int[k]; ^ Main.java:9: error: not a statement int[] ilist =?new int[k]; ^ 2 errors
s004036359
p04045
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); List<String> list = new ArrayList<String>(); int[] list = new int[k]; for(int i = 0; i<k; i++){ String str = String.valueOf(iList[i]); list.add(str); } while(true){ boolean boo = true; String nstr = String.valueOf(n); for(String str : list){ if(nstr.contais(str)){ boo = false; break; } } if(boo){ break; } n++; } System.out.println(n); } }
Main.java:9: error: illegal character: '\u3000' int[] list =?new int[k]; ^ Main.java:9: error: not a statement int[] list =?new int[k]; ^ 2 errors
s971614159
p04045
C++
#include<bits/stdc++.h> using namespace std; dfs(vector<int>&A){ } int main(){ int N,K; cin>>N>>K; set<int>S; for(int i=0;i<K;i++){ int d; cin>>d; S.insert(d); }int ans; for(int i=N; ;i++){ string s=to_string(i); int n=s.size(); bool x=true; for(int j=0;j<n;j++){ char a=s.at(j); int b=a-'0'; if(S.count(b)){x=false; break;} }if(x){ ans=i; break; } }cout<<ans<<endl; return 0; }
a.cc:3:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive] 3 | dfs(vector<int>&A){ | ^~~ a.cc: In function 'int dfs(std::vector<int>&)': a.cc:5:1: warning: no return statement in function returning non-void [-Wreturn-type] 5 | } | ^
s938402210
p04045
C++
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main(){ int n,k; cin >> n >> k; set<int> s; rep(i,10)s.insert(i); rep(i,k){ int u; cin >> u; s.erase(u); } while(true){ int o=n; int h=0; while(o){ int j=o%10; o/=10 if(s.count(j)){ j++; } else{ h=1; break; } } if(h==0){ cout << n << endl; return 0; } n++; } }
a.cc: In function 'int main()': a.cc:20:12: error: expected ';' before 'if' 20 | o/=10 | ^ | ; 21 | if(s.count(j)){ | ~~ a.cc:24:7: error: 'else' without a previous 'if' 24 | else{ | ^~~~
s030481639
p04045
C++
#include <bits/stdc++.h> 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]; vector<bool>c(10); for(int i=0;i<10;i++){ for(int j=0;j<k;j++){ if(i==d[j]) { c[i]=false; break; } else if(j==k-1) c[i]=true; } } while(1){ string s=to_string(n); bool x=false; for(int i=0;i<s.size();i++){ int p=s[i]-'0'; if(c[p]]){ if(i==s.size()-1) x=true; } else break; } if(x) break; else n++; } cout<<n<<endl; }
a.cc: In function 'int main()': a.cc:24:14: error: expected ')' before ']' token 24 | if(c[p]]){ | ~ ^ | ) a.cc:24:14: error: expected primary-expression before ']' token
s169369546
p04045
C++
#include <bits/stdc++.h> 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]; vector<bool>c(10); for(int i=0;i<10;i++){ for(int j=0;j<k;j++){ if(i==d[k]) d[i]=false; else if(j==k-1) d[i]=true; } } while(1){ string s=to_string(n); bool x=false; for(int i=0;i<s.size();i++){ if(d[s[i]]){ if(i==s.size()-1) x=true } else break; } if(x) break; else n++; } cout<<n<<endl; }
a.cc: In function 'int main()': a.cc:21:33: error: expected ';' before '}' token 21 | if(i==s.size()-1) x=true | ^ | ; 22 | } | ~
s323628501
p04045
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long n = scanner.nextInt(),k=scanner.nextInt(); char [] a;a=new char [k]; for (int i=0;i<k;i++) { int x = scanner.nextInt(); String s = String.valueOf(x); a[i]=s.charAt(0); } boolean d = true; while (d) { d=false; String s = String.valueOf(n); for (int i=s.length()-1;i>=0;i--) { char c = s.charAt(i); for (int j=0;j<k;j++) { if (c==a[j]) { d=true; int t= s.length()-i-1; int g = (int)Math.pow(10, t); n+=g; i--; } } } } System.out.println(n); scanner.close();}}
Main.java:6: error: incompatible types: possible lossy conversion from long to int char [] a;a=new char [k]; ^ 1 error
s217587906
p04045
C++
#include <iostream> #include <unordered_set> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> vd(k); for (auto &d : vd) { cin >> d; } sort(vd.begin(), vd.end()); auto check = [] (int num) { string num_s = to_string(num); return any_of(num_s.begin(), num_s.end(), [&] (char ch) { return !binary_search(vd.begin(), vd.end(), ch - '0'); }); }; int ans; for (int i = n; i <= 10 * n; i++) { if (check(i)) { ans = i; break; } } cout << ans << '\n'; return 0; }
a.cc: In lambda function: a.cc:23:29: error: 'vd' is not captured 23 | return !binary_search(vd.begin(), vd.end(), ch - '0'); | ^~ a.cc:20:17: note: the lambda has no capture-default 20 | auto check = [] (int num) { | ^ a.cc:13:15: note: 'std::vector<int> vd' declared here 13 | vector<int> vd(k); | ^~ a.cc:23:41: error: 'vd' is not captured 23 | return !binary_search(vd.begin(), vd.end(), ch - '0'); | ^~ a.cc:20:17: note: the lambda has no capture-default 20 | auto check = [] (int num) { | ^ a.cc:13:15: note: 'std::vector<int> vd' declared here 13 | vector<int> vd(k); | ^~
s035421428
p04045
C++
#include <iostream> #include <unordered_set> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> vd(k); for (auto &d : vd) { cin >> d; } sort(vd.begin(), vd.end()); auto check = [] (int num) { string num_s = to_string(num); return any_of(num_s.begin(), num_s.end(), [] (char ch) { return !binary_search(vd.begin(), vd.end(), ch - '0'); }); }; int ans; for (int i = n; i <= 10 * n; i++) { if (check(i)) { ans = i; break; } } cout << ans << '\n'; return 0; }
a.cc: In lambda function: a.cc:23:29: error: 'vd' is not captured 23 | return !binary_search(vd.begin(), vd.end(), ch - '0'); | ^~ a.cc:22:48: note: the lambda has no capture-default 22 | return any_of(num_s.begin(), num_s.end(), [] (char ch) { | ^ a.cc:13:15: note: 'std::vector<int> vd' declared here 13 | vector<int> vd(k); | ^~ a.cc:23:41: error: 'vd' is not captured 23 | return !binary_search(vd.begin(), vd.end(), ch - '0'); | ^~ a.cc:22:48: note: the lambda has no capture-default 22 | return any_of(num_s.begin(), num_s.end(), [] (char ch) { | ^ a.cc:13:15: note: 'std::vector<int> vd' declared here 13 | vector<int> vd(k); | ^~
s862575487
p04045
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int[] num = new int[10]; for (int i = 0;i < k; i++) { int a = s.nextInt(); num[a]=1; } Integer op = n; while(!chechk(num,op)) { op++; } System.out.println(op); } private static boolean chechk(int[] num, Integer op) { while(op > 0) { if (num[op % 10] == 1) return false; op /= 10; } return true; }
Main.java:31: error: reached end of file while parsing } ^ 1 error
s014545842
p04045
C
#include<stdio.h> int main() { int n, k, i = 0, mod = 1, money = 0; scanf("%d %d", &n, &k); int num[10],hate[k]; for (i = 0; i < 10; i++) num[i] = 0; for (i = 0; i < k; i++) { scanf("%d", &hate[i]); num[hate[i]] = 1; } mod *= n % 10; while (n != 0) { if (num[n % 10] == 0) { money += mod; n /= 10; } else { n++; if (n % 10 == 9) n -= 9; } }
main.c: In function 'main': main.c:24:1: error: expected declaration or statement at end of input 24 | } | ^
s730869265
p04045
C
#include<stdio.h> int main() { int n, k, i = 0, mod = 1, money = 0; scanf("%d %d", &n, &k); int num[10],hate[k]; for (i = 0; i < 10; i++) num[i] = 0; for (i = 0; i < k; i++) { scanf("%d", &hate[i]); num[hate[i]] = 1; } mod *= n % 10; while (n != 0) { if (num[n % 10] == 0) { money += mod; n /= 10; } else { n++; if (n % 10 == 0) n -= 10; } }
main.c: In function 'main': main.c:24:1: error: expected declaration or statement at end of input 24 | } | ^
s119353457
p04045
C
#include<stdio.h> int main() { int n, k, i = 0, mod = 1, money = 0; scanf("%d %d", &n, &k); int num[10],hate[k]; for (i = 0; i < 10; i++) num[i] = 0; for (i = 0; i < k; i++) { scanf("%d", &hate[i]); num[hate[i]] = 1; } mod *= n % 10; while (n != 0) { if (num[n % 10] == 0) { money += mod; n /= 10; } else { n++; if (n % 10 == 0) n -= 10; } }
main.c: In function 'main': main.c:24:1: error: expected declaration or statement at end of input 24 | } | ^
s413376774
p04045
Java
import sys import heapq, math from itertools import zip_longest, permutations, combinations, combinations_with_replacement from itertools import accumulate, dropwhile, takewhile, groupby from functools import lru_cache from copy import deepcopy N, K = map(int, input().split()) D = list(map(int, input().split())) def ok(X): for d in D: if str(d) in str(X): return False return True while not ok(N): N += 1 print(N)
Main.java:1: error: '.' expected import sys ^ Main.java:2: error: '.' expected import heapq, math ^ Main.java:3: error: '.' expected from itertools import zip_longest, permutations, combinations, combinations_with_replacement ^ Main.java:4: error: '.' expected from itertools import accumulate, dropwhile, takewhile, groupby ^ Main.java:5: error: '.' expected from functools import lru_cache ^ Main.java:6: error: ';' expected from copy import deepcopy ^ Main.java:6: error: '.' expected from copy import deepcopy ^ Main.java:8: error: ';' expected N, K = map(int, input().split()) ^ 8 errors
s954655207
p04045
C++
N, K = map(str, input().split()) D = map(str, input().split()) D = set(D) # 集合に変換 number = {'0','1','2','3','4','5','6','7','8','9'} # 集合 out = D^number #print(out) out = sorted(list(out)) res_list = [] flag = 0 for i in range(len(N)-1, -1, -1): if flag == 0: if len(set(N[i])&set(out)) == 1: res_list.append(N[i]) else: tmp = -1 for j in range(len(out)): if N[i] < out[j]: tmp = out[j] break if tmp == -1: res_list.append(out[0]) flag = 1 else: res_list.append(tmp) elif flag == 1: flag = 0 tmp = -1 for j in range(len(out)): if N[i] < out[j]: tmp = out[j] if tmp == -1: res_list.append(out[0]) flag = 1 else: res_list.append(tmp) res = '' for i in range(len(res_list)-1, -1, -1): res += res_list[i] print(res)
a.cc:4:17: error: stray '#' in program 4 | D = set(D) # 集合に変換 | ^ a.cc:5:57: error: stray '#' in program 5 | number = {'0','1','2','3','4','5','6','7','8','9'} # 集合 | ^ a.cc:7:2: error: invalid preprocessing directive #print 7 | #print(out) | ^~~~~ a.cc:39:7: error: empty character constant 39 | res = '' | ^~ a.cc:1:1: error: 'N' does not name a type 1 | N, K = map(str, input().split()) | ^ a.cc:5:59: error: '\U000096c6\U00005408' does not name a type 5 | number = {'0','1','2','3','4','5','6','7','8','9'} # 集合 | ^~~~
s076724425
p04045
Java
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintStream out = new PrintStream(System.out); int N, K; Integer[] D; N = sc.nextInt(); K = sc.nextInt(); D = new Integer[K]; for (int i = 0; i < K; i++) { D[i] = sc.nextInt(); } for (int i = 1; i < 100000; i++) { if (N <= i) { if (i < 10000) { if (!Arrays.asList(D).contains((i%10000)/1000) && !Arrays.asList(D).contains((i%1000)/100) && !Arrays.asList(D).contains((i%100)/10) && !Arrays.asList(D).contains(i%10)) { out.println(i); break; } } if (i > 10000) if (!Arrays.asList(D).contains(i/10000) && !Arrays.asList(D).contains((i%10000)/1000) && !Arrays.asList(D).contains((i%1000)/100) && !Arrays.asList(D).contains((i%100)/10) && !Arrays.asList(D).contains(i%10)) { out.println(i); break; } } } } sc.close(); } }
Main.java:38: error: <identifier> expected sc.close(); ^ Main.java:40: error: class, interface, enum, or record expected } ^ 2 errors
s180448855
p04045
C
#include <stdio.h> int dis(int* n, int* d, int* k) { int i = 0; int result = *n; int add1 = 1; int add2 = 1; for (int c = 0;c < 4;c++) { for (int co = 0;co < *k;co++) { if (result % 10 == d[i]) { result += add1; *n = *n + add2; if (i == *k) break; } i++; } result /= 10; i = 0; add2 *= 10; } return 0; } int main() { int n, k, d[10],result=0; scanf_s("%d%d", &n, &k); for (int i = 0;i < k;i++) { scanf_s("%d", &d[i]); } dis(&n, &d[0], &k); printf("%d\n",n ); }
main.c: In function 'main': main.c:34:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 34 | scanf_s("%d%d", &n, &k); | ^~~~~~~ | scanf
s321538754
p04045
C
#include <stdio.h> int dis(int* n, int* d, int* k) { int i = 0; int result = *n; int add1 = 1; int add2 = 1; for (int c = 0;c < 4;c++) { for (int co = 0;co < *k;co++) { if (result % 10 == d[i]) { result += add1; *n = *n + add2; if (i == *k) break; } i++; } result /= 10; i = 0; add2 *= 10; } return 0; } int main() { int n, k, d[10]; scanf_s("%d%d", &n, &k); for (int i = 0;i < k;i++) { scanf_s("%d", &d[i]); } dis(&n, &d[0], &k); printf("%d\n",n ); }
main.c: In function 'main': main.c:24:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 24 | scanf_s("%d%d", &n, &k); | ^~~~~~~ | scanf
s674650488
p04045
C++
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); try { int n = sc.nextInt(); int k = sc.nextInt(); Map<Integer, Boolean> dMap = new HashMap<>(); // 繰り上げのために最小の桁を保存しておく for (int i = 0; i<k; i++) { int d = sc.nextInt(); // 嫌いな数字はTRUEにしてMapに入れる dMap.put(d, true); } int min = getMinFromInput(dMap); int amount = 0; // 10~1000でnを割って各桁の数を支払える最小を調べる for (int fig = 1; n > 0; fig = fig * 10) { // 桁上げ用 int upfig = 1; int div = n % 10; // Mapに入っていれば、嫌いなので一つ大きい数で支払う while (dMap.containsKey(div) && dMap.get(div)) { // 支払えない時は繰り上げる if (div >= 9) { // 繰り上げ div = 1; amount = 1111 * min; amount = amount % (fig*10); upfig *= 10; } else { div++; amount = 1111 * min; amount = amount % (fig * upfig); } } n = n / 10; amount += div * fig * upfig; // 繰り上げがあると、嫌いな数字が含まれてしまうことがある if (hasHateNum(dMap, amount)) { // やりなおし...? n = amount / fig; fig /= 10; //System.out.println("n = " + n + " fig = " + fig + " amount = " + amount); } } System.out.println(amount); } catch (Exception e) { e.printStackTrace(); System.out.println("入力値が不正です"); } } private static int getMinFromInput(Map<Integer, Boolean> dMap) { int min = 0; do { if (!dMap.containsKey(min)) { // 最小値が見つかったのでおわり break; } min++; } while (true); return min; } private static boolean hasHateNum(Map<Integer, Boolean> dMap, int amount) { String amountStr = String.valueOf(amount); for (Integer dNum : dMap.keySet()) { if (amountStr.contains(String.valueOf(dNum))) { return true; } } return false; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s683693139
p04045
C++
n,k = map(int,input().split()) d = list(map(int,input().split())) for i in range(10001): nn = n+i cnt = 0 for j in d: if str(j) in str(nn): break else: cnt += 1 if cnt == len(d): print(nn) break
a.cc:1:1: error: 'n' does not name a type 1 | n,k = map(int,input().split()) | ^
s851595346
p04045
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] nonuse = new int[10]; for(int i = 0; i < k; i++) { nonuse[sc.nextInt()] = 1; } int ans = n; while(true) { int p = 0; for(int i = 0; i < ans.length(); i++) { int d = Integer.parseInt(String.valueOf(ans.charAt(i))); if(nonuse[d] == 1) p++; } if(p == 0) { break; } else { ans++; } } System.out.println(ans); } }
Main.java:15: error: int cannot be dereferenced for(int i = 0; i < ans.length(); i++) { ^ Main.java:16: error: int cannot be dereferenced int d = Integer.parseInt(String.valueOf(ans.charAt(i))); ^ 2 errors
s358256082
p04045
C++
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++) #define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--) #define yes cout << "yes" << endl; #define Yes cout << "Yes" << endl; #define YES cout << "YES" << endl; #define no cout << "no" << endl; #define No cout << "No" << endl; #define NO cout << "NO" << endl; #define ll long long #define ull unsigned long long int N, K; bool D[10]; bool isD(int N) { while (N > 0) { if (D[N % 10]) return true; N /= 10; } return false; } int main() { memset(D, false, sizeof(D)); cin >> N >> K; rep(i, K) { int v; cin >> v; D[v] = true; } while (isD(N)) N++; cout << N << endl; }
a.cc: In function 'int main()': a.cc:39:5: error: 'memset' was not declared in this scope 39 | memset(D, false, sizeof(D)); | ^~~~~~ a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 8 | #include <stack> +++ |+#include <cstring> 9 | using namespace std;
s043723637
p04045
Java
package abc42; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class M { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); sc = new Scanner(System.in); String s = sc.nextLine(); sc.close(); String[] strs = s.split(" "); List<Integer> d = new ArrayList<>(); for (String str : strs) { d.add(Integer.parseInt(str)); } boolean isGood = false; int len; len = String.valueOf(n).length(); for (int i = 0; i < len; i++) { if (d.contains((n % (int) Math.pow(10, i + 1)) / (int) Math.pow(10, i))) { break; } if (i == len - 1) { isGood = true; } } if (isGood) { System.out.println(n); return; } n++; } }
Main.java:7: error: class M is public, should be declared in a file named M.java public class M { ^ 1 error
s282736114
p04045
Java
package abc42; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] nums = new int[2]; int count = 0; while(count < 2) { int i = sc.nextInt(); nums[count] = i; count++; } sc = new Scanner(System.in); String s = sc.nextLine(); String[] strs = s.split(" "); List<Character> d = new ArrayList<>(); for (String str : strs) { char[] c = str.toCharArray(); for (char c1 : c) { d.add(c1); } } String str; char[] c; List<Character> chara; boolean isGood = false; if (d.size() == 10) { return; } while (true) { str = String.valueOf(nums[0]); c = str.toCharArray(); chara = toList(c); for (int i = 0; i < str.length(); i++) { if (d.contains(chara.get(i))) { break; } if (i == str.length() - 1) { isGood = true; } } if (isGood) { System.out.println(nums[0]); return; } nums[0]++; } } public static ArrayList<Character> toList(char[] arr) { ArrayList<Character> list = new ArrayList<>(); for (char c : arr) list.add(c); return list; } }
Main.java:6: error: class C is public, should be declared in a file named C.java public class C { ^ 1 error
s325211958
p04045
C++
package abc42; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] nums = new int[2]; int count = 0; while(count < 2) { int i = sc.nextInt(); nums[count] = i; count++; } sc = new Scanner(System.in); String s = sc.nextLine(); String[] strs = s.split(" "); List<Character> d = new ArrayList<>(); for (String str : strs) { char[] c = str.toCharArray(); for (char c1 : c) { d.add(c1); } } String str; char[] c; List<Character> chara; boolean isGood = false; if (d.size() == 10) { return; } while (true) { str = String.valueOf(nums[0]); c = str.toCharArray(); chara = toList(c); for (int i = 0; i < str.length(); i++) { if (d.contains(chara.get(i))) { break; } if (i == str.length() - 1) { isGood = true; } } if (isGood) { System.out.println(nums[0]); return; } nums[0]++; } } public static ArrayList<Character> toList(char[] arr) { ArrayList<Character> list = new ArrayList<>(); for (char c : arr) list.add(c); return list; } }
a.cc:1:1: error: 'package' does not name a type 1 | package abc42; | ^~~~~~~ a.cc:2:1: error: 'import' does not name a type 2 | import java.util.ArrayList; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.List; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.Scanner; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: expected unqualified-id before 'public' 6 | public class C { | ^~~~~~
s421515202
p04045
C++
#include <bits/stdc++.h> #include <vector> #include <math.h> 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); } int ans; for (int i = n; i < 10*n + 1; ++i){ int a, b, c, d; a = i/1000; b = i%1000/100; c = i%100/10; d = i%10; for (int j = 0; j < k; ++j) { if (a != d[j] && b != d[j] && c != d[j] && d != d[j]) { ans = i; break; } if (ans != 0) { cout << ans << endl; break; } } } }
a.cc: In function 'int main()': a.cc:8:13: error: expected initializer before '>>' token 8 | cin >> n >> k; | ^~ a.cc:12:25: error: no match for call to '(std::vector<int>) (int&)' 12 | cin >> d(i); | ~^~~ a.cc:23:35: error: invalid types 'int[int]' for array subscript 23 | if (a != d[j] && b != d[j] && c != d[j] && d != d[j]) { | ^ a.cc:23:48: error: invalid types 'int[int]' for array subscript 23 | if (a != d[j] && b != d[j] && c != d[j] && d != d[j]) { | ^ a.cc:23:61: error: invalid types 'int[int]' for array subscript 23 | if (a != d[j] && b != d[j] && c != d[j] && d != d[j]) { | ^ a.cc:23:74: error: invalid types 'int[int]' for array subscript 23 | if (a != d[j] && b != d[j] && c != d[j] && d != d[j]) { | ^
s765831711
p04045
C++
// IlyM #include <bits/stdc++.h> #define pb push_back #define sp " " #define sl "\n" #define fi first #define se second #define mp make_pair #define sz(a) ((int)a.size()) #define tra(a,b) for (auto a:b) #define fo(a,b,c) for (int a=b;a<=c;a++) #define ms(a,b) memset(a,b,sizeof(a)) #define all(a) a.begin(),a.end() #define rev(a) reverse(a.begin(),a.end()) #define bit(i,j) (i&(1<<j)) using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii; typedef pair<int,ii> iii; const int N=2e5+5,mod=998244353; int n,k,a[N]; string trans(int u) { string w; while (u) { w.pb(u%10+'0'); u/=10; } return w; } int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin>>n>>k; fo(i,0,k-1) { cin>>a[i]; b[a[i]]=false; } fo(i,n,1000000) { string k=trans(i); bool t=true; for (int j=0;j<sz(k);j++) if (!b[k[i]-'0']) t=false; if (t) { cout<<i; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:40:34: error: 'b' was not declared in this scope 40 | fo(i,0,k-1) { cin>>a[i]; b[a[i]]=false; } | ^ a.cc:44:48: error: 'b' was not declared in this scope 44 | for (int j=0;j<sz(k);j++) if (!b[k[i]-'0']) t=false; | ^
s471572998
p04045
C++
// IlyM #include <bits/stdc++.h> #define pb push_back #define sp " " #define sl "\n" #define fi first #define se second #define mp make_pair #define sz(a) ((int)a.size()) #define tra(a,b) for (auto a:b) #define fo(a,b,c) for (int a=b;a<=c;a++) #define ms(a,b) memset(a,b,sizeof(a)) #define all(a) a.begin(),a.end() #define rev(a) reverse(a.begin(),a.end()) #define bit(i,j) (i&(1<<j)) using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii; typedef pair<int,ii> iii; const int N=2e5+5,mod=998244353; int n,k,a[N]; string trans(int u) { string w; while (u) { w.b(u%10+'0'); u/=10; } return w; } int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin>>n>>k; fo(i,0,k-1) { cin>>a[i]; b[a[i]]=false; } fo(i,n,1000000) { string k=trans(i); bool t=true; for (int j=0;j<sz(k);j++) if (!b[k[i]-'0']) t=false; if (t) { cout<<i; return 0; } } return 0; }
a.cc: In function 'std::string trans(int)': a.cc:32:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'b' 32 | w.b(u%10+'0'); u/=10; | ^ a.cc: In function 'int main()': a.cc:40:34: error: 'b' was not declared in this scope 40 | fo(i,0,k-1) { cin>>a[i]; b[a[i]]=false; } | ^ a.cc:44:48: error: 'b' was not declared in this scope 44 | for (int j=0;j<sz(k);j++) if (!b[k[i]-'0']) t=false; | ^
s387896895
p04045
C++
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; bool isValid(vector<int> &digits, int result) { while (result) { int d = result % 10; if (find(digits.begin(), digits.end(), d) != digits.end()) { return false; } result /= 10; } return true; } void main() { int n, k; cin >> n >> k; vector<int> digits; while (k--) { int d; cin >> d; digits.push_back(d); } int result = n; while (true) { if (isValid(digits, result)) { cout << result; break; } result++; } }
a.cc:19:1: error: '::main' must return 'int' 19 | void main() | ^~~~
s660534631
p04045
C++
#include<bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() using in = int64_t; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl #define yes cout<<"yes"<<endl #define no cout<<"no"<<endl #define vec(a,y,x) vector<vector<char>> a (y,vector<char>(x)) const vector<int> dx={1,0,-1,0}; const vector<int> dy={0,1,0,-1}; vector<int>a(4,-1); bool ans(int deg,vector<int> &notd,int n){ if(deg==0){ if(n<=0) return true; else a.assign(4,-1); } for(i : notd){ a.at(deg-1)=i; return ans(deg-1,notd,n-i*pow(10,deg)); } } int main(){ int n,k; cin>>n>>k; vector<int> d(k),notd; rep(i,k) cin>>d.at(i); rep(i,10){ if(find(all(d),i)==d.end()) notd.push(i); } string s=tostring(n); int deg=s.size(); bool nan = ans(deg,notd,n); if(a.at(0)==-1&&a.at(1)==-1&&a.at(2)==-1&&a.at(3)==-1){ if(notd.at(0)!=0) cout<<notd.at(0)*10000; else cout<<notd.at(1)*10000; } rep(i,deg) cout<<a.at(deg-1-i); cout<<endl; }
a.cc: In function 'bool ans(int, std::vector<int>&, int)': a.cc:21:9: error: found ':' in nested-name-specifier, expected '::' 21 | for(i : notd){ | ^ | :: a.cc:21:7: error: 'i' has not been declared 21 | for(i : notd){ | ^ a.cc:25:1: error: expected primary-expression before '}' token 25 | } | ^ a.cc:24:4: error: expected ';' before '}' token 24 | } | ^ | ; 25 | } | ~ a.cc:25:1: error: expected primary-expression before '}' token 25 | } | ^ a.cc:24:4: error: expected ')' before '}' token 24 | } | ^ | ) 25 | } | ~ a.cc:21:6: note: to match this '(' 21 | for(i : notd){ | ^ a.cc:25:1: error: expected primary-expression before '}' token 25 | } | ^ a.cc: In function 'int main()': a.cc:35:12: error: 'class std::vector<int>' has no member named 'push' 35 | notd.push(i); | ^~~~ a.cc:37:12: error: 'tostring' was not declared in this scope 37 | string s=tostring(n); | ^~~~~~~~ a.cc: In function 'bool ans(int, std::vector<int>&, int)': a.cc:25:1: warning: control reaches end of non-void function [-Wreturn-type] 25 | } | ^
s391755919
p04045
C++
#include <bits/stdc++.h> #define int long long using namespace std; int len,n,temp; int a[15],get[15]; void change() { int flag=1; for (int i=len;i>=1;i--) { if (a[i]!=9) { a[i]++; flag=0; for (int j=i+1;j<=len;j++) a[j]=0; break; } } if (flag==0) return; len++; a[1]=1; for (int i=2;i<=len;i++) a[i]=0; } signed main() { string s; cin>>s>>n; len=s.size(); memset(get,1,sizeof(get)); for (int i=1;i<=len;i++) a[i]=s[i-1]-'0'; for (int i=1;i<=n;i++) { cin>>temp; get[temp]=0; } while (1) { int dog=1; for (int i=1;i<=len;i++) { if (get[a[i]]==0) { dog=0; break; } } if (dog==1) break; change(); } for (int i=1;i<=len;i++) cout<<a[i]; return 0; }
a.cc: In function 'int main()': a.cc:33:16: error: reference to 'get' is ambiguous 33 | memset(get,1,sizeof(get)); | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80, from a.cc:1: /usr/include/c++/14/variant:1180:5: note: candidates are: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const variant<_Types ...>&&)' 1180 | get(const variant<_Types...>&& __v) | ^~~ /usr/include/c++/14/variant:1170:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const variant<_Types ...>&)' 1170 | get(const variant<_Types...>& __v) | ^~~ /usr/include/c++/14/variant:1160:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(variant<_Types ...>&&)' 1160 | get(variant<_Types...>&& __v) | ^~~ /usr/include/c++/14/variant:1150:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(variant<_Types ...>&)' 1150 | get(variant<_Types...>& __v) | ^~~ /usr/include/c++/14/variant:1748:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(const variant<_Types ...>&&)' 1748 | get(const variant<_Types...>&& __v) | ^~~ /usr/include/c++/14/variant:1737:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(const variant<_Types ...>&)' 1737 | get(const variant<_Types...>& __v) | ^~~ /usr/include/c++/14/variant:1726:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(variant<_Types ...>&&)' 1726 | get(variant<_Types...>&& __v) | ^~~ /usr/include/c++/14/variant:1715:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(variant<_Types ...>&)' 1715 | get(variant<_Types...>& __v) | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/tuple:2517:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const tuple<_Elements ...>&&)' 2517 | get(const tuple<_Types...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2505:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const tuple<_Elements ...>&)' 2505 | get(const tuple<_Types...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2494:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(tuple<_Elements ...>&&)' 2494 | get(tuple<_Types...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2483:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(tuple<_Elements ...>&)' 2483 | get(tuple<_Types...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2476:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&)' 2476 | get(const tuple<_Elements...>&) = delete; | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1307:5: note: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_Up, _Tp>&&)' 1307 | get(const pair<_Up, _Tp>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1302:5: note: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_Up, _Tp>&&)' 1302 | get(pair<_Up, _Tp>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1297:5: note: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_Up, _Tp>&)' 1297 | get(const pair<_Up, _Tp>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1292:5: note: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_Up, _Tp>&)' 1292 | get(pair<_Up, _Tp>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1287:5: note: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_T1, _T2>&&)' 1287 | get(const pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1282:5: note: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_T1, _T2>&&)' 1282 | get(pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1277:5: note: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)' 1277 | get(const pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1272:5: note: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)' 1272 | get(pair<_Tp, _Up>& __p) noexcept | ^~~ In file included from /usr/include/c++/14/functional:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/array:417:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const array<_Tp, _Nm>&&)' 417 | get(const array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:408:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const array<_Tp, _Nm>&)' 408 | get(const array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/array:399:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(array<_Tp, _Nm>&&)' 399 | get(array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:390:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(array<_Tp, _Nm>&)' 390 | get(array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/tuple:2466:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&)' 2466 | get(const tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2457:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)' 2457 | get(tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2451:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)' 2451 | get(const tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2445:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)' 2445 | get(tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1265:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)' 1265 | get(const pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1260:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)' 1260 | get(const pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1255:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)' 1255 | get(pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1250:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)' 1250 | get(pair<_Tp1, _Tp2>& __in) noexcept | ^~~ a.cc:6:11: note: 'long long int get [15]' 6 | int a[15],get[15]; | ^~~ a.cc:33:29: error: reference to 'get' is ambiguous 33 | memset(get,1,sizeof(get)); | ^~~ /usr/include/c++/14/variant:1180:5: note: candidates are: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const variant<_Types ...>&&)' 1180 | get(const variant<_Types...>&& __v) | ^~~ /usr/include/c++/14/variant:1170:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const variant<_Types ...>&)' 1170 | get(const variant<_Types...>& __v) | ^~~ /usr/include/c++/14/variant:1160:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(variant<_Types ...>&&)' 1160 | get(variant<_Types...>&& __v) | ^~~ /usr/include/c++/14/variant:1150:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(variant<_Types ...>&)' 1150 | get(variant<_Types...>& __v) | ^~~ /usr/include/c++/14/variant:1748:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(const v
s641081947
p04045
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,t; cin>>n>>t; set<int> st; while(t--){ int g;cin>>g; st.insert(g); } for(int i=n;i>=n;i++){ string k =to_string(i); int f=0; for(int i=0;i<k.length();i++){ if(st.find(s[i]-'0')!=st.end()){ f=1; break; } } if(f==0){ cout<<k; break; } } }
a.cc: In function 'int main()': a.cc:15:18: error: 's' was not declared in this scope 15 | if(st.find(s[i]-'0')!=st.end()){ | ^
s202419020
p04045
C++
/****************************************************************************** EYENINE,THE ELDER_WAND!!! THE ROOT OVER MINUS EIGHTY ONE!! *******************************************************************************/ #include<bits/stdc++.h> #include<string> #define ALL_UP_WITH return 0 #define vi vector<int> using namespace std; int count1=0; char d[10];int n,k; int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>n>>k; for(int i=0;i<k;i++){ char f; cin>>f; d[f-'0']=1; } for(int i=n;i<10000;i++){ string s=to_string(i); for(int j=0;j<s.size();j+=){ if(d[s[j]-'0']==1)goto e; } cout<<i<<endl;break;e:; } ALL_UP_WITH; }
a.cc: In function 'int main()': a.cc:26:35: error: expected primary-expression before ')' token 26 | for(int j=0;j<s.size();j+=){ | ^
s232071279
p04045
C++
/****************************************************************************** EYENINE,THE ELDER_WAND!!! THE ROOT OVER MINUS EIGHTY ONE!! *******************************************************************************/ #include<bits/stdc++.h> #define ALL_UP_WITH return 0 #define vi vector<int> using namespace std; int count1=0; char d[10];int n,k; int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>n>>k; for(int i=0;i<k;i++){ char f; cin>>f; d[f-'0']=1; } for(int i=n;i<10000;i++){ string s=to_string(i); for(int j=0;j<s.size();j+=){ if(d[s[j]-'0']==1)goto e; } cout<<i<<endl;break;e:; } ALL_UP_WITH; }
a.cc: In function 'int main()': a.cc:25:35: error: expected primary-expression before ')' token 25 | for(int j=0;j<s.size();j+=){ | ^
s417613630
p04045
C++
#include "iostream" #include "vector" using namespace std; bool has_digit(int n, int d) { while (n != 0) { if (n % 10 == d) return true; n /= 10; } return false; } bool has_digit(int n, const vector<int>& ds) { for (int d: ds) if has_digit(n, d) return true; return false; } int main() { int n, k; cin >> n >> k; vector<int> ds(k); for (int i = 0; i < k; ++i) cin >> ds[i]; while (n > 0 or has_digit(n, ds)) --n; cout << n << endl; }
a.cc: In function 'bool has_digit(int, const std::vector<int>&)': a.cc:14:22: error: expected '(' before 'has_digit' 14 | for (int d: ds) if has_digit(n, d) return true; | ^~~~~~~~~ | (
s230298760
p04045
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define F(i, a, b) for (int i = (a); i <= (b); i++) #define D(i, a, b) for (int i = (a); i >= (b); i--) #define R(i, a, b) for (int i = (a); i < (b); i++) #define N 500000 int main() { #ifdef DOC freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif string n; int l; cin >> n >> l; vector<bool> at(11); R(i,0,l){ int t; cin >> t; at[t] = true; } vector<int> like; R(i,0,10){ if(!at[i]) like.push_back(i); } vector<int> res; for(char c : n){ int ch = res.size(); for(int k : like){ if(c - '0' <= k) { res.push_back(k); break; } } if(res.size() == ch) res.push_back(like[0]); } res. for(int x : res) cout << x; return 0; }
a.cc: In function 'int main()': a.cc:38:3: error: expected unqualified-id before 'for' 38 | for(int x : res) cout << x; | ^~~
s746366840
p04045
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; int k; cin >> n >> k; char d[k]; for(int i=0;i<k;i++) cin >> d[i]; int ans; while(1){ string str=to_string(i); int count=0; for(int j=0;j<str.size();j++){ for(int l=0;l<k;l++){ if(str[j]==d[l]) continue; if(str[j]!=d[k-1]) count++; } } if(count==str.size()){ ans=i; break; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:30: error: 'i' was not declared in this scope 12 | string str=to_string(i); | ^
s911304009
p04045
C++
#include<iostream> #include<vector> #include<string> using namespace std; int main() { vector<char> total, hatelist; int hate; string temp; cin >> temp >> hate; for (int i = 0; i < temp.length(); i++) { total.push_back(temp[i]); } char tem; for (size_t i = 0; i < hate; i++) { cin >> tem; hatelist.push_back(tem); } for (size_t i = 0; i < total.size(); i++) { vector<char>::iterator it = find(hatelist.begin(), hatelist.end(), total[i]); if (it != hatelist.end()) { total[i]++; } } for (size_t i = 0; i < total.size(); i++) { cout << total[i]; } }
a.cc: In function 'int main()': a.cc:27:49: error: no matching function for call to 'find(std::vector<char>::iterator, std::vector<char>::iterator, __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 27 | vector<char>::iterator it = find(hatelist.begin(), hatelist.end(), total[i]); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:27:49: note: '__gnu_cxx::__normal_iterator<char*, std::vector<char> >' is not derived from 'std::istreambuf_iterator<_CharT>' 27 | vector<char>::iterator it = find(hatelist.begin(), hatelist.end(), total[i]); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s782802316
p04045
C
#include<stdio.h> int main() { int a[8],i,j,N,k,r; scanf("%d %d",&N,&k); for(i=0;i<=k;i++) { scanf("%d",&a[i]); } for(j=N;j>=N;j++) { p=j; m=j%10; i=0; while(a[i]!=m) { i++; } j=j/10; } return p;
main.c: In function 'main': main.c:12:5: error: 'p' undeclared (first use in this function) 12 | p=j; | ^ main.c:12:5: note: each undeclared identifier is reported only once for each function it appears in main.c:13:5: error: 'm' undeclared (first use in this function) 13 | m=j%10; | ^ main.c:21:3: error: expected declaration or statement at end of input 21 | return p; | ^~~~~~
s221484854
p04045
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; const int max_n = 1e6; ll a[2][200]; int main(){ cin >> n; bool ok[10]={false}; for(int i=0 ; i<10 ; i++){ int x; cin >> x; ok[x] = true; } int ans = n; int now = 1; while(true){ now = ans; while(now>0){ if(d[now%10]){ break; } now /= 10; } if(now == 0) break; ans++; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:10: error: 'd' was not declared in this scope 19 | if(d[now%10]){ | ^
s860968345
p04045
C++
#include<iostream> #include<vector> #include<map> #include<string> using namespace std; int main(void) { int price, k; map<int, bool> hate_num; vector<int> like_num; cin >> price >> k; string str_price = to_string(price); for (int i = 0; i < k; ++i) { int t; cin >> t; hate_num[t] = true; } for (int i = 0; i < 10; i++) { if (!hate_num[i]) { like_num.push_back(i); } } vector<int> prices; for (auto ln1: like_num) { for (auto ln2: like_num) { for (auto ln3: like_num) { for (auto ln4: like_num) { for (auto ln5: like_num) { int num1 = ln2 * 1000 + ln3 * 100 + ln4 * 10 + ln5; if (num1 >= price) { prices.push_back(num1); } if (prices.empty()) { int num2 = ln1 * 10000 + ln2 * 1000 + ln3 * 100 + ln4 * 10 + ln5; if (num2 >= price) { prices.push_back(num2); } } } } } } } sort(prices.begin(), prices.end()); cout << prices[0] << endl; }
a.cc: In function 'int main()': a.cc:46:5: error: 'sort' was not declared in this scope; did you mean 'short'? 46 | sort(prices.begin(), prices.end()); | ^~~~ | short
s757894682
p04045
C++
#include<stdio.h> int main(){ int N,K; int D[9]; int data[4]={}; scanf("%d%d",&N&K); for(int i=0;i<K;i++){ scanf("%d",&D[i]); } data[0]=N/1000; data[1]=N/100-data[0]*4; data[2]=N/10-data[0]*100-data[1]*10; data[3]=N-data[0]*1000-data[1]*100-data[2]*10; while(N<10000){ for(int j=0;j<4;j++){ for(int i=0;i<K;i++){ if(data[j]==D[i]){ goto exit; } } } } if(j==4){ printf("%d",N); } exit: N++; } return 0; }
a.cc: In function 'int main()': a.cc:6:16: error: invalid operands of types 'int*' and 'int' to binary 'operator&' 6 | scanf("%d%d",&N&K); | ~~^~ | | | | | int | int* a.cc:24:8: error: 'j' was not declared in this scope 24 | if(j==4){ | ^ a.cc: At global scope: a.cc:31:9: error: expected unqualified-id before 'return' 31 | return 0; | ^~~~~~ a.cc:32:1: error: expected declaration before '}' token 32 | } | ^
s718484463
p04045
C++
#pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #include<iostream> #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef unsigned long long ull; typedef vector<ll> vl; typedef vector<vl> vvl; typedef pair<ll,ll> pll; typedef vector<pll> vpll; #define ff first #define ss second #define pb push_back #define mp make_pair #define eb emplace_back #define tr(x,container) for(auto &x:container) #define fr(i,n) for(ll i=0;i<(n);++i) #define frs(i,s,n) for(ll i=s;i<(n);++i) #define frb(i,s,e) for(ll i=s;i<=(e);++i) #define rfr(i,n) for(ll i=(n-1);i>=0;i--) #define frbr(i,e,s) for(ll i=e;i>=(s);i--) #define mset(m,v) memset(m,v,sizeof(m)) #define all(x) (x).begin(), (x).end() #define sz(x) ((ll)(x).size()) #define find_bug(x) cout <<'>' << #x << " : " << x << endl; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} clock_t startTime; double getCurrentTime() {return ((double)(clock() - startTime)) / CLOCKS_PER_SEC;} #ifndef ONLINE_JUDGE #define dbg(x...) cerr << "[" << #x << "] = ["; _print(x) #define dbg_arr(a,n)cerr << "[" << #a << "] = [ ";fr(i,n)cerr<<a[i]<<" ";cerr<<"]\n"; #define dbg_mat(m,r,c)cerr<<"[" <<#m<<"]:\n";fr(i,r){cerr<<"[ ";fr(j,c)cerr<<m[i][j]<<" ";cerr<<"]\n";} #define dbg_time()cerr<<"Time elapsed: "<<getCurrentTime()<<endl; #define tle() {if(getCurrentTime() > 5.0) {dbg_time();cerr<< "#ForceExit - TLE - 5.0" << endl; exit(1);}} #else #define dbg(x...){} #define dbg_arr(a,n){} #define dbg_mat(m,r,c){} #define dbg_time(t){} #define tle(){} #endif const ll MOD = 1e9+7; const ll SMOD = 998244353; const ll INF = 1e18; const ll SINF = 1e9; const ll MAX = 100100; /*******************************************************************************************************************/ void pre() { } bool check(ll n, vl & v) { string s = to_string(n); fr(i,sz(n)) { fr(i,sz(v)) { if(v[i] == s[i]-'0') return false; } } return true; } void solve() { ll n; cin >> n; ll k; vl d; fr(i,n) { ll x; cin >> x; d.pb(x); } while(true) { tle(); if(check(n, d)) { cout << n << '\n'; return ; } n++ } } signed main() { startTime = clock(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif //cout<<fixed<<setprecision(15); //pre(); ll test = 1; // cin>>test; fr(ii,test) { // cout << "Case #" << ii + 1 << ": "<<endl; solve(); } dbg_time(); return 0; }
a.cc: In function 'bool check(ll, vl&)': a.cc:32:24: error: request for member 'size' in 'n', which is of non-class type 'll' {aka 'long long int'} 32 | #define sz(x) ((ll)(x).size()) | ^~~~ a.cc:25:31: note: in definition of macro 'fr' 25 | #define fr(i,n) for(ll i=0;i<(n);++i) | ^ a.cc:90:8: note: in expansion of macro 'sz' 90 | fr(i,sz(n)) | ^~ a.cc: In function 'void solve()': a.cc:121:8: error: expected ';' before '}' token 121 | n++ | ^ | ; 122 | } | ~
s297388114
p04045
Java
import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; public class Item { public static void main(String[] args) { Scanner in = new Scanner(System.in); List<Integer> hatenum = new ArrayList<>(); List<Integer> oneToTen = new ArrayList<Integer>(Arrays.asList(0,1,2,3,4,5,6,7,8,9)); int paymoney = in.nextInt(); int n = in.nextInt(); int i = 0; while(i < n){ hatenum.add(in.nextInt()); i++; } oneToTen.removeAll(hatenum); int[] ud = {1, 10, 100, 1000, 10000}; int[] di = {0, -1, -1, -1, -1}; while (true) { int total = 0; for(int k = 0;-1 < di[k];k++) { total += ud[k] * oneToTen.get(di[k]); } if(paymoney < total) { System.out.println(total); break; } for (int k = 0;-1 < di[k];k++) { if (oneToTen.size() == di[k]) { di[k] = 0; di[k+1] += 1; } } } } }
Main.java:6: error: class Item is public, should be declared in a file named Item.java public class Item { ^ 1 error
s931372185
p04045
Java
import java.util.Scanner; /** * ABC042C */ public class ABC042C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); boolean[] dislike = new boolean[10]; for (int i = 0; i < dislike.length; i++) { dislike[i] = false; } for (int i = 0; i < K; i++) { dislike[sc.nextInt()] = true; } String str_N = Integer.toString(N); String ans = ""; int i = str_N.length() - 1; while (i >= -1) { int sequence = 1; if (i != -1) { sequence = str_N.charAt(i) - '0'; } for (int j = 0; j < 10; j++) { if (dislike[(sequence + j) % 10]) continue; ans += Integer.toString((sequence + j) % 10); break; } if (i == 0 && ans.charAt(str_N.length() - 1) >= str_N.charAt(str_N.length() - 1)) break; i--; } StringBuffer buf = new StringBuffer(ans); ans = buf.reverse().toString(); System.out.println(ans); } }
Main.java:6: error: class ABC042C is public, should be declared in a file named ABC042C.java public class ABC042C { ^ 1 error
s573465620
p04045
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; int a[10]; for(int i=0;i<10;i++) a[i]=1; while(k--) { int x; cin>>x; a[x]=0; } //cout<<n<<endl; for(int i=n;;) { bool b=true; int cp=i; //cout<<i<<endl; while(i) { int d=i%10; if(!a[d]) { b=false; break; } i/=10; } if(b) {
a.cc: In function 'int main()': a.cc:32:14: error: expected '}' at end of input 32 | { | ~^ a.cc:32:14: error: expected '}' at end of input a.cc:17:9: note: to match this '{' 17 | { | ^ a.cc:32:14: error: expected '}' at end of input 32 | { | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s309626851
p04045
C++
#include <bits/stdc++.h> using namespace std ; int main () { bool dis[10] ; for ( int i = 0 ; i < 10 ; i ++ ) dis[i] = false ; int pay , k , a ; cin >> pay >> k ; for ( int i = 0 ; i < k ; i ++ ) { cin >> a ; dis[a] = true ; } while (true) { int sol = pay ; bool check = true ; a while(sol) { if ( dis[sol%10] ) { check = false ; break ; } sol /= 10 ; } if (check){ cout << pay << endl ; return 0 ; } pay ++ ; } }
a.cc: In function 'int main()': a.cc:19:38: error: expected ';' before 'while' 19 | bool check = true ; a | ^ | ; 20 | while(sol) { | ~~~~~
s259717176
p04045
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; int k; cin>>s>>k; vector<int> d(k); vector<int> num; rep(i,k)cin>>d.at(i); for(int i=0;i<=9;++i){ bool yes=true; for(int j=0;j<k;++j) if(d.at(j)==i){yes=false;break;} if(yes)num.push_back(i); } sort(all(num)); for(int i=0;i<s.size();++i){ bool yes=false; for(int j=0;j<num.size();++j) if(s.at(i)==num.at(j)+'0'){yes=true;break;} if(!yes){ if(i==0&&num.at(0)==0) s.at(0)=num.at(1)+'0'; else s.at(i)=num.at(0)+'0'; } } cout<<s<<"\n"s; }
a.cc: In function 'int main()': a.cc:10:9: error: 'i' was not declared in this scope 10 | rep(i,k)cin>>d.at(i); | ^ a.cc:10:5: error: 'rep' was not declared in this scope 10 | rep(i,k)cin>>d.at(i); | ^~~ a.cc:17:10: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'? 17 | sort(all(num)); | ^~~ | std::filesystem::perms::all In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200, from a.cc:1: /usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here 158 | all = 0777, | ^~~
s326243165
p04045
Java
public class Main { static String str; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); for(int i = 0; i < k; i++) { str = sc.next(); } for(int i = 0; i < 100000; i++ ) { if(check(n)) { System.out.print(i); return; } } sc.close(); } private static boolean check(int n){ boolean result = true; String m; while(n >= 1) { m = String.valueOf(n % 10); int comp = m.lastIndexOf(str); if(comp != -1) { result = false; } n = n / 10; } return result; } }
Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s287190438
p04045
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define lvector vector<ll> #define P pair<ll,ll> #define rep(i,n) for(ll (i)=0; (i)<(n); ++(i)) #define print(a) cout << (a) << endl int main() { ios::sync_with_stdio(false); cin.tie(0); ll N,k,d,ans=0;cin>>N>>k; ll l=to_string(N).length(); set<ll> num{0,1,2,3,4,5,6,7,8,9}; rep(i,k) { cin>>d; num.erase(d); } vector<set<ll>> V(l+2); bool is_continue=true; V[0].insert(0); for(ll i:num) { if(i<n) V[1].insert(i); else { ans=i; is_continue=false; break;} } if(!is_continue) { print(ans); return 0; } for(ll i=2;i<l+2;++i) { for(ll j:V[i-1]) { if(j==0) continue; for(ll k:num) { if(j*10+k<N) V[i].insert(j*10+k); else { ans=j*10+k; is_continue=false; break; } } if(!is_continue) break; } if(!is_continue) break; } print(ans); return 0; }
a.cc: In function 'int main()': a.cc:23:10: error: 'n' was not declared in this scope 23 | if(i<n) V[1].insert(i); | ^
s366634486
p04045
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define lvector vector<ll> #define P pair<ll,ll> #define rep(i,n) for(ll (i)=0; (i)<(n); ++(i)) #define print(a) cout << (a) << endl int main() { ios::sync_with_stdio(false); cin.tie(0); ll N,k,d,ans=0;cin>>N>>k; ll l=to_string(N).length(); set<ll> num{0,1,2,3,4,5,6,7,8,9}; rep(i,k) { cin>>d; num.erase(d); } vector<set<ll>> V(l+2); bool is_continue=true; V[0].insert(0); for(ll i:num) { if(i<n) V[1].insert(i); else { ans=i; is_continue=false; break;} } if(!is_continue) {print(ans);return;} for(ll i=2;i<l+2;++i) { for(ll j:V[i-1]) { if(j==0) continue; for(ll k:num) { if(j*10+k<N) V[i].insert(j*10+k); else { ans=j*10+k; is_continue=false; break; } } if(!is_continue) break; } if(!is_continue) break; } print(ans); return 0; }
a.cc: In function 'int main()': a.cc:23:10: error: 'n' was not declared in this scope 23 | if(i<n) V[1].insert(i); | ^ a.cc:29:32: error: return-statement with no value, in function returning 'int' [-fpermissive] 29 | if(!is_continue) {print(ans);return;} | ^~~~~~
s908426976
p04045
C++
#include <bits/stdc++.h> using namespace std; bool check(int i, bool num[]){ string pay = to_string(i); for(int p = 0; p < pay.size(); p++){ if(num[pay[p]-'0']) return false; } return true; } int main(void){ int N, K; cin >> N >> K; bool num(10); for(int i = 0; i < K; i++){ int n; cin >> n; num[n] = true; } for(int i = N; i < 10000; i++){ if(check(i, num)){ cout << i << endl; break; } } return 0; }
a.cc: In function 'int main()': a.cc:19:12: error: invalid types 'bool[int]' for array subscript 19 | num[n] = true; | ^ a.cc:23:19: error: cannot convert 'bool' to 'bool*' 23 | if(check(i, num)){ | ^~~ | | | bool a.cc:4:24: note: initializing argument 2 of 'bool check(int, bool*)' 4 | bool check(int i, bool num[]){ | ~~~~~^~~~~
s908833583
p04045
C++
// BUGSBUNNY // IIT ROORKEE // _,add8ba, // ,d888888888b, // d8888888888888b _,ad8ba,_ // d888888888888888) ,d888888888b, // I8888888888888888 _________ ,8888888888888b // __________`Y88888888888888P"""""""""""baaa,__ ,888888888888888, // ,adP"""""""""""9888888888P""^ ^""Y8888888888888888I // ,a8"^ ,d888P"888P^ ^"Y8888888888P' // ,a8^ ,d8888' ^Y8888888P' // a88' ,d8888P' I88P"^ // ,d88' d88888P' "b, // ,d88' d888888' `b, // ,d88' d888888I `b, // d88I ,8888888' ___ `b, // ,888' d8888888 ,d88888b, ____ `b, // d888 ,8888888I d88888888b, ,d8888b, `b // ,8888 I8888888I d8888888888I ,88888888b 8, // I8888 88888888b d88888888888' 8888888888b 8I // d8886 888888888 Y888888888P' Y8888888888, ,8b // 88888b I88888888b `Y8888888^ `Y888888888I d88, // Y88888b `888888888b, `""""^ `Y8888888P' d888I // `888888b 88888888888b, `Y8888P^ d88888 // Y888888b ,8888888888888ba,_ _______ `""^ ,d888888 // I8888888b, ,888888888888888888ba,_ d88888888b ,ad8888888I // `888888888b, I8888888888888888888888b, ^"Y888P"^ ____.,ad88888888888I // 88888888888b,`888888888888888888888888b, "" ad888888888888888888888' // 8888888888888698888888888888888888888888b_,ad88ba,_,d88888888888888888888888 // 88888888888888888888888888888888888888888b,`"""^ d8888888888888888888888888I // 8888888888888888888888888888888888888888888baaad888888888888888888888888888' // Y8888888888888888888888888888888888888888888888888888888888888888888888888P // I888888888888888888888888888888888888888888888P^ ^Y8888888888888888888888' // `Y88888888888888888P88888888888888888888888888' ^88888888888888888888I // `Y8888888888888888 `8888888888888888888888888 8888888888888888888P' // `Y888888888888888 `888888888888888888888888, ,888888888888888888P' // `Y88888888888888b `88888888888888888888888I I888888888888888888' // "Y8888888888888b `8888888888888888888888I I88888888888888888' // "Y88888888888P `888888888888888888888b d8888888888888888' // ^""""""""^ `Y88888888888888888888, 888888888888888P' // "8888888888888888888b, Y888888888888P^ // `Y888888888888888888b `Y8888888P"^ // "Y8888888888888888P `""""^ // `"YY88888888888P' // ^""""""""' #include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define ll long long #define int long long #define ld long double #define endl '\n' #define vi vector<int> #define vvi vector<vi> #define vs vector<string> #define vl vector<long long> #define vpii vector<pii> #define vpipii vector<pipii> #define vb vector<bool> #define pb push_back #define pob pop_back #define gcd __gcd #define mp make_pair #define pii pair<int,int> #define pipii pair<int,pii> #define pll pair<long long,long long> #define pld pair<long double,long double> #define mod 1000000007 #define mod2 998244353 #define rep(i,n) for (ll i = 0; i < n; i++) #define repp(i,a,b) for(ll i = a ; i<b ; i++) #define reppr(i,a,b) for(ll i = a-1 ; i>=b ; i--) #define repr(i,n) for (ll i = n - 1; i >= 0; i--) #define ff first #define ss second #define pc putchar_unlocked #define gc getchar_unlocked #define inf 1000000000000000000 #define infn -9223372036854775807 #define pi 3.14159265358979323846 #define eps 0.0000000001 #define sp << " " << #define setprecision0 cout << fixed << setprecision(0); #define setprecision10 cout << fixed << setprecision(10); #define all(n) n.begin(),n.end() void solve(); signed main() { fast; int t = 1; // cin >> t; while(t--) solve(); } void solve() { int n , k; cin >> n >> k; bool arr[10] , ans = n; rep(i,k) cin >> temp , arr[temp] = 1; while(true) { int flag = 0; string s = to_string(ans); for(auto i : s) if(arr[i-'0']==0) flag = 1; if(flag) ans++; else break; } cout << ans << endl; }
a.cc: In function 'void solve()': a.cc:102:24: error: 'temp' was not declared in this scope; did you mean 'tm'? 102 | cin >> temp , arr[temp] = 1; | ^~~~ | tm a.cc:111:25: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17 111 | ans++; | ^~~
s058378530
p04045
C++
#include <iostream> #include <vector> #include <string> #include <unordered_set> using namespace std; int main(void){ int N,K,i; cin >> N >> K; string s; unordered_set(int) D; while(getline(cin, s, ' ')){ D.insert(stoi(s)); } int n = N; int a,b,c,d; for(;n < 10000;++n){ a = n / 1000; b = (n - 1000 * a) / 100; c = (n - 1000 * a - 100 * b) / 10; d = n - 1000 * a - 100 * b - 10 * c; if(D.find(a) == D.end() && D.find(b) == D.end() && D.find(c) == D.end() && D.find(d) == D.end()){ cout << n; break; } } }
a.cc: In function 'int main()': a.cc:11:22: error: missing template arguments before '(' token 11 | unordered_set(int) D; | ^ a.cc:11:23: error: expected primary-expression before 'int' 11 | unordered_set(int) D; | ^~~ a.cc:13:17: error: 'D' was not declared in this scope 13 | D.insert(stoi(s)); | ^ a.cc:22:20: error: 'D' was not declared in this scope 22 | if(D.find(a) == D.end() && D.find(b) == D.end() && D.find(c) == D.end() && D.find(d) == D.end()){ | ^
s358090667
p04045
C++
#include <iostream> #include <vector> #include <string> #include <unordered_set> using namespace std; int main(void){ int N,K,i; cin << N >> K; string s; unordered_set(int) D; while(getline(cin, s, ' ')){ D.insert(stoi(s)); } int n = N; int a,b,c,d; for(;n < 10000;++n){ a = n / 1000; b = (n - 1000 * a) / 100; c = (n - 1000 * a - 100 * b) / 10; d = n - 1000 * a - 100 * b - 10 * c; if(D.find(a) == D.end() && D.find(b) == D.end() && D.find(c) == D.end() && D.find(d) == D.end()){ cout << n; break; } } }
a.cc: In function 'int main()': a.cc:9:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 9 | cin << N >> K; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:9:13: note: candidate: 'operator<<(int, int)' (built-in) 9 | cin << N >> K; | ~~~~^~~~ a.cc:9:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | cin << N >> K; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:9:9: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 9 | cin << N >> K; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | cin << N >> K; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:9:9: required from here 9 | cin << N >> K; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ a.cc:11:22: error: missing template arguments before '(' token 11 | unordered_set(int) D; | ^ a.cc:11:23: error: expected primary-expression before 'int' 11 | unordered_set(int) D; | ^~~ a.cc:13:17: error: 'D' was not declared in this scope 13 | D.insert(stoi(s)); | ^ a.cc:22:20: error: 'D
s419609139
p04045
C++
n, k = map(int,input().split()) d = list(map(str, input().split())) while(n>0): S = str(n) t = 0 for i in S: if i not in d: t += 1 if t == len(S): print(int(S)) break else: n += 1
a.cc:1:1: error: 'n' does not name a type 1 | n, k = map(int,input().split()) | ^
s551667271
p04045
C++
#include <bits/stdc++.h> using namespace std; bool check_digit(int arr[], int, int); int main(){ int K; string N; cin >> N >> K; int *arr = new int[K]; int num = 0; int c, flag = 0; for(int i = 0; N[i] != '\0'; i++){ c = (N[i] - '0')*pow(10,N.size()-i-1); num = num + c; } cout << num; for(int i = 0; i < K; i++){ cin >> arr[i]; } int digit; for(int i = num; ; i++){ for(int j = i; j != 0; j /= 10){ digit = j%10; if(!check_digit(arr, K, digit)){ break; } if(j < 10) flag = 1; } if(flag == 1){ cout << i; break; } } 1,24 Top
a.cc: In function 'int main()': a.cc:35:50: error: expected ';' before 'Top' 35 | 1,24 Top | ^ ~~~ | ; a.cc:35:63: error: expected '}' at end of input 35 | 1,24 Top | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s947561151
p04045
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K; cin>>N>>K; vector<int> D(K); for(int i=0;i<K;i++){ cin>>D.at(i); } while(1){ bool flag=true; do{ int x=N%10; for(int i=0;i<K;i++){ if(x==D.at(i)){ flag=false; break; } } if(!flag){ break; } N/=10; }while(N!=0); if(falg){ break; } N++; } cout<<N<<endl; }
a.cc: In function 'int main()': a.cc:28:8: error: 'falg' was not declared in this scope; did you mean 'flag'? 28 | if(falg){ | ^~~~ | flag
s149456471
p04045
C++
#include<bits/stdc++.h> #define ll long long #define mp make_pair #define F first #define S second #define db double #define pb push_back using namespace std; bool compare(const pair<ll,ll>&a,const pair<ll,ll>&b) { return a.second<b.second; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll tests=1; //cin>>tests; while(tests--) { ll n,k,i,t; cin>>n>>k; set<ll>like; for(i=0;i<k;i++){cin>>t;like.insert(t);} string ans; ll extra=0; ll small=0; while(small<10) { if(like.find(small)!=like.end()) small++; else {break;} } ll cnt=0; for(auto x:to_string(n)) { t=(int)x-48; if(extra) { ll tmp ans+=to_string(small); } else if(like.find(t)!=like.end()) { while(t<10) { if(like.find(t)!=like.end()) {t++;} else {ans=ans+to_string(t);break;} if(t==10) { if(cnt!=0) t=0; else t=1; extra++;} } } else {ans+=to_string(t);} cnt++; } if(extra) {ans+=to_string(small);} cout<<ans; } return 0; }
a.cc: In function 'int main()': a.cc:43:16: error: expected initializer before 'ans' 43 | ans+=to_string(small); | ^~~
s778920589
p04045
C++
#include <bits/stdc++.h> using namespace std; int main(){ int k,s,n; //string s; cin>>s>>k; vector<bool> v(10); while(k--){ cin>>n; v[n]=true; } n=s; for(;n<=100000;n++){ bool x = true; string ks = n.to_string(); for(int j=0;j<(int)ks.size();j++){ if(v[ks[j]-'0']) x=false; } if(x) break; } cout<<n; }
a.cc: In function 'int main()': a.cc:15:19: error: request for member 'to_string' in 'n', which is of non-class type 'int' 15 | string ks = n.to_string(); | ^~~~~~~~~