stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

const int N=101;



string arr[N];

int solve()

{

    long long n;

    cin>>n;

    cout<<n*(n+1)/2;

    return 0;

}



int main()

{

#ifndef ONLINE_JUDGE

    //freopen("input.txt" ,"r" ,stdin);

    //freopen("output.txt" ,"w" ,stdout);

#endif

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



   // int t;

   // cin>>t;

   // while(t--)

        solve();



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

#include<stdlib.h>

#include<string.h>



#define size 100005



int main()

{

    int n, sum;

    scanf("%d", &n);

    sum = n*(n+1)/2;

    printf("%d\n", sum);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



#define fst(t) std::get<0>(t)

#define snd(t) std::get<1>(t)

#define thd(t) std::get<2>(t)



using P = std::tuple<int,int>;

using ll = long long;



const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};



int main(){

    //*

    std::cin.tie(nullptr);

    std::ios::sync_with_stdio(false);

    /*/

      /*/



    int N;

    cin >> N;



    std::cout << N * (N+1) / 2 << std::endl;

}


// Optimized solution to the same problem (faster):
#include <cstdio>



int main(){

  int n;

  scanf("%d", &n);



  printf("%d\n", n * (n+1) / 2);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):


#include<bits/stdc++.h>

#define lln long long int

#define llu unsigned lln

#define sc(n) scanf("%d",&n);

#define scl(n) scanf("%lld",&n);

#define scd(n) scanf("%lf",&n);

#define pf(res) printf("%d\n",res);

#define pfl(res) printf("%lld\n",res);

#define pfd(res) printf("%lf\n",res);

#define maxii 100005

using namespace std;

typedef pair<int,int> pii;

typedef pair<lln,lln> pll;

 vector<int> vi[maxii];

 vector<int>:: iterator child;

typedef vector<lln> vl;

typedef vector<pii> vii;

typedef vector<pll> vll;





int arr[maxii];

int arr2[maxii];

bool check[maxii];



bool dfs(int node,int c)

{

    check[node]=true;

    arr2[node]=c;

    for(int child=0;child<vi[node].size();child++)

    {

        if(check[vi[node][child]]==false)

        {

            if(dfs(vi[node][child],c^1)==false)

            {

                return false;

            }

        }

        else if(arr2[node]==arr2[vi[node][child]])

        {

            return false;

        }

        //else if()

    }

    return true;

}



int main()

{

    int n;

    cin>>n;

    int res=n*(n+1);

    res/=2;

    cout<<res;



}










// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	int k,p;

	scanf ("%d", &k); 

	 

	// k = kids, p=permen;

	p= (k*(k+1)/2);

	printf ("%d", p);



return 0; 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <map>

#include <cstdio>

#include <vector>

#include <iostream>

#include <algorithm>

#define LL long long

using namespace std;

const int MAXN = 2e5+55;

int vis[MAXN];

int main()

{

   int n;

   cin>>n;

   cout<<1ll*n*(n+1)/2;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	int k,p;

	scanf ("%d", &k); 

	 

	// k = kids, p=permen;

	p= (k*(k+1)/2);

	printf ("%d", p);



return 0; 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <algorithm>

#include <iostream>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <cctype>

#include <queue>

#include <map>

#include <string>

#include <vector>

#include <set>

#include <math.h>

#include <stack>

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include <time.h>

#define ll long long

#define chushihua(x,y) memset(x,y,sizeof x)

using namespace std;

const int MAXX = 100000 + 10;

const double PI = 3.14159265358979323846;

const ll mod = 1000000007;

int main() {

	int a, b, c;

	while (cin >> a) {

		cout << a * (a + 1) / 2 << endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	int k,p;

	scanf ("%d", &k); 

	 

	// k = kids, p=permen;

	p= (k*(k+1)/2);

	printf ("%d", p);



return 0; 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    long long int n;

    cin>>n;

    cout<<(n*(n+1))/2<<endl;

    return 0;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	int k,p;

	scanf ("%d", &k); 

	 

	// k = kids, p=permen;

	p= (k*(k+1)/2);

	printf ("%d", p);



return 0; 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

	

	long long sum=0,n;

	cin>>n;

		

			sum= n*(n+1)/2;

			cout<<sum;



	



	

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main (){

	int k,p;

	scanf ("%d", &k); 

	 

	// k = kids, p=permen;

	p= (k*(k+1)/2);

	printf ("%d", p);



return 0; 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include<algorithm>

using namespace std;

int main()

{

    int n;

    cin>>n;

    cout<<(n*(1+n))/2;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int n,total;

    scanf("%d",&n);

    total=(n*(n+1))/2;

    printf("%d",total);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

using namespace std;

int main(){

	

	int n;

	cin>>n;

	cout<<n*(n+1)/2<<"\n";

	

	return 0;

	}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int n,total;

    scanf("%d",&n);

    total=(n*(n+1))/2;

    printf("%d",total);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <algorithm>

#include <climits>

using namespace std ;



int main(){

    std::ios_base::sync_with_stdio(0);  cin.tie(NULL);  cout.tie(NULL);

    long long  n ;

    cin >> n ;

    cout << n * (n + 1 ) / 2 ;

    return 0 ;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int n,total;

    scanf("%d",&n);

    total=(n*(n+1))/2;

    printf("%d",total);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

using namespace std;



int main()

{

	ios::sync_with_stdio(false);

	cin.tie(0);

	unsigned long long a;

	cin >> a;

	cout << a * (a + 1) / 2 << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int N;

	scanf("%d", &N);

	printf("%d",N=N*(N+1)/2);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    int n;

    cin>>n;

    cout<<n*(n+1)/2<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int N;

	scanf("%d", &N);

	printf("%d",N=N*(N+1)/2);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    long long int n;

    cin>>n;

    cout<<(n*(n+1))/2<<endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() 

{

  int N;

  scanf("%d", &N);

  printf("%d\n", N*(N + 1)/2);

  

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long int

using namespace std;

int main()

{

    ll t,a,b,c,i,j,k,n;





    cin>>n;

    cout<<(n*(n+1))/2<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() 

{

  int N;

  scanf("%d", &N);

  printf("%d\n", N*(N + 1)/2);

  

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);



    int n;

    cin >> n;

    cout << n*(n+1)/2;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() 

{

  int N;

  scanf("%d", &N);

  printf("%d\n", N*(N + 1)/2);

  

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

using namespace std;



const int maxn = 500000 + 5;



struct Node{

	int value;

	Node *Left_Child,*Right_Child;

}pool[maxn],*tail = pool;



Node *root,*NUL;



void Insert(int key){

	Node *x = tail++;

	Node *fa = NUL;

	Node *cur = root;

	

	x->value = key;

	x->Left_Child = NUL;

	x->Right_Child = NUL;

	

	while(cur != NUL){

		fa = cur;

		if(cur->value > x->value)cur = cur->Left_Child;

		else cur = cur->Right_Child;

	}

	

	if(fa == NUL)root = x;

	else {

		if(fa->value > x->value)fa->Left_Child = x;

		else fa->Right_Child = x;

	}

}



void Preorder(Node *cur){

	if(cur == NUL)return;

	printf(" %d",cur->value);

	Preorder(cur->Left_Child);

	Preorder(cur->Right_Child);

}



void Inorder(Node *cur){

	if(cur == NUL)return;

	Inorder(cur->Left_Child);

	printf(" %d",cur->value);

	Inorder(cur->Right_Child);

}



bool find(int key){

	Node *cur = root;

	while(cur != NUL){

		if(cur->value > key)cur = cur->Left_Child;

		else if(cur->value < key)cur = cur->Right_Child;

		else return true;

	}

	return false;

}



int main(){

	int n;

	scanf("%d",&n);

	for(int i = 1;i <= n; i++){

		char s[15];

		scanf("%s",s);

		if(strcmp(s,"insert") == 0){

			int key;

			scanf("%d",&key);

			Insert(key);

		}

		else if(strcmp(s,"print") == 0){

			Inorder(root);

			printf("\n");

			Preorder(root);

			printf("\n");

		}

		else {

			int key;

			scanf("%d",&key);

			if(find(key))printf("yes\n");

			else printf("no\n");

		}

	}

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<ctime>

#define MAXN 500000

struct node

{

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root,*NIL,*ncnt;

//bool first=true;

void Init()

{

	NIL=&tree[0];

	ncnt=&tree[1];

	Root=NIL;

}

inline node *NewNode(int val)

{

	node *p=++ncnt;

	p->key=val;

	p->ch[0]=p->ch[1]=NIL;

	return p;

}

void Insert(node *&rt,int val)

{

	if(rt==NIL)

	{

		rt=NewNode(val);

		return;

	}

	int d=(val>=rt->key);

	Insert(rt->ch[d],val);

}

void PreOrder(node *&rt)

{

	if(rt==NIL)

		return;

//	if(first==true)

//		printf("%d",rt->key),first=false;

//	else

		printf(" %d",rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *&rt)

{

	if(rt==NIL)

		return;

	InOrder(rt->ch[0]);

//	if(first==true)

//		printf("%d",rt->key),first=false;

//	else

		printf(" %d",rt->key);

	InOrder(rt->ch[1]);

}

node *Find(node *rt,int val)

{

	if(rt==NIL)

		return NIL;

	if(rt->key==val)

		return rt;

	int d=(val>rt->key);

	return Find(rt->ch[d],val);

}

int main()

{

	Init();

	int n,x;

	char op[100];

	scanf("%d",&n);

	for(int i=0;i<n;i++)

	{

		scanf("%s",op);

		if(op[0]=='i')

			scanf("%d",&x),Insert(Root,x);

		else if(op[0]=='p')

		{

			InOrder(Root);

			printf("\n");

			PreOrder(Root);

			printf("\n");

		}

		else if(op[0]=='f')

		{

			scanf("%d",&x);

			if(Find(Root,x)==NIL)

				printf("no\n");

			else

				printf("yes\n");

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<vector>

#include<cstdlib>

#include<iostream>

using namespace std;

struct Node{

Node *parent,*left,*right;

int key;

};

Node *NIL,*root;

Node *find(Node*u,int k){

   while(u!=NIL&&k!=u->key){

    if(k<u->key)u=u->left;

    else u=u->right;

   }

   return u;

}



void prin_in(Node* node){

    if(node==NIL)return;

    prin_in(node->left);

    printf(" %d",node->key);

    prin_in(node->right);

}

void prin_pre(Node* node){

    if(node==NIL)return;

    printf(" %d",node->key);

    prin_pre(node->left);

    prin_pre(node->right);



}

void insert(int key)

{

    Node *y=NIL;

    Node *x=root;

    Node *z;

    z=(Node*)malloc(sizeof(Node));

    z->key=key;

    z->left=NIL;

    z->right=NIL;

    while(x!=NIL){

        y=x;

        if(z->key<x->key)

           x=x->left;

        else

            x=x->right;

    }

    z->parent=y;

    if(y==NIL){

        root=z;

    } else{

            if(z->key<y->key)

                y->left=z;

            else {

                y->right=z;

            }

    }

}

int main(){

   int n,i,x;

   string s;

   scanf("%d",&n);

   for(int i=0;i<n;i++)

   {

       cin>>s;

       if(s[0]=='i'){

        scanf("%d",&x);

        insert(x);

       }

       else if(s[0]=='f'){

        scanf("%d",&x);

        Node*t=find(root,x);

        if(t!=NIL)printf("yes\n");

        else printf("no\n");

       }

       else if(s[0]=='p'){

       prin_in(root);

       printf("\n");

       prin_pre(root);

       printf("\n");

       }

   }

   return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<ctime>

#define MAXN 500000

struct node

{

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root,*NIL,*ncnt;

//bool first=true;

void Init()

{

	NIL=&tree[0];

	ncnt=&tree[1];

	Root=NIL;

}

inline node *NewNode(int val)

{

	node *p=++ncnt;

	p->key=val;

	p->ch[0]=p->ch[1]=NIL;

	return p;

}

void Insert(node *&rt,int val)

{

	if(rt==NIL)

	{

		rt=NewNode(val);

		return;

	}

	int d=(val>=rt->key);

	Insert(rt->ch[d],val);

}

void PreOrder(node *&rt)

{

	if(rt==NIL)

		return;

//	if(first==true)

//		printf("%d",rt->key),first=false;

//	else

		printf(" %d",rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *&rt)

{

	if(rt==NIL)

		return;

	InOrder(rt->ch[0]);

//	if(first==true)

//		printf("%d",rt->key),first=false;

//	else

		printf(" %d",rt->key);

	InOrder(rt->ch[1]);

}

node *Find(node *rt,int val)

{

	if(rt==NIL)

		return NIL;

	if(rt->key==val)

		return rt;

	int d=(val>rt->key);

	return Find(rt->ch[d],val);

}

int main()

{

	Init();

	int n,x;

	char op[100];

	scanf("%d",&n);

	for(int i=0;i<n;i++)

	{

		scanf("%s",op);

		if(op[0]=='i')

			scanf("%d",&x),Insert(Root,x);

		else if(op[0]=='p')

		{

			InOrder(Root);

			printf("\n");

			PreOrder(Root);

			printf("\n");

		}

		else if(op[0]=='f')

		{

			scanf("%d",&x);

			if(Find(Root,x)==NIL)

				printf("no\n");

			else

				printf("yes\n");

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

struct Node{

	int data;

	Node *left;

	Node *right;

	Node(int val=0){

		data=val;

		left=NULL;

		right=NULL;

	}

};

Node *root;

void insert(Node *&root,int x){

	if(root==NULL){

		root=new Node(x);

		return;

	}

	else{

		if(x==root->data) return;

		else if(x<root->data) insert(root->left,x);

		else insert(root->right,x);

	}

	return;

}

void Inorder(Node *node){

	if(node==NULL) return;

	Inorder(node->left);

	cout<<' '<<node->data;

	Inorder(node->right);

}

void Preorder(Node *node){

	if(node==NULL) return;

	cout<<' '<<node->data;

	Preorder(node->left);

	Preorder(node->right);

}

bool find(Node *&root,int x){

	if(root==NULL) return false;

	if(root->data==x) return true;

	else if(root->data<x){

		return find(root->right,x);

	}

	else{

		return find(root->left,x);

	}

}

int main(){

	root=NULL;

	int m;

	cin>>m;

	while(m--){

		string str;

		cin>>str;

		if(str[0]=='i'){

			int data;

			cin>>data;

			insert(root,data);

		}

		else if(str[0]=='f'){

			int data;

			cin>>data;

			if(find(root,data)) cout<<"yes"<<endl;

			else cout<<"no"<<endl;

		}

		else{

			Inorder(root);

			cout<<endl;

			Preorder(root);

			cout<<endl;

		}

	}

} 

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<ctime>

#define MAXN 500000

struct node

{

	int key;

	node *ch[2];

};

node tree[MAXN+5];

node *Root,*NIL,*ncnt;

//bool first=true;

void Init()

{

	NIL=&tree[0];

	ncnt=&tree[1];

	Root=NIL;

}

inline node *NewNode(int val)

{

	node *p=++ncnt;

	p->key=val;

	p->ch[0]=p->ch[1]=NIL;

	return p;

}

void Insert(node *&rt,int val)

{

	if(rt==NIL)

	{

		rt=NewNode(val);

		return;

	}

	int d=(val>=rt->key);

	Insert(rt->ch[d],val);

}

void PreOrder(node *&rt)

{

	if(rt==NIL)

		return;

//	if(first==true)

//		printf("%d",rt->key),first=false;

//	else

		printf(" %d",rt->key);

	PreOrder(rt->ch[0]);

	PreOrder(rt->ch[1]);

}

void InOrder(node *&rt)

{

	if(rt==NIL)

		return;

	InOrder(rt->ch[0]);

//	if(first==true)

//		printf("%d",rt->key),first=false;

//	else

		printf(" %d",rt->key);

	InOrder(rt->ch[1]);

}

node *Find(node *rt,int val)

{

	if(rt==NIL)

		return NIL;

	if(rt->key==val)

		return rt;

	int d=(val>rt->key);

	return Find(rt->ch[d],val);

}

int main()

{

	Init();

	int n,x;

	char op[100];

	scanf("%d",&n);

	for(int i=0;i<n;i++)

	{

		scanf("%s",op);

		if(op[0]=='i')

			scanf("%d",&x),Insert(Root,x);

		else if(op[0]=='p')

		{

			InOrder(Root);

			printf("\n");

			PreOrder(Root);

			printf("\n");

		}

		else if(op[0]=='f')

		{

			scanf("%d",&x);

			if(Find(Root,x)==NIL)

				printf("no\n");

			else

				printf("yes\n");

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/****************************

 * ×÷Õß£ºzxf

 * ÈÕÆÚ£º2017/8/8

 * ±êÌâ£º¤³¤À¤ï¤êÕß¤¤¤í¤Ï¤Á¤ã¤ó / Iroha's Obsession

 * ÌâºÅ£ºARC058C

 * ×öÌâ·½·¨£º...

 * ½á¹û£º

 * Time used£º

 * Memory used£º

 ****************************/

#include <algorithm>

#include <bitset>

#include <cassert>

#include <cctype>

#include <cmath>

#include <complex>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <deque>

#include <fstream>

#include <functional>

#include <iomanip>

#include <iostream>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <string>

#include <utility>

#include <vector>

#define LL long long

#define pb push_back

#define pob pop_back

#define mp make_pair

#define FILL(a,v) memset((void*)a,v,sizeof(a))

#define FILL0(a) FILL(a,0)

#define FILL1(a) FILL(a,-1)

#define ALL(a) (a).begin(),(a).end()

#define Inf 1e9

#define Mod 1000000007

#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)

#define FOR(i,x) for(int i=0;i<x;i++)

#define RFOR(i,x) for(int i=x-1;i>=0;i--)

#define FFOR(i,a,b) for(int i=a;i<b;i++)

#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)

#define SZ(a) ((int)(a).size())

#define FI first

#define SE second

#define OVER(a) return puts(a),0

#define fastio ios::sync_with_stdio(0)

#define filei(f) freopen(f,"r",stdin)

#define fileo(f) freopen(f,"w",stdout)

using namespace std;

typedef pair<int,int> pii;

typedef unsigned long long UINT;

typedef unsigned int Uint;

typedef long long INT;

typedef pair<INT,INT> PII;

typedef stringstream sst;

typedef istringstream iss;

typedef vector<int> vint;

typedef vector<INT> VINT;

typedef vector<pii> vpii;

typedef vector<PII> VPII;

typedef priority_queue<int> pqi;

typedef priority_queue<INT> PQI;

typedef priority_queue<pii> pqp;

typedef priority_queue<PII> PQP;

typedef priority_queue<int,vint,greater<int> > xqi;

typedef priority_queue<INT,VINT,greater<INT> > XQI;

typedef priority_queue<pii,vpii,greater<pii> > xqp;

typedef priority_queue<PII,VPII,greater<PII> > XQP;



int n,m;

char s[10];

set<char> cant;



int main()

{

	scanf("%d%d",&n,&m);

	int c;

	for(int i=0;i<m;i++)

	{

		scanf("%d",&c);

		cant.insert(c+'0');

	}

	while(1)

	{

		sprintf(s,"%d",n);

		int can=1;

		for(int i=0;i<strlen(s);i++)

			if(cant.count(s[i]))

				can=0;

		if(can==1)return printf("%d\n",n),0;

		n++;

	}

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>

#define MAX_N 10000

#define MAX_k 9

int N, k;

int D[MAX_k];

int check(int a){

    int i, j, n, m;

n=a;

while(n!=0){

        m = n%10;

        for (j=0; j<k; j++)

            if (m==D[j]) return 1;

            n/=10;

}

    return 0;

}

int main(){

    int i;

    scanf("%d%d", &N, &k);

    for (i=0; i<k; i++)

        scanf("%d", &D[i]);

    i=N;

    while (1)

    {

        if(check(i)==0)break;

        else

        {

            i++;

        }

    }

    printf("%d\n", i);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <set>

#include <cstring>

using namespace std;

 

int n,k;

set<int> dlike;

 

inline bool ok(int x)

{

	while(x>0)

	{

		if(dlike.count(x%10)) return 0;

		x/=10;

	}

	return 1;

}

 

int main()

{

	cin>>n>>k;

	for(int i=0;i<k;i++)

	{

		int a;

		cin>>a;

		dlike.insert(a);

	}

	

	for(int i=n;i<100000;i++) if(ok(i)) {cout<<i;exit(0);}

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>

#define MAX_N 10000

#define MAX_k 9

int N, k;

int D[MAX_k];

int check(int a){

    int i, j, n, m;

n=a;

while(n!=0){

        m = n%10;

        for (j=0; j<k; j++)

            if (m==D[j]) return 1;

            n/=10;

}

    return 0;

}

int main(){

    int i;

    scanf("%d%d", &N, &k);

    for (i=0; i<k; i++)

        scanf("%d", &D[i]);

    i=N;

    while (1)

    {

        if(check(i)==0)break;

        else

        {

            i++;

        }

    }

    printf("%d\n", i);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <algorithm>

#include <iostream>

using namespace std;



int n, k;

bool dislike[10];



inline bool Check(int x) {

  do {

    if (dislike[x % 10])

      return false;

  } while (x /= 10);

  return true;

}



int main() {

  ios::sync_with_stdio(false);

  cin >> n >> k;

  for (int i = 1, x; i <= k; ++i) {

    cin >> x;

    dislike[x] = true;

  }

  for (; n; ++n) {

    if (Check(n)) {

      cout << n << endl;

      break;

    }

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>

#define MAX_N 10000

#define MAX_k 9

int N, k;

int D[MAX_k];

int check(int a){

    int i, j, n, m;

n=a;

while(n!=0){

        m = n%10;

        for (j=0; j<k; j++)

            if (m==D[j]) return 1;

            n/=10;

}

    return 0;

}

int main(){

    int i;

    scanf("%d%d", &N, &k);

    for (i=0; i<k; i++)

        scanf("%d", &D[i]);

    i=N;

    while (1)

    {

        if(check(i)==0)break;

        else

        {

            i++;

        }

    }

    printf("%d\n", i);

    return 0;

}


// Fastest known solution for this problem: