Language: C++

#include <iostream>
#include <cstdlib>

using namespace std;

void otsuri(int seikyu, int *ten, int *fif, int *hund, int *f_hund);

int main(void)
{
	int seikyu;
	int in_ten;
	int in_fif;
	int in_hund;
	int in_f_hund;

	int out_ten;
	int out_fif;
	int out_hund;
	int out_f_hund;

	int ten;
	int fif;
	int hund;
	int f_hund;

	int hasu;

	int i1,i2;
    
    int m;


    while(1){

		cin >> seikyu;
		cin >> in_ten >> in_fif >> in_hund >> in_f_hund;

		if(seikyu==0) break;

		/* syokika */
		out_ten = 0;
		out_fif = 0;
		out_hund = 0;
		out_f_hund = 0;


		/* 10 */
		hasu = (seikyu%50)/10;

		if (hasu <= in_ten) {
			out_ten += hasu;
			in_ten -= hasu;
			seikyu -= hasu*10;
			hasu = 0;

			//cout << "a" << seikyu <<out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;

			m = seikyu/50;
			for(i1=0; i1<m; i1++){
				if( 5 <= in_ten) {
					out_ten += 5;
					in_ten -= 5;
					seikyu -= 50;

				//cout << "b" << seikyu <<out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;

				}
				else break;
			}

		}
		
		//cout << "c" << seikyu << out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;

	   /* 50 */
		m = seikyu/50;
		for(i1=0; i1<m;i1++){
			if ( 0 <  in_fif){
				out_fif++;
				in_fif--;
				seikyu -= 50;
			//	cout << "d" << seikyu << out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;

			}
			else break;
		}

	    /* 100 */
	    m = seikyu/100;
	    for(i1=0; i1<m; i1++){
	    	if( 0<in_hund){
	    		out_hund++;
	    		in_hund--;
	    		seikyu -= 100;
	    	//	cout << "e" << seikyu << out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;

	    	}
	    	else break;
	    }

	    /* 500 */
	    m = seikyu/500;
	    for(i1=0; i1<m; i1++){
	    	if (0<in_f_hund){
	    		out_f_hund++;
	    		in_f_hund--;
	    		seikyu -= 500;
	    	//	cout << "f" << seikyu << out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;

	    	}
	    	else break;
	    }
	    
		//cout << "m" << seikyu << out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;


		/* nokori */
		if (seikyu == 0){
		//	cout << "b" << endl;
			if (out_ten >0) cout << "10" << " " << out_ten << endl;
			if (out_fif>0) cout << "50" << " " << out_fif << endl;
			if (out_hund>0) cout << "100" << " " << out_hund << endl;
			if (out_f_hund>0) cout << "500" << " " << out_f_hund << endl;
		}
		else {
			
			if (seikyu < in_fif*50){
				in_fif--;
				out_fif++;
				seikyu -= 50;
			}
			else if (seikyu < in_hund*100){
				in_hund--;
				out_hund++;
				seikyu -= 100;
				
			}
			else{
				in_f_hund--;
				out_f_hund++;
				seikyu -= 500;
			}
			//cout << "a" << endl;
		//cout << "m" << seikyu << out_ten << " " << out_fif << " " << out_hund << " " << out_f_hund << endl;

			otsuri(seikyu,&ten,&fif,&hund,&f_hund);
		//	cout << "a" << endl;
			if (out_ten>0){
				out_ten -= ten;
			}
			if (out_fif>0){
				out_fif -= fif;
			}
			if (out_hund>0){
				out_hund -= hund;
			}
			if (out_f_hund>0){
				out_f_hund -= f_hund;
			}

			if (out_ten >0) cout << "10" << " " << out_ten << endl;
			if (out_fif>0) cout << "50" << " " << out_fif << endl;
			if (out_hund>0) cout << "100" << " " << out_hund << endl;
			if (out_f_hund>0) cout << "500" << " " << out_f_hund << endl;

		}

		cout << endl;A

	}
//	cout << "d" << endl;

	return 0;
}



void otsuri(int seikyu,int *ten, int *fif, int *hund, int *f_hund)
{
	seikyu = abs(seikyu);
	

	*f_hund = seikyu/500;
	seikyu -= (*f_hund)*500;
	*hund = seikyu/100;
	seikyu -= (*hund)*100;
	*fif = seikyu/50;
	seikyu -= (*fif)*50;
	*ten = seikyu/10;
	seikyu -= (*ten)*10;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:168:30: error: 'A' was not declared in this scope
  168 |                 cout << endl;A
      |                              ^