Language: C++

#include<iostream>
using namespace std;
typedef long long ll;
int main(){
????ll q1,b,c1,c2,q2;
????cin >> q1;
????while(q1!=0){
????????cin >> b >> c1 >> c2 >> q2;
????????ll x1=0,x2=0,m=min(c1,c2);
????????bool f=false;
????????//cout << b-min(c1,c2)*q1 << endl;
??????????
????????if(c1<=c2){
????????????if(b<c1*q2+c2*(q1-q2)) f=true;
????????????while(b>=c1*(x1+1)&&x1<q2) x1++;
????????????while(b>=c1*x1+c2*(x2+1)) x2++;
????????????if(x1==0) f=true;
????????????if(f) cout << "NA" << endl;
????????????else cout << x1 << " " << x2 << endl;
????????????cin >> q1;
????????}else{
????????????if(b<m*q1) f=true;
????????????ll s=c1-c2,sum=0;
????????????sum=q1*m;
????????????while(b-sum>=s*(x1+1)&&x1<q1&&x1<q2) {
????????????????x1++; 
????????????????//cout << b-sum<<":"<<s*x1<<endl;
????????????????//cout << x1<<":"<<c1*x1<<endl;
????????????}
????????????if(x1==q1)
????????????????while(b>=c1*(x1+1)&&x1 + 1<=q2) x1++;
????????????//while(b>=c1*x1+c2*(x2+1)) x2++;
??????????????
????????????if(x1==0) f=true;
????????????x2=0;
????????????while(b>=c1*x1+c2*(x2+1)) x2++;
????????????if(f) cout << "NA" << endl;
????????????else cout << x1 << " " << x2 << endl;
????????????//cout << c1*x1+c2*x2 << endl;
????????????cin >> q1;
????????}
????}
????return 0;
}

Compiler output:
a.cc:11:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   11 | ????????//cout << b-min(c1,c2)*q1 << endl;
a.cc:27:15: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   27 | ????????????????//cout << b-sum<<":"<<s*x1<<endl;
a.cc:28:15: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   28 | ????????????????//cout << x1<<":"<<c1*x1<<endl;
a.cc:32:11: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   32 | ????????????//while(b>=c1*x1+c2*(x2+1)) x2++;
a.cc:39:11: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   39 | ????????????//cout << c1*x1+c2*x2 << endl;
a.cc: In function 'int main()':
a.cc:5:1: error: expected primary-expression before '?' token
    5 | ????ll q1,b,c1,c2,q2;
      | ^
a.cc:5:2: error: expected primary-expression before '?' token
    5 | ????ll q1,b,c1,c2,q2;
      |  ^
a.cc:5:3: error: expected primary-expression before '?' token
    5 | ????ll q1,b,c1,c2,q2;
      |   ^
a.cc:5:4: error: expected primary-expression before '?' token
    5 | ????ll q1,b,c1,c2,q2;
      |    ^
a.cc:5:8: error: expected primary-expression before 'q1'
    5 | ????ll q1,b,c1,c2,q2;
      |        ^~
a.cc:5:7: error: expected ':' before 'q1'
    5 | ????ll q1,b,c1,c2,q2;
      |       ^~~
      |       :
a.cc:5:8: error: 'q1' was not declared in this scope
    5 | ????ll q1,b,c1,c2,q2;
      |        ^~
a.cc:5:11: error: 'b' was not declared in this scope
    5 | ????ll q1,b,c1,c2,q2;
      |           ^
a.cc:5:13: error: 'c1' was not declared in this scope
    5 | ????ll q1,b,c1,c2,q2;
      |             ^~
a.cc:5:16: error: 'c2' was not declared in this scope
    5 | ????ll q1,b,c1,c2,q2;
      |                ^~
a.cc:5:19: error: 'q2' was not declared in this scope
    5 | ????ll q1,b,c1,c2,q2;
      |                   ^~
a.cc:5:21: error: expected ':' before ';' token
    5 | ????ll q1,b,c1,c2,q2;
      |                     ^
      |                     :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:5:21: error: expected ':' before ';' token
    5 | ????ll q1,b,c1,c2,q2;
      |                     ^
      |                     :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:5:21: error: expected ':' before ';' token
    5 | ????ll q1,b,c1,c2,q2;
      |                     ^
      |                     :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:6:1: error: expected primary-expression before '?' token
    6 | ????cin >> q1;
      | ^
a.cc:6:2: error: expected primary-expression before '?' token
    6 | ????cin >> q1;
      |  ^
a.cc:6:3: error: expected primary-expression before '?' token
    6 | ????cin >> q1;
      |   ^
a.cc:6:4: error: expected primary-expression before '?' token
    6 | ????cin >> q1;
      |    ^
a.cc:6:14: error: expected ':' before ';' token
    6 | ????cin >> q1;
      |              ^
      |              :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
    6 | ????cin >> q1;
      |              ^
      |              :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
    6 | ????cin >> q1;
      |              ^
      |              :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
    6 | ????cin >> q1;
      |              ^
      |              :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:7:1: error: expected primary-expression before '?' token
    7 | ????while(q1!=0){
      | ^
a.cc:7:2: error: expected primary-expression before '?' token
    7 | ????while(q1!=0){
      |  ^
a.cc:7:3: error: expected primary-expression before '?' token
    7 | ????while(q1!=0){
      |   ^
a.cc:7:4: error: expected primary-expression before '?' token
    7 | ????while(q1!=0){
      |    ^
a.cc:7:5: error: expected primary-expression before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
a.cc:7:5: error: expected ':' before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
      |     :
a.cc:7:5: error: expected primary-expression before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
a.cc:7:5: error: expected ':' before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
      |     :
a.cc:7:5: error: expected primary-expression before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
a.cc:7:5: error: expected ':' before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
      |     :
a.cc:7:5: error: expected primary-expression before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
a.cc:7:5: error: expected ':' before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
      |     :
a.cc:7:5: error: expected primary-expression before 'while'
    7 | ????while(q1!=0){
      |     ^~~~~
a.cc:43:1: error: expected primary-expression before '?' token
   43 | ????return 0;
      | ^
a.cc:43:2: error: expected primary-expression before '?' token
   43 | ????return 0;
      |  ^
a.cc:43:3: error: expected primary-expression before '?' token
   43 | ????return 0;
      |   ^
a.cc:43:4: error: expected primary-expression before '?' token
   43 | ????return 0;
      |    ^
a.cc:43:5: error: expected primary-expression before 'return'
   43 | ????return 0;
      |     ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
   43 | ????return 0;
      |     ^~~~~~
      |     :
a.cc:43:5: error: expected primary-expression before 'return'
   43 | ????return 0;
      |     ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
   43 | ????return 0;
      |     ^~~~~~
      |     :
a.cc:43:5: error: expected primary-expression before 'return'
   43 | ????return 0;
      |     ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
   43 | ????return 0;
      |     ^~~~~~
      |     :
a.cc:43:5: error: expected primary-expression before 'return'
   43 | ????return 0;
      |     ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
   43 | ????return 0;
      |     ^~~~~~
      |     :
a.cc:43:5: error: expected primary-expression before 'return'
   43 | ????return 0;
      |     ^~~~~~