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



using namespace std;



main()

{



    int s,w;

     

    cin >> s >>w;

    

     if(w>=s)

       cout << "unsafe";



      else

           cout<<"safe";

}

   

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

int main()

{

          int a,b;

          scanf("%d%d",&a,&b);

          if(b>=a)

                    printf("unsafe\n");

          else

                    printf("safe\n");

          return 0;

}


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

#include <iostream>

using namespace std;



int main()

{

  int s,w;

  cin>>s>>w;

  if(s<=w)

  cout<<"unsafe";

  else

  cout<<"safe";

}


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

int main()

{

          int a,b;

          scanf("%d%d",&a,&b);

          if(b>=a)

                    printf("unsafe\n");

          else

                    printf("safe\n");

          return 0;

}


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

using namespace std;

int main() 

{

	int s,w;

	cin>>s>>w;

	if(s<=w)

		cout<<"unsafe"<<endl;

	else

		cout<<"safe"<<endl;

	return 0;

}

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

int main()

{

    int s,w;

   scanf("%d%d",&s,&w);

   if(w>=s)

    printf("unsafe\n");

   else

    printf("safe\n");

}


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

using namespace std;



int main(void)

{

     short int s,w;

     cin>>s>>w;

     if(s>w) cout<<"safe"<<endl;

     else cout<<"unsafe"<<endl;

}

// Optimized solution to the same problem (faster):
///c. sheep and wolves

#include <stdio.h>

#include <math.h>



int main()

{

    int s,w;

    scanf("%d %d",&s, &w);

    if(w>=s) printf("unsafe");

    else printf("safe");

    

    return 0;

}

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

using namespace std;

//Ninda Irvany

int main() {

    int s, w;

    cin >> s >> w;



    if( w<s ) {

        cout << "safe" << endl;

    }else{

        cout << "unsafe" << endl;

    }

}

// Optimized solution to the same problem (faster):
///c. sheep and wolves

#include <stdio.h>

#include <math.h>



int main()

{

    int s,w;

    scanf("%d %d",&s, &w);

    if(w>=s) printf("unsafe");

    else printf("safe");

    

    return 0;

}

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

using namespace std ;



int s, w;



int main () {

    cin >> s >> w;

    if (w>=s) {

        cout << "unsafe" << endl;

    } else {

        cout << "safe" << endl;

    }



}

// Optimized solution to the same problem (faster):
///c. sheep and wolves

#include <stdio.h>

#include <math.h>



int main()

{

    int s,w;

    scanf("%d %d",&s, &w);

    if(w>=s) printf("unsafe");

    else printf("safe");

    

    return 0;

}

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

using namespace std;



int S, W;



int main () {

	cin >> S >> W;

	if (W >= S){

		cout << "unsafe";

	} else {

		cout << "safe";

	}

}


// Optimized solution to the same problem (faster):
///c. sheep and wolves

#include <stdio.h>

#include <math.h>



int main()

{

    int s,w;

    scanf("%d %d",&s, &w);

    if(w>=s) printf("unsafe");

    else printf("safe");

    

    return 0;

}

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

#include<math.h>

#define LL long long

#define FIO ios_base::sync_with_stdio(false), cin.tie(0)

using namespace std;



int main()

{

	int s, w; cin>>s>>w;

	if(s>w) cout<<"safe\n";

	else cout<<"unsafe\n";

}

// Optimized solution to the same problem (faster):
///c. sheep and wolves

#include <stdio.h>

#include <math.h>



int main()

{

    int s,w;

    scanf("%d %d",&s, &w);

    if(w>=s) printf("unsafe");

    else printf("safe");

    

    return 0;

}

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



using namespace std;



int main(){

	int s, w;

	scanf("%d %d", &s, &w);

	if (w >= s)

		puts("unsafe");

	else 

		puts("safe");

	return 0;

}


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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

#pragma GCC optimize("Ofast")

using namespace std;

#define bye return 0

#define Yes cout << "Yes" << "\n"

#define No  cout << "No" << "\n"

#define YES cout << "YES" << "\n"

#define NO cout << "NO" << "\n"

#define endl cout << "\n"

typedef long long ll;

int main(){

    ios::sync_with_stdio(false);

    cin.tie(NULL);

    vector<int> v;

    int a, b, c, r;

    cin >> a >> b;

    if(a<=b) cout << "unsafe" << "\n";

    else cout << "safe" << "\n";

   bye;



}




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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

using namespace std;

int main()

{

    int s,w;

    cin>>s>>w;

    if(s>w)

    {

        cout<<"safe"<<endl;

    }

    else

    cout<<"unsafe"<<endl;

    return 0;

}


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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

#include <string.h>

#include <stdio.h>

#include <math.h>

#include <list>

#include <set>

#include <queue>

#include <iterator>

#include <bitset>

