Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

//const int N=100*1000;
//const int mod=1e9+7;

#define int min3(int a,int b,int c){return min(a,min(b,c));}
#define int max3(int a,int b,int c){return max(a,max(b,c));}
#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin.tie(NULL);
    LL n,k,i,j;
    cin>>n>>k;
    string K;
    for(i=0; i<k; i++)
        cin>>K[i];
    LL a,b,cnt;
    for(;; n++)
    {
        a=n;
        cnt=0;
        while(a>0)
        {

            b=a%10;
            a/=10;
            for(i=0; i<k; i++)
            {
                if(b==K[i])
                {
                    cnt++;
                    break;
                }

            }
            if(cnt>0)
                break;
        }
        if(cnt==0)
            break;
    }
    if(cnt==0)
        cout<<n<<"\n";
    return 0;
}



Compiler output:
a.cc:47:9: warning: "int" redefined
   47 | #define int max3(int a,int b,int c){return max(a,max(b,c));}
      |         ^~~
a.cc:46:9: note: this is the location of the previous definition
   46 | #define int min3(int a,int b,int c){return min(a,min(b,c));}
      |         ^~~
a.cc:48:9: warning: "int" redefined
   48 | #define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
      |         ^~~
a.cc:47:9: note: this is the location of the previous definition
   47 | #define int max3(int a,int b,int c){return max(a,max(b,c));}
      |         ^~~
a.cc:49:9: warning: "int" redefined
   49 | #define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}
      |         ^~~
a.cc:48:9: note: this is the location of the previous definition
   48 | #define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
      |         ^~~
a.cc:49:13: error: ISO C++ forbids declaration of 'max4' with no type [-fpermissive]
   49 | #define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}
      |             ^~~~
a.cc:53:1: note: in expansion of macro 'int'
   53 | int main()
      | ^~~
a.cc:53:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   53 | int main()
      |     ^~~~