stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <cmath>

using namespace std;

int y[101],r,n;



bool check(double cy){

  double x=sqrt(r*r-cy*cy);

  if(cy>=0)x=r;

  int L=(-x-0.9999),R=(x+0.9999),hb[101]={};



  for(int i=L+50;i<R+50;i++){

    int x1=i-49-i/50;

    double y1=y[i]-cy;

    if(sqrt(x1*x1+y1*y1)>=r)hb[i]++;

  }

  for(int i=L+50;i<R+50;i++)if(!hb[i])return 0;

  return 1;

}



int main(){

  while(1){

    cin>>r>>n;

    if(!r&&!n)break;

    for(int i=0;i<100;i++)y[i]=0;



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

      int x1,x2,h;

      cin>>x1>>x2>>h;

      for(int j=x1;j<x2;j++) y[j+50]=max(y[j+50],h);

    }

    double ans=0;

    while(check(ans-r))ans+=0.0005;

    cout << ans-0.0005<<endl;

  }

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3851357535291673x):
#include <iostream>

#include <cmath>

using namespace std;

int y[50],r,n;



bool check(double cy){

  double x=sqrt(r*r-cy*cy);

  if(cy>=0)x=r;

  int L=-x-0.9999,R=x+0.9999,hb[101]={};



  for(int i=L+25;i<R+25;i++){

    int x1=i-24-i/25;

    double y1=y[i]-cy;

    if(x1*x1+y1*y1>=r*r)hb[i]++;

  }

  for(int i=L+25;i<R+25;i++)if(!hb[i])return 0;

  return 1;

}



int main(){

  while(1){

    cin>>r>>n;

    if(!r&&!n)break;

    for(int i=0;i<50;i++)y[i]=0;



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

      int x1,x2,h;

      cin>>x1>>x2>>h;

      for(int j=x1;j<x2;j++) y[j+25]=max(y[j+25],h);

    }

    double ans=0;

    while(check(ans-r))ans+=0.0009;

    cout << ans<<endl;

  }

  return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cmath>

using namespace std;

int y[101],r,n;



bool check(double cy){

  double x=sqrt(r*r-cy*cy);

  if(cy>=0)x=r;

  int L=(-x-0.9999),R=(x+0.9999),hb[101]={};



  for(int i=L+50;i<R+50;i++){

    int x1=i-49-i/50;

    double y1=y[i]-cy;

    if(sqrt(x1*x1+y1*y1)>=r)hb[i]++;

  }

  for(int i=L+50;i<R+50;i++)if(!hb[i])return 0;

  return 1;

}



int main(){

  while(1){

    cin>>r>>n;

    if(!r&&!n)break;

    for(int i=0;i<100;i++)y[i]=0;



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

      int x1,x2,h;

      cin>>x1>>x2>>h;

      for(int j=x1;j<x2;j++) y[j+50]=max(y[j+50],h);

    }

    double ans=0;

    while(check(ans-r))ans+=0.0009;

    cout << ans<<endl;

  }

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.099424580431519x):
#include <iostream>

#include <cmath>

using namespace std;

int y[50],r,n;



bool check(double cy){

  double x=sqrt(r*r-cy*cy);

  if(cy>=0)x=r;

  int L=-x-0.9999,R=x+0.9999,hb[101]={};



  for(int i=L+25;i<R+25;i++){

    int x1=i-24-i/25;

    double y1=y[i]-cy;

    if(x1*x1+y1*y1>=r*r)hb[i]++;

  }

  for(int i=L+25;i<R+25;i++)if(!hb[i])return 0;

  return 1;

}



int main(){

  while(1){

    cin>>r>>n;

    if(!r&&!n)break;

    for(int i=0;i<50;i++)y[i]=0;



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

      int x1,x2,h;

      cin>>x1>>x2>>h;

      for(int j=x1;j<x2;j++) y[j+25]=max(y[j+25],h);

    }

    double ans=0;

    while(check(ans-r))ans+=0.0009;

    cout << ans<<endl;

  }

  return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<math.h>

#include<cstring>

#include<algorithm> 

using namespace std;



int main()

{

	int s,w;

	cin>>s>>w;

	if(s<=w)

		cout<<"unsafe";

	else

		cout<<"safe"; 

}

 

// Faster C++ solution for the same problem (measured speedup: 5.298426394773444x):
#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;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main(){



    int S, W;

    cin>> S;

    cin>> W;



    if(W >= S){

        cout<< "unsafe" <<endl;

    }

    else{

        cout<< "safe" <<endl;

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.312208905423946x):
#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;

}
// Slower C++ solution:
#include<iostream>