#include <bits/stdc++.h>

#include <vector>

#include <cctype>

#include <algorithm>

#define ll             long long

#define _              ios_base::sync_with_stdio(0);cin.tie(0);

#define loop           for(i=0;i<n;i++)

#define pb             push_back

#define tc()           int t;cin>>t;while(t--) 

#define pi             acos(-1)         

 

using namespace std;

 

ll i,j,temp;



 

int main(){_



	int s,w;

	cin>>s>>w;

	if(w>=s){

		cout<<"unsafe\n";

	}

	else{

		cout<<"safe\n";

	}



	return 0;



}

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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

using namespace std;

int main()

{

    int S,W;

    cin>>S>>W;

    if(S>W)

    {

    cout<<"safe";

}

    else

{

    cout<<"unsafe";

}

}

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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

using namespace std;

int W,S;

int main () {

	cin >> S >> W;

if (W>=S)

	cout << "unsafe" << endl;

else

	cout << "safe" << endl;

}




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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

using namespace std;



int Z, X;

//syaa



int main() {

    cin >> Z >> X;

    if (X >= Z)

    cout << "unsafe" << endl; 

    else

    cout << "safe" << endl;

}

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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

using namespace std;

//zakha



int S,W;



int main() {

    cin >> S >> W;

    if (W >= S)

      cout << "unsafe" << endl;

    else

      cout << "safe" << endl;

}

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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

using namespace std;



// Caleb Faith Adnaka XI105

int main() {



    int S,W;

    cin >> S;

    cin >> W;



    if (W >= S){

        cout << "unsafe\n";

    }

    else{

        cout << "safe\n";

    }



}

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



int main(){

	int s,w;

	scanf("%d %d",&s,&w);

	if (s<=w){

		printf("unsafe\n");

	}

	else{

		printf("safe\n");

	}

	return 0;

}


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

using namespace std;

int main()

{

    long long s,w;

    cin>>s>>w;

    if(w>=s)

        cout<<"unsafe";

    else

        cout<<"safe";

return 0;}


// Optimized solution to the same problem (faster):
///ueue

#include<stdio.h>

int main(){



int s,w;

scanf("%d %d",&s,&w);



if(s>w) printf("safe");

else printf("unsafe");









return 0;

}


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

using namespace std;



int main() {

	int n, y,i,j,sum=0,count=0,a,b,c;

	cin >> n >> y;

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

		for(j = i; j <= n; j++){

			sum = 10000 * i + 5000 * (j - i) + 1000 * (n - j);

			if(sum == y){

				count++;

				a=i;

				b=j-i;

				c=n-j;

			}

		}

	}

	if(count>0)cout << a << " " << b << " " << c << endl;

    else cout << "-1 -1 -1" << endl;

	return 0;

}


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

int main() {

	int n, y;

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

	int s = 0;

	int flag = 0;

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

		for(int j = 0; j <= n; j++) {

			s = i * 10000 + j * 5000;

			if(i + j <= n && s + (n - i - j) * 1000 == y) {

				flag = 1;

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

				return 0;

			}

		}

	}

	if(flag == 0) printf("-1 -1 -1\n");

	return 0;

}


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

#include<bits/stdc++.h>

#define ll long long

#define ull unsigned long long

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

#define pf printf

#define sc scanf

using namespace std;





int main()

{

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



    ll n,y,a,b,c;

    cin>>n>>y;



    if(y%10000==0 && y/10000==n)cout<<y/10000<<" "<<0<<" "<<0<<endl;

    else if(y%5000==0 && y/5000==n)cout<<0<<" "<<y/5000<<" "<<0<<endl;

    else if(y%1000==0 && y/1000==n)cout<<0<<" "<<0<<" "<<y/1000<<endl;

    else{



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

            a=10000*i;

            for(int j=0;j<=n-i;j++){

                b=5000*j;

                for(int k=0;k<=n-i-j;k++){

                    c=1000*k;

                    if(a+b+c==y && i+j+k==n){

                        cout<<i<<" "<<j<<" "<<k<<endl;

                        return 0;

                    }

                }

            }

        }

        cout<<-1<<" "<<-1<<" "<<-1<<endl;

    }



return 0;

}


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

int main() {

	int n, y;

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

	int s = 0;

	int flag = 0;

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

		for(int j = 0; j <= n; j++) {

			s = i * 10000 + j * 5000;

			if(i + j <= n && s + (n - i - j) * 1000 == y) {

				flag = 1;

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

				return 0;

			}

		}

	}

	if(flag == 0) printf("-1 -1 -1\n");

	return 0;

}


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

using namespace std;

long long n,y;

int main(){

	cin>>n>>y;

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

	    for(int j=0;j<=n;j++){

			    int z=n-i-j;

				if(z>=0){

					if(i*10000 + j*5000 + z*1000 == y){

						cout<<i<<' '<<j<<' '<<z;

						return 0;

					}

				}

			}

	}

	cout<<-1<<' '<<-1<<' '<<-1;

	return 0;

}

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

