Language: C++

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;

class Scanner{
  string[] s;
  int i;
 
  char[] cs = new char[] { ' ' };
 
  public Scanner(){
    s = new string[0];
    i = 0;
  }
 
  public string next(){
    if (i < s.Length) return s[i++];
    string st = Console.ReadLine();
    while (st == "") st = Console.ReadLine();
    s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
    if (s.Length == 0) return next();
    i = 0;
    return s[i++];
  }
 
  public int nextInt(){
    return int.Parse(next());
  }
  public int[] ArrayInt(int N, int add = 0){
    int[] Array = new int[N];
    for (int i = 0; i < N; i++){
      Array[i] = nextInt() + add;
    }
    return Array;
  }
 
  public long nextLong(){
    return long.Parse(next());
  }
 
  public long[] ArrayLong(int N, long add = 0){
    long[] Array = new long[N];
    for (int i = 0; i < N; i++){
      Array[i] = nextLong() + add;
    }
    return Array;
  }
 
  public double nextDouble(){
    return double.Parse(next());
  }

  public double[] ArrayDouble(int N, double add = 0){
    double[] Array = new double[N];
    for (int i = 0; i < N; i++){
      Array[i] = nextDouble() + add;
    }
    return Array;
  }
}

public class procon {
  public procon(){}
  
  Scanner cin;
  public static int Main(){
    new procon().calc();
    return 0;
  }
  
  void calc(){
    cin=new Scanner();
    int N=cin.nextInt();
    int K=cin.nextInt();
    
    bool[] D=new bool[10];
    for(int i=0; i<10; ++i) D[i]=true;
    for(int i=0; i<K; ++i){
      int d=cin.nextInt();
      D[d]=false;
    }
    
    int ans=N;
    while(true){
      bool can=true;
      int tmp=ans;
      while(tmp>0){
        can&=D[tmp%10];
        tmp/=10;
      }
      if(can){
        Console.WriteLine(ans);
        break;
      }
      else{
        ++ans;
      }
    }
  }
}



















Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Linq;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.IO;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Text;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'System'
    7 | using System.Globalization;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'System'
    8 | using System.Diagnostics;
      |       ^~~~~~
a.cc:11:3: error: 'string' does not name a type
   11 |   string[] s;
      |   ^~~~~~
a.cc:14:7: error: expected unqualified-id before '[' token
   14 |   char[] cs = new char[] { ' ' };
      |       ^
a.cc:16:9: error: expected ':' before 'Scanner'
   16 |   public Scanner(){
      |         ^~~~~~~~
      |         :
a.cc:21:9: error: expected ':' before 'string'
   21 |   public string next(){
      |         ^~~~~~~
      |         :
a.cc:21:10: error: 'string' does not name a type
   21 |   public string next(){
      |          ^~~~~~
a.cc:31:9: error: expected ':' before 'int'
   31 |   public int nextInt(){
      |         ^~~~
      |         :
a.cc:34:9: error: expected ':' before 'int'
   34 |   public int[] ArrayInt(int N, int add = 0){
      |         ^~~~
      |         :
a.cc:34:13: error: expected unqualified-id before '[' token
   34 |   public int[] ArrayInt(int N, int add = 0){
      |             ^
a.cc:42:9: error: expected ':' before 'long'
   42 |   public long nextLong(){
      |         ^~~~~
      |         :
a.cc:46:9: error: expected ':' before 'long'
   46 |   public long[] ArrayLong(int N, long add = 0){
      |         ^~~~~
      |         :
a.cc:46:14: error: expected unqualified-id before '[' token
   46 |   public long[] ArrayLong(int N, long add = 0){
      |              ^
a.cc:54:9: error: expected ':' before 'double'
   54 |   public double nextDouble(){
      |         ^~~~~~~
      |         :
a.cc:58:9: error: expected ':' before 'double'
   58 |   public double[] ArrayDouble(int N, double add = 0){
      |         ^~~~~~~
      |         :
a.cc:58:16: error: expected unqualified-id before '[' token
   58 |   public double[] ArrayDouble(int N, double add = 0){
      |                ^
a.cc:65:2: error: expected ';' after class definition
   65 | }
      |  ^
      |  ;
a.cc: In constructor 'Scanner::Scanner()':
a.cc:17:5: error: 's' was not declared in this scope
   17 |     s = new string[0];
      |     ^
a.cc:17:13: error: 'string' does not name a type
   17 |     s = new string[0];
      |             ^~~~~~
a.cc: In member function 'int Scanner::nextInt()':
a.cc:32:12: error: expected primary-expression before 'int'
   32 |     return int.Parse(next());
      |            ^~~
a.cc:32:12: error: expected ';' before 'int'
a.cc:32:15: error: expected unqualified-id before '.' token
   32 |     return int.Parse(next());
      |               ^
a.cc: In member function 'long int Scanner::nextLong()':
a.cc:43:12: error: expected primary-expression before 'long'
   43 |     return long.Parse(next());
      |            ^~~~
a.cc:43:12: error: expected ';' before 'long'
a.cc:43:16: error: expected unqualified-id before '.' token
   43 |     return long.Parse(next());
      |                ^
a.cc: In member function 'double Scanner::nextDouble()':
a.cc:55:12: error: expected primary-expression before 'double'
   55 |     return double.Parse(next());
      |            ^~~~~~
a.cc:55:12: error: expected ';' before 'double'
a.cc:55:18: error: expected unqualified-id before '.' token
   55 |     return double.Parse(next());
      |                  ^
a.cc: At global scope:
a.cc:67:1: error: expected unqualified-id before 'public'
   67 | public class procon {
      | ^~~~~~