Language: C++

#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)

#define MOD 1000000007
#define INF 1073741823
#define LLINF 4611686018427387903
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VII;
#pragma endregion
#pragma region dump
#define dump(x) cerr << #x << " = " << (x) << " [" << __LINE__ << ":" << __FUNCTION__ << "] " << endl;
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// pair出力
template<typename T, typename U>
ostream& operator << (ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// map出力
template<typename T, typename U>
ostream& operator << (ostream& os, map<T, U>& map_var) {
    os << "{";
    for (map<T, U>::iterator itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set 出力
template<typename T>
ostream& operator << (ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#pragma endregion
/*
int f(int n) {
    switch (n) {
        case 1:
            return 2;
        case 2:
        case 3:
        case 5:
            return 5;
        case 4:
            return 4;
        case 6:
        case 9:
            return 6;
        case 7:
            return 3;
        case 8:
            return 7;
        default:
            return 0;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M; cin >> N >> M;
    VI A(M); REP(i, M) cin >> A[i];
    VI dp(N+1,0);
    set<int> S;
    REP(i, M) S.insert(f(A[i]));
    REP(i, N) for(int n:S) if (i >= n) dp[i] = max(dp[i], dp[i - n] + 1);
    cout << dp[N] << endl;
    getchar(); getchar();
}
*/
int main() {
    int A, B; cin >> A >> B;
    if (B%A == 0) {
        cout << A + B << endl;
    }
    else {
        cout << B - A << endl;
    }
}

Compiler output:
a.cc: In function 'std::ostream& operator<<(std::ostream&, std::map<T, U>&)':
a.cc:49:10: error: need 'typename' before 'std::map<T, U>::iterator' because 'std::map<T, U>' is a dependent scope
   49 |     for (map<T, U>::iterator itr = map_var.begin(); itr != map_var.end(); itr++) {
      |          ^~~~~~~~~
a.cc:49:29: error: expected ';' before 'itr'
   49 |     for (map<T, U>::iterator itr = map_var.begin(); itr != map_var.end(); itr++) {
      |                             ^~~~
      |                             ;
a.cc:49:53: error: 'itr' was not declared in this scope
   49 |     for (map<T, U>::iterator itr = map_var.begin(); itr != map_var.end(); itr++) {
      |                                                     ^~~