int main() {

	int n, y;

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

	int s = 0;

	int flag = 0;

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

		for(int j = 0; j <= n; j++) {

			s = i * 10000 + j * 5000;

			if(i + j <= n && s + (n - i - j) * 1000 == y) {

				flag = 1;

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

				return 0;

			}

		}

	}

	if(flag == 0) printf("-1 -1 -1\n");

	return 0;

}


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

using namespace std;

int N,Y;

int main(){

	cin>>N>>Y;

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

	for(int j=0;j<=N;j++){

	int k=N-i-j;



	if(k>=0 && i*10000+j*5000+k*1000==Y)

	{

	cout<<i<<" "<<j<<" "<<k;  return 0;

    }

    

}

	



	cout<<"-1"<<" "<<"-1"<<" "<<"-1";

	return 0;

}

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

int main() {

	int n, y;

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

	int s = 0;

	int flag = 0;

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

		for(int j = 0; j <= n; j++) {

			s = i * 10000 + j * 5000;

			if(i + j <= n && s + (n - i - j) * 1000 == y) {

				flag = 1;

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

				return 0;

			}

		}

	}

	if(flag == 0) printf("-1 -1 -1\n");

	return 0;

}


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

using namespace std;

int n,m;

bool flag=1;

int main() {

	cin>>n>>m;

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

		for(int y=0,z; y<=n-x; y++) {

			z=n-x-y;

			if(x*10000+y*5000+z*1000==m&&x+y+z==n) {

				cout<<x<<' '<<y<<' '<<z<<endl;

				flag=0;

				return 0;

			}

		}

	if(flag)cout<<"-1 -1 -1";

	return 0;

}

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

int main() {

	int n, y;

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

	int s = 0;

	int flag = 0;

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

		for(int j = 0; j <= n; j++) {

			s = i * 10000 + j * 5000;

			if(i + j <= n && s + (n - i - j) * 1000 == y) {

				flag = 1;

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

				return 0;

			}

		}

	}

	if(flag == 0) printf("-1 -1 -1\n");

	return 0;

}


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

#include<bits/stdc++.h>

#define ll long long int

using namespace std;





int main()

{



    ll n,y,a,b,c;

    cin>>n>>y;



    if(y%10000==0 && y/10000==n)cout<<y/10000<<" "<<0<<" "<<0<<endl;

    else if(y%5000==0 && y/5000==n)cout<<0<<" "<<y/5000<<" "<<0<<endl;

    else if(y%1000==0 && y/1000==n)cout<<0<<" "<<0<<" "<<y/1000<<endl;

    else{



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

            a=10000*i;

            for(int j=0;j<=n-i;j++){

                b=5000*j;

                for(int k=0;k<=n-i-j;k++){

                    c=1000*k;

                    if(a+b+c==y && i+j+k==n){

                        cout<<i<<" "<<j<<" "<<k<<endl;

                        return 0;

                    }

                }

            }

        }

        cout<<-1<<" "<<-1<<" "<<-1<<endl;

    }



return 0;

}


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

using namespace std;

int n,m;

int main()

{

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

	for(register int x=0;x<=n;x++)

		for(register int y=0;y<=n;y++)

				if(x*10000+y*5000+(n-x-y)*1000==m && x>=0 && y>=0 && n-x-y>=0)

				{

					printf("%d %d %d",x,y,n-x-y);

					return 0;

				}

	printf("-1 -1 -1");

	return 0;

}

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

using namespace std;



int main() {

	int n, y,i,j,sum=0,count=0,a,b,c;

	cin >> n >> y;

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

		for(j = i; j <= n; j++){

			sum = 10000 * i + 5000 * (j - i) + 1000 * (n - j);

			if(sum == y){

				count++;

				a=i;

				b=j-i;

				c=n-j;

			}

		}

	}

	if(count>0)cout << a << " " << b << " " << c << endl;

    else cout << "-1 -1 -1" << endl;

	return 0;

}


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

using namespace std;

int n,m;

int main()

{

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

	for(register int x=0;x<=n;x++)

		for(register int y=0;y<=n;y++)

				if(x*10000+y*5000+(n-x-y)*1000==m && x>=0 && y>=0 && n-x-y>=0)

				{

					printf("%d %d %d",x,y,n-x-y);

					return 0;

				}

	printf("-1 -1 -1");

	return 0;

}

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

#include<bits/stdc++.h>

#define ll long long

#define ull unsigned long long

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

#define pf printf

#define sc scanf

using namespace std;





int main()

