Problem:
Problem A:
Summer of KMC
Description
KMCはコミックマーケットと呼ばれる同人即売会で毎年CDを販売している。
コミックマーケットでCDを売ることになったFであったが、Fの人気により、KMCの売り場には人が殺到し、お釣りの計算が追いつかない状態となった。そこでFは金額を入力すると即座にお釣りを出力するプログラムを書くことにした。
KMCが釣り銭として用意しているのは、100円玉と500円玉と1000円札のみである。これらの硬貨・札は無限にあるものと考えて良い。お釣りは、硬貨・札の個数が最小になるように選ぶ。また、KMCが販売するCDの値段は100の倍数であり、購入者が支払う金額も100の倍数である。
Input
入力は複数のテストケースから成る。
各テストケースは2つの正整数A, Bから成る。AはCDの値段であり、Bは購入者が支払った金額である。A, Bは100の倍数であり、100000000を超えない。また、A ≦ B である。
入力は0 0で終わる。
Output
各テストケースに対して、お釣りとして差し出すべき 100円玉、500円玉、1000円札の個数・枚数を一行でこの順番に出力する。各数字の間にはスペースを1つ入れる。
Sample Input
500 1000
100 10000
400 700
600 5000
10000 10000
0 0
Output for Sample Input
0 1 0
4 1 9
3 0 0
4 0 4
0 0 0

Submitted solutions:

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    while(cin >> A >> B, A or B)
    {
        int coins[] = {1000, 500, 100};
        vector<int> cnt(3, 0);
        int M = B - A;
        int pos = 0;
        while(M > 0)
        {
            if(M - coins[pos] >= 0)
            {
                cnt[pos]++;
                M -= coins[pos];
            }
            else pos++;
        }
        for(int i = 2; i >= 0; i--)
        {
            if(i != 2) cout << " ";
            cout << cnt[i];
        }
        cout << endl;
    }
    return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 3128
final_rank: 20

code_snippet: #include<bits/stdc++.h>

using namespace std;

