Problem p02951 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL)
#define repf(i, st, end, inc) for (int i = st; i < end; i += inc)
#define repb(i, st, end, dec) for (int i = st; i >= end; i -= dec)

#define MOD 1000000007

#define trace1(a) cout << a << endl;
#define trace2(a, b) cout << a << " | " << b << endl;
#define trace3(a, b, c) cout << a << " | " << b << " | " << c << endl;
#define trace4(a, b, c, d)                                                     \
  cout << a << " | " << b << " | " << c << " | " << d << endl;

using namespace std;
using namespace std::chrono;

int main() {
  fast;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  auto start = high_resolution_clock::now();

  int a, b, c;
  cin >> a >> b >> c;
  int space = a - b;
  int rem = c - space;

  cout << max(0, rem);

  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
  // cout << endl;
  // cout << double(duration.count()) / 1000000 << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL)
#define repf(i, st, end, inc) for (int i = st; i < end; i += inc)
#define repb(i, st, end, dec) for (int i = st; i >= end; i -= dec)

#define MOD 1000000007

#define trace1(a) cout << a << endl;
#define trace2(a, b) cout << a << " | " << b << endl;
#define trace3(a, b, c) cout << a << " | " << b << " | " << c << endl;
#define trace4(a, b, c, d)                                                     \
  cout << a << " | " << b << " | " << c << " | " << d << endl;

using namespace std;
using namespace std::chrono;

int main() {
  fast;
  // #ifndef ONLINE_JUDGE
  //    freopen("input.txt", "r", stdin);
  //    freopen("output.txt", "w", stdout);
  // #endif

  auto start = high_resolution_clock::now();

  int a, b, c;
  cin >> a >> b >> c;
  int space = a - b;
  int rem = c - space;

  cout << max(0, rem);

  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
  // cout << endl;
  // cout << double(duration.count()) / 1000000 << endl;

  return 0;
}