Language: C++

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//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;

//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 n,a,b;
    cin >> n >> a >> b;
    
    if((a+b)!=0){
        int c = a+b;
        int x = n/c; //a+bが何回繰り返されるか
        int y = n%c; //繰り返されたあまり
        if((a!=0)&&(b!=0)){
            ans = a*x;//周期分の青
            if(y>=a){//あまりの方が多いとき
                ans = ans+a;//a全部足す
            }else{//あまりの方が少ないとき
                ans = ans+y;//あまりぶんだけ足す
            }
        }else if(a==0){
            ans = 0;
        }else if(b==0){
            ans = n;
        }
    }else{
        ans = 0;
    }
    
    cout << ans << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:105:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
  105 |             ans = a*x;//周期分の青
      |             ^~~
      |             abs
a.cc:112:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
  112 |             ans = 0;
      |             ^~~
      |             abs
a.cc:114:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
  114 |             ans = n;
      |             ^~~
      |             abs
a.cc:117:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
  117 |         ans = 0;
      |         ^~~
      |         abs
a.cc:120:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
  120 |     cout << ans << endl;
      |             ^~~
      |             abs