Language: C++

#include <bits/stdc++.h>

#define     fr              freopen("input.txt","r",stdin)
#define     fw              freopen("output.txt","w",stdout)
#define     fast            ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


#define     ll              long long int
#define     ld              long double
#define     ul              unsigned long long int
#define     dl              double
#define     st              string

#define     vb              vector<bool>
#define     vll             vector <ll>
#define     lll             list <ll>
#define     ls              list<string>
#define     lc              list <char>
#define     qll             queue <ll>
#define     stll            stack <ll>
#define     sll             set <ll>
#define     sts             set <string>
#define     vs              vector <string>
#define     pll             pair <ll,ll>
#define     mll             map <ll,ll>
#define     msl             map <string,ll>
#define     vecp            vector < pair <ll, ll> >
#define     vecpp           vector < pair <ll, pair <ll, ll> > >
#define     pb              push_back
#define     pf              push_front
#define     in              insert
#define     eb              emplace_back
#define     ppb             pop_back
#define     ppf             pop_front

#define     el              endl
#define     rt              return 0

#define     N               cout << "NO" << endl
#define     Y               cout << "YES" << endl
#define     pr(a)           cout <<a<< endl

#define     gcd(a, b)       __gcd(a, b)
#define     lcm(a, b)       (a * b) / gcd(a, b)

#define     len(X)          ((ll)X.size())



#define     wh                  while
#define     rep(i, l, r)        for(long long i = l; i<r; i++)
#define     repi(i, l, r, p)    for(long long i = l; i<r; i+=p)
#define     repi2(i, l, r, p)   for(long long i = l; i>=r; i+=p)
#define     repb(i, r, l)       for(long long i = r; i>=l; i--)
#define     repbd(i, r, l, d)   for(long long i = r; i>l; i-=d)
#define     repr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) ///traverse a array!!

#define     max3(a, b, c)       max(a, max(b, c))
#define     max4(a, b, c, d)    max(max(a, b), max(c, d))
#define     min3(a, b, c)       min(a, min(b, c))
#define     min4(a, b, c, d)    min(min(a, b), min(c, d))

#define     vsort(v)            sort(v.begin(),v.end())
#define     all(container)      container.begin(), container.end()
#define     iterate(v, it)      for(vector< long long >::const_iterator it = v.begin(); it != v.end(); it++)

#define     rand(V)             random_shuffle(all(V))
#define     lb(a,X)             lower_bound(all(a),X)-a.begin()
#define     ub(a,X)             upper_bound(all(a),X)-a.begin()

#define     BIG                 300000


using namespace std;

ll decimal(string &S){ll dm=0,ct=1;repb(i,len(S)-1,0){dm+=ct*(S[i]=='1');ct*=2;}return dm;}

const int MOD = 1e9+7; // 998244353;
const int MAX = 2e5+5;
const ll INF = 1e18;
const double PI = acos(-1.0);
vll fac_help(ll X){vll V;for(ll i=1;i*i<=X;i++){if(X%i==0){V.pb(i);if(X/i!=i)V.pb(X/i);}};return V;}
vll factors(ll X){vll V=fac_help(X);sort(all(V));return V;}


  vector<pair<ll, ll> > A;
bool cmp(pair<ll, ll>& a,
         pair<ll, ll>& b)
{
    return a.second < b.second;
}
void sort(map<ll, ll>& M)
{


    for (auto& it : M) {
        A.push_back(it);
    }
    sort(A.begin(), A.end(), cmp);

}


int main()
{



     ll a,b,i,c,d,n,e,g,r,j,k,l,f=1,h=0,m=4,m1,sx,o=0,t,ttt=0,ans=0;
     st w;
     char x,y;
//     scanf("%lld",&ttt);
//     wh(ttt--)
//     {
         cin>>a>>b>>c;
         if(b==1) cout<<abs(a-c)<<endl;
         else
         {    d=a/c;
             if(a%c==0) cout<<b<<endl;
             else if(d>=b)
             {

             else if(b%2==0) cout<<abs((d*c)-a)<<endl;
             else cout<<abs(((d+1)*c)-a)<<endl;

             }
             else cout<<abs(a-(c*b))<<endl;
         }

//
//
//     }
     rt;

}






Compiler output:
a.cc: In function 'int main()':
a.cc:123:14: error: expected '}' before 'else'
  123 |              else if(b%2==0) cout<<abs((d*c)-a)<<endl;
      |              ^~~~
a.cc:121:14: note: to match this '{'
  121 |              {
      |              ^
a.cc:127:14: error: 'else' without a previous 'if'
  127 |              else cout<<abs(a-(c*b))<<endl;
      |              ^~~~
a.cc: At global scope:
a.cc:37:29: error: expected unqualified-id before 'return'
   37 | #define     rt              return 0
      |                             ^~~~~~
a.cc:133:6: note: in expansion of macro 'rt'
  133 |      rt;
      |      ^~
a.cc:135:1: error: expected declaration before '}' token
  135 | }
      | ^