{

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



    ll n,y,a,b,c;

    cin>>n>>y;



    if(y%10000==0 && y/10000==n)cout<<y/10000<<" "<<0<<" "<<0<<endl;

    else if(y%5000==0 && y/5000==n)cout<<0<<" "<<y/5000<<" "<<0<<endl;

    else if(y%1000==0 && y/1000==n)cout<<0<<" "<<0<<" "<<y/1000<<endl;

    else{



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

            a=10000*i;

            for(int j=0;j<=n-i;j++){

                b=5000*j;

                for(int k=0;k<=n-i-j;k++){

                    c=1000*k;

                    if(a+b+c==y && i+j+k==n){

                        cout<<i<<" "<<j<<" "<<k<<endl;

                        return 0;

                    }

                }

            }

        }

        cout<<-1<<" "<<-1<<" "<<-1<<endl;

    }



return 0;

}


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

using namespace std;

int n,m;

int main()

{

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

	for(register int x=0;x<=n;x++)

		for(register int y=0;y<=n;y++)

				if(x*10000+y*5000+(n-x-y)*1000==m && x>=0 && y>=0 && n-x-y>=0)

				{

					printf("%d %d %d",x,y,n-x-y);

					return 0;

				}

	printf("-1 -1 -1");

	return 0;

}

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

using namespace std;



int main()



{

    int b1 = 10000, b2 = 5000, b3 = 1000;

    int n, y;

    cin >> n >> y;



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

        for(int j = 0; j <= n - i; j++) {



            int tmp = b1 * i + b2 * j;

            if(tmp > y)

                break;



            if( (y - tmp) % b3 == 0) {

                int k = (y - tmp) / b3;

                if(i + j + k == n) {

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

                    return 0;

                }

            }



        }

    }



    printf("-1 -1 -1\n");



    return 0;

}


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

using namespace std;

int n,m;

int main()

{

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

	for(register int x=0;x<=n;x++)

		for(register int y=0;y<=n;y++)

				if(x*10000+y*5000+(n-x-y)*1000==m && x>=0 && y>=0 && n-x-y>=0)

				{

					printf("%d %d %d",x,y,n-x-y);

					return 0;

				}

	printf("-1 -1 -1");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// 基本テンプレート

 

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <string>

#include <cstring>

#include <deque>

#include <list>

#include <queue>

#include <stack>

#include <vector>

#include <utility>

#include <algorithm>

#include <map>

#include <set>

#include <complex>

#include <cmath>

#include <limits>

#include <cfloat>

#include <climits>

#include <ctime>

#include <cassert>

#include <numeric>

#include <fstream>

#include <functional>

using namespace std;

 

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)

#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)

#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)

#define debug(...) fprintf(stderr, __VA_ARGS__)

#define int long long int

 

template<typename T> void chmax(T &a, T b) {a = max(a, b);}

template<typename T> void chmin(T &a, T b) {a = min(a, b);}

template<typename T> void chadd(T &a, T b) {a = a + b;}

 

typedef pair<int, int> pii;

typedef long long ll;

 

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

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

const ll INF = 1001001001001001LL;

const ll MOD = 1000000007LL;



int dp[5][3010];

 

signed main() {

    int N, Y; cin >> N >> Y;

    repq(x,0,N) repq(y,0,N-x) {

        int z = N - x - y;

        if(10000 * x + 5000 * y + 1000 * z == Y) {

            printf("%lld %lld %lld\n", x, y, z);

            return 0;

        }

    }

    printf("-1 -1 -1\n");

    return 0;

}

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

using namespace std;

using Int = long long int;



Int N, Y;

int main() {

    scanf("%lld%lld", &N, &Y);



    for(Int A=0; A<=N; A++) {

        for(Int B=0; A+B<=N; B++) {

            Int C = N - A - B;

            Int money = 10000 * A + 5000 * B + 1000 * C;



            if(money == Y) {

                printf("%lld %lld %lld\n", A, B, C);

                return 0;

            }

        }

    }



    printf("-1 -1 -1\n");

    return 0;

}

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



int main(){

  int N, Y, i, j, k;

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

  for(i=0; i<=N; i++){

    for(j=0; j<=N-i; j++){

      for(k=0; k<=N-i-j; k++){

        if(i*10000 + j*5000 + k*1000 == Y && i+j+k == N){

          printf("%d %d %d", i, j, k);

          return 0;

        }

      }

    }

  }

  if(i==N+1) printf("%d %d %d", -1, -1, -1);

  return 0;

}

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



int main(){

  int N, Y, i, j;

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

  for(i=0; i<=N; i++){

    for(j=0; j<=N-i; j++){

        if(i*10000 + j*5000 + (N-i-j)*1000 == Y){

          printf("%d %d %d", i, j, N-i-j);

          return 0;

        }

    }

  }

  if(i==N+1) printf("%d %d %d", -1, -1, -1);

  return 0;

}

// Fastest known solution for this problem: