Problem p02945 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define fastIO                                                                 \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
#define asc(s) sort(s.begin(), s.end())
#define des(s) sort(s.rbegin(), s.rend())
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define rev(v) reverse(v.begin(), v.end())
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define precision(x, p) fixed << setprecision(p) << x
#define set_bits(n) __builtin_popcount(n);
#define mod 1000000007
#define PI 3.14159265358979
typedef long long ll;

#ifndef ONLINE_JUDGE
#define debug(x) cout << x << endl;
#else
#define debug(x)
#endif

template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a * b / gcd(a, b); };

vector<string> split(string s) {
  istringstream buf(s);
  istream_iterator<string> beg(buf), end;
  vector<string> list(beg, end);
  return list;
}

bool isvowel(char c) {
  string s = "aeiou";
  if (find(s.begin(), s.end(), c) != s.end())
    return true;
  return false;
}

bool cmp(pair<int, int> &a, pair<int, int> &b) {
  return a.second > b.second || (a.second == b.second && a.first > b.first);
}

bool isprime(ll n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0)
      return false;

  return true && (n != 1);
}

void solve() {
  int a, b;
  cin >> a >> b;

  cout << max(a + b, max(a - b, a * b));
}

int main() {
  fastIO

#ifndef ONLINE_JUDGE
      freopen("in.txt", "rt", stdin);
  freopen("out.txt", "wt", stdout);
#endif

  int t = 1;
  // cin>>t;

  for (int test_case = 1; test_case <= t; test_case++) {
    solve();
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;

#define fastIO                                                                 \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
#define asc(s) sort(s.begin(), s.end())
#define des(s) sort(s.rbegin(), s.rend())
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define rev(v) reverse(v.begin(), v.end())
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define precision(x, p) fixed << setprecision(p) << x
#define set_bits(n) __builtin_popcount(n);
#define mod 1000000007
#define PI 3.14159265358979
typedef long long ll;

#ifndef ONLINE_JUDGE
#define debug(x) cout << x << endl;
#else
#define debug(x)
#endif

template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a * b / gcd(a, b); };

vector<string> split(string s) {
  istringstream buf(s);
  istream_iterator<string> beg(buf), end;
  vector<string> list(beg, end);
  return list;
}

bool isvowel(char c) {
  string s = "aeiou";
  if (find(s.begin(), s.end(), c) != s.end())
    return true;
  return false;
}

bool cmp(pair<int, int> &a, pair<int, int> &b) {
  return a.second > b.second || (a.second == b.second && a.first > b.first);
}

bool isprime(ll n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0)
      return false;

  return true && (n != 1);
}

void solve() {
  int a, b;
  cin >> a >> b;

  cout << max(a + b, max(a - b, a * b));
}

int main() {
  fastIO

      int t = 1;
  // cin>>t;

  for (int test_case = 1; test_case <= t; test_case++) {
    solve();
  }
  return 0;
}