Language: C++

#include<iostream>
#include<vector>

using namespace std;

int pow(int x,int y){
	if(y==0) return 1;
	return pow(x,y-1)*x;
}

int make_max(int x,int y){

	int keta=pow(10,y-1);
	int ans=0;

	for(int i=9;i>=0;i--){
		for(int j=0;j<=y;j++){
			if((x/pow(10,j))%10==i){
				ans+=i*keta;
				keta/=10;
			}
		}
	}

	return ans;
}

int make_small(int x,int y){

	int keta=pow(10,y);
	int ans=0;

	for(int i=0;i<=9;i++){
		for(int j=0;j<=y;j++){
			if((x/pow(10,j))%10==i){
				ans+=i*keta;
				keta/=10;
			}
		}
	}

	return ans;
}

int main(){

	int x,l;
	vector<int> data;
	int i;

	while(1){
		cin>>x>>l;
		if(x==0&&l==0) break;
		if(!data.empty()) data.clear();

		data.push_back(x);
		i=1;
		while(1){
			x=make_max(x,l)-make_small(x,l);
			if(find(data.begin(),data.end(),x)!=data.end()){
				break;
			}
			data.push_back(x);
			i++;
		}
		cout<<distance(data.begin(),find(data.begin(),data.end(),x))<<" "<<x<<" "<<i-distance(data.begin(),find(data.begin(),data.end(),x))<<endl;
	}
 
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:60:32: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   60 |                         if(find(data.begin(),data.end(),x)!=data.end()){
      |                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
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:60:32: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   60 |                         if(find(data.begin(),data.end(),x)!=data.end()){
      |                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:66:49: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   66 |                 cout<<distance(data.begin(),find(data.begin(),data.end(),x))<<" "<<x<<" "<<i-distance(data.begin(),find(data.begin(),data.end(),x))<<endl;
      |                                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:66:49: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   66 |                 cout<<distance(data.begin(),find(data.begin(),data.end(),x))<<" "<<x<<" "<<i-distance(data.begin(),find(data.begin(),data.end(),x))<<endl;
      |                                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:66:120: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   66 |                 cout<<distance(data.begin(),find(data.begin(),data.end(),x))<<" "<<x<<" "<<i-distance(data.begin(),find(data.begin(),data.end(),x))<<endl;
      |                                                                                                                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:66:120: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   66 |                 cout<<distance(data.begin(),find(data.begin(),data.end(),x))<<" "<<x<<" "<<i-distance(data.begin(),find(data.begin(),data.end(),x))<<endl;
      |                                                                                                                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~