int main()
{
  while(1){
    int A,B;
    cin>>A;
    cin>>B;

    if(A == 0 && B == 0){
      break;
    }

    int money = B - A;
    int thousand = 0;
    int fhundred = 0;
    int hundred = 0;

    if(money >= 1000){
      while(1){
        ++thousand; 
        money = money - 1000;
        if(money < 1000){
          break;
        }
      }
    }

    if(money >= 500){
      while(1){
        ++fhundred; 
        money = money - 500;
        if(money < 500){
          break;
        }
      }
    }

    if(money >= 100){
      while(1){
        ++hundred; 
        money = money - 100;
        if(money < 100){
          break;
        }
      }
    }

    cout<<hundred<<" "<<fhundred<<" "<<thousand<<endl;
  }

  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3072
final_rank: 16

code_snippet: #include<bits/stdc++.h>

using namespace std;

int main(){

  int a,b;

  while(cin>>a>>b,a||b){
	int change=b-a;
	int c100=0;
	int c500=0;
	int c1000=0;

	while(1){
	  if(change/1000==0)
		break;
	  else{
		c1000++;
		change-=1000;
	  }
	}

	while(1){
	  if(change/500==0)
		break;
	  else{
		c500++;
		change-=500;
	  }
	}

	while(1){
	  if(change/100==0)
		break;
	  else{
		c100++;
		change-=100;
	  }
	}

	cout<<c100<<" "<<c500<<" "<<c1000<<endl;
	
  }
  
}
accuracy: 1
time_ms: 10
memory_kb: 3080
final_rank: 18

code_snippet: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables ***************/
int a, b;
int hyaku, gohyaku, sen;
/**********************************************/

int main(){
    while(cin >> a >> b, a && b){
        hyaku = 0; gohyaku = 0; sen = 0;
        int zan = b - a;
        while(zan != 0){
            if(zan - 1000 >= 0){
                zan -= 1000;
                sen++;
            }else if(zan - 500 >= 0){
                zan -= 500;
                gohyaku++;
            }else{
                zan -= 100;
                hyaku++;
            }
        }
        cout << hyaku << " " << gohyaku << " " << sen << endl;
    }

}
accuracy: 1
time_ms: 10
memory_kb: 3076
final_rank: 17

code_snippet: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
using namespace std;
int main() {
	int a, b;
	while(cin>>a>>b&&a!=0&&b!=0){
		int h = 0, g = 0, s = 0,o=b-a;
		while (o >= 1000) {
			s++;
			o -= 1000;
		}
		while (o >= 500) {
			g++;
			o -= 500;
		}
		while (o >= 100) {
			h++;
			o -= 100;
		}
		cout << h << " " << g << " " << s << endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 3060
final_rank: 15

code_snippet: #include <cstdio>

int main(){
	int a,b;
	while(scanf("%d %d", &a, &b)){
		if(a == 0 and b == 0) break;
		b -= a;
		int sen = 0, ghy = 0, hya = 0;
		while(b >= 1000){
			b -= 1000;
			sen++;
		}
		while(b >= 500){
			b -= 500;
			ghy++;
		}
		while(b >= 100){
			b -= 100;
			hya++;
		}
		printf("%d %d %d\n", hya, ghy, sen);
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1028
final_rank: 2

code_snippet: #include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	long a,b,x,y,z;
	while(1){
		cin >> a >> b;
		if((a==0)&&(b==0)){
			return 0;
		}
		a=(b-a)/100;
		for(x=0;a>=10;x++){
			a-=10;
		}
		for(y=0;a>=5;y++){
			a-=5;
		}
		for(z=0;a>=1;z++){
			a-=1;
		}
		cout << z <<" "<< y <<" "<<x<<"\n";
	}
return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <cstdio>

int c[3]={1000,500,100};
int cnt[3];
int main(void){
	while(1){
		int a,b;
		scanf("%d %d",&a,&b);
		if(a+b==0)break;
		int rest=b-a;
		for(int i=0;i<3;i++){
			cnt[i]=0;
			while(rest>=c[i]){
				cnt[i]++;
				rest-=c[i];
			}
		}
		printf("%d %d %d\n",cnt[2],cnt[1],cnt[0]);
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1024
final_rank: 1

code_snippet: #include <iostream>
using namespace std;

int main() {

  int A,B;
  while(1) {
  cin >> A >> B;
  if(A == 0 && B == 0) break;

  int ans[3] ={};
  B -= A;
  while(B != 0) {
    if(B >= 1000) {
      ans[2]++;
      B -= 1000;
    }
    else if(B >= 500) {
      ans[1]++;
      B -= 500;
    }
    else if(B >= 100) {
      ans[0]++;
      B -=100;
    }
  }

  cout << ans[0] <<" "<<ans[1]<<" "<<ans[2]<<endl;
  }

  return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 1160
final_rank: 8

code_snippet: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int m[3]={1000,500,100};
int main(){
  int a,b;
  while(cin>>a>>b,a||b){
    int tmp=b-a;
    int ans[3]={0};
    rep(i,3){
      while(tmp>=m[i]){
	tmp-=m[i];
	ans[i]++;
      }
    }
    cout<<ans[2]<<" "<<ans[1]<<" "<<ans[0]<<endl;
  }
}
accuracy: 1
time_ms: 20
memory_kb: 1164
final_rank: 13

code_snippet: #include<iostream>
using namespace std;

int main(){
	int c[3];
	int a,b;
	while(cin>>a>>b,a!=0&&b!=0){
		for(int i=0;i<3;i++)c[i]=0;
		b-=a;
		while(1000<=b){b-=1000;c[2]++;}
		while(500<=b){b-=500;c[1]++;}
		while(0<b){b-=100;c[0]++;}
		
		for(int i=0;i<2;i++)cout<<c[i]<<" ";
		cout<<c[2]<<endl;
	}


}
accuracy: 1
time_ms: 20
memory_kb: 1160
final_rank: 8

code_snippet: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int a, b;
  int coin[3] = {1000, 500, 100};
  int num[3];

  while(1) {
    cin >> a >> b;
    if(a+b == 0) break;

    int money = b-a;
    fill(num, num+3, 0);

    REP(i, 3) {
      if(money/coin[i] > 0) {
	while(money/coin[i] != 0) {
	  money -= coin[i];
	  num[i]++;
	}
      }
    }
    cout << num[2] << ' ' << num[1] << ' ' << num[0] << endl;
  }
}
accuracy: 1
time_ms: 130
memory_kb: 1160
final_rank: 19

code_snippet: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  int a, b;
  while(scanf("%d%d", &a, &b) && (a||b)){
    int change = b - a;
    int res[] = {0,0,0};
    while(change){
      if(change >= 1000){ change-=1000; res[2]++;}
      else if(change >= 500){ change-=500; res[1]++;}
      else {change-=100; res[0]++;}
    }

    printf("%d %d %d\n", res[0], res[1], res[2]);
  }
  return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 1188
final_rank: 14

code_snippet: /*
	0071:Summer of KMC
*/
#include	<iostream>

using namespace std;

int main(void) {
	while(1) {
		int a, b;
		int C[3] = { 0 };
		cin >> a >> b;
		
		if(a == 0 && b == 0) { break; }
		
		b -= a;
		
		while(b >= 1000 != 0) { C[2]++; b -= 1000; }
		while(b >= 500 != 0) { C[1]++; b -= 500; }
		while(b >= 100 != 0) { C[0]++; b -= 100; }
		
		cout << C[0] << ' ' << C[1] << ' ' << C[2] << endl;
	}
	
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include<cstdio>
#include<iostream>

using namespace std;
 
int main(void){
 
   int A,B;
   int turi;
   int money[3];
   int neda[3]={100,500,1000};

   while(1){

	   cin>>A>>B;
	   if(A==0&&B==0) break;
	   turi=B-A;

	   for(int i=2;i>=0;i--){
		   money[i]=turi/neda[i];
		   turi%=neda[i];
	   }

	   for(int i=0;i<2;i++){
		   cout<<money[i]<<" ";
	   }
	   cout<<money[2]<<endl;

   }

   return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;

int main(){
	int s,g,h;
	int a,b;
	
	while(cin>>a>>b,a||b){
		s=g=h=0;
		int t=b-a;
		while(t>=1000){
			t-=1000;
			s++;
		}
		while(t>=500){
			t-=500;
			g++;
		}
		while(t>=100){
			t-=100;
			h++;
		}
		cout<<h<<" "<<g<<" "<<s<<endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3

code_snippet: #include <iostream>
using namespace std;

int main(){
  int a, b;
  while((cin >> a >> b), a, b){
    int n1=0, n2=0, n3=0;
    a = b-a;
    while(a>=1000){
      n3++;
      a-=1000;
    }
    while(a>=500){
      n2++;
      a-=500;
    }
    while(a>=100){
      n1++;
      a-=100;
    }
    cout << n1 << " " << n2 << " " << n3 << endl;
  }
  return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 1160
final_rank: 8

code_snippet: #include <iostream>
using namespace std;

int main() {
  int n,m;
  while(cin >> n >> m && (n || m)) {
    n=m-n;
    int a[3]={0,0,0};
    while(n>=1000) {
      n-=1000;
      a[2]++;
    }
    while(n>=500) {
      n-=500;
      a[1]++;
    }
    while(n>=100) {
      n-=100;
      a[0]++;
    }
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
  }
  return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 1160
final_rank: 8

code_snippet: #include<iostream>
using namespace std;
int main(){
  int CD,money,oo,go,ooo;
  while(1){
    cin >> CD >> money;
    if(CD==0 && money==0){
      break;
    }
    oo=0;
    go=0;
    ooo=0;

    money-=CD;

    while(money!=0){
      if(money>=1000){
	money-=1000;
	ooo++;
      }
      else if(money>=500){
	money-=500;
	go++;
      }
      else if(money>=100){
	money-=100;
	oo++;
      }
    }
    cout << oo << " " << go << " " << ooo << endl;
  }
}
accuracy: 1
time_ms: 20
memory_kb: 1160
final_rank: 8

code_snippet: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define X first
#define Y second
using namespace std;

int main(){
	int kind[] = {1000, 500, 100};
	int n, m;
	while(cin >> n >> m && (n!=0||m!=0)){
		int count[] = {0, 0, 0};
		int oturi=m-n;
		for(int i = 0; i < 3; i++){
			while(oturi>=kind[i]){
				count[i]++;
				oturi -= kind[i];
			}
		}
		cout << count[2] << " " << count[1] << " " << count[0] << endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1160
final_rank: 3