using namespace std;



main()

{



    int s,w;

     

    cin >> s >>w;

    

     if(w>=s)

       cout << "unsafe";



      else

           cout<<"safe";

}

   

// Faster C++ solution for the same problem (measured speedup: 5.298426394773444x):
#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;

}
// Slower C++ solution:
// Example program

#include <iostream>

using namespace std;



int main()

{

  int s,w;

  cin>>s>>w;

  if(s<=w)

  cout<<"unsafe";

  else

  cout<<"safe";

}


// Faster C++ solution for the same problem (measured speedup: 5.298426394773444x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.312424945018996x):
#include<stdio.h>

int main()

{

    int s,w;

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

   if(w>=s)

    printf("unsafe\n");

   else

    printf("safe\n");

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.31139860314615x):
#include<stdio.h>

int main(){

    int S, W;

    scanf("%d%d", &S, &W);

    if(S<=W)

        printf("unsafe");

    else

        printf("safe");

    return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.311116895859468x):
///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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.311036580386584x):
///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;

}
// Slower C++ solution:
#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;

    }

}

// Faster C++ solution for the same problem (measured speedup: 5.311102005671174x):
///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;

}
// Slower C++ solution:
#include <iostream>

using namespace std ;



int s, w;



int main () {

    cin >> s >> w;

    if (w>=s) {

        cout << "unsafe" << endl;

    } else {

        cout << "safe" << endl;

    }



}

// Faster C++ solution for the same problem (measured speedup: 5.310498388047719x):
///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;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int S, W;



int main () {

	cin >> S >> W;

	if (W >= S){

		cout << "unsafe";

	} else {

		cout << "safe";

	}

}


// Faster C++ solution for the same problem (measured speedup: 5.296774197331955x):
///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;

}
// Slower C++ solution:
#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";

}

// Faster C++ solution for the same problem (measured speedup: 5.297080826502429x):
///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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.237994787886831x):
#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;

}
// Slower C++ solution:
#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;



}




// Faster C++ solution for the same problem (measured speedup: 5.373224888849549x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.311309863885622x):
#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;

}
// Slower C++ solution:
#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;



}

// Faster C++ solution for the same problem (measured speedup: 5.374178727845526x):
#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;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int S,W;

    cin>>S>>W;

    if(S>W)

    {

    cout<<"safe";

}

    else

{

    cout<<"unsafe";

}

}

// Faster C++ solution for the same problem (measured speedup: 5.297413770598847x):
#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;

}
// Slower C++ solution:
#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;

}




// Faster C++ solution for the same problem (measured speedup: 5.311274045931063x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.310706222638655x):
#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;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

//zakha



int S,W;



int main() {

    cin >> S >> W;

    if (W >= S)

      cout << "unsafe" << endl;

    else

      cout << "safe" << endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.310706222638655x):
#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;

}
// Slower C++ solution:
#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";

    }



}

// Faster C++ solution for the same problem (measured speedup: 5.297352333652028x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.237807255267711x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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;



}




// Faster C++ solution for the same problem (measured speedup: 5.373032514672534x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.311119706413141x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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;



}

// Faster C++ solution for the same problem (measured speedup: 5.373986319518816x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int S,W;

    cin>>S>>W;

    if(S>W)

    {

    cout<<"safe";

}

    else

{

    cout<<"unsafe";

}

}

// Faster C++ solution for the same problem (measured speedup: 5.297224110639417x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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;

}




// Faster C++ solution for the same problem (measured speedup: 5.311083889740949x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.310516086777961x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

//zakha



int S,W;



int main() {

    cin >> S >> W;

    if (W >= S)

      cout << "unsafe" << endl;

    else

      cout << "safe" << endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.310516086777961x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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";

    }



}

// Faster C++ solution for the same problem (measured speedup: 5.297162675892187x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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;}


// Faster C++ solution for the same problem (measured speedup: 5.295204745491648x):
///ueue

#include<stdio.h>

int main(){



int s,w;

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



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

else printf("unsafe");









return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.7931499254638674x):
#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;

}
// Slower C++ solution:
/**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;

}


// Faster C++ solution for the same problem (measured speedup: 4.1928894033331705x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.793137961628464x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 2.574673767488846x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 2.5697497703100742x):
#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;

}