Problem p02729 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>

#include <float.h>
#include <time.h>

#define loop(i, start, end) for (i = (start); i <= (end); i++)
#define loopIterators(it, vec) for (it = (vec).begin(); it != (vec).end(); it++)
#define loopIteratorsRev(it, vec)                                              \\
  for (it = (vec).rbegin(); it != (vec).rend(); it++)
#define loopRev(i, start, end) for (i = (start); i >= (end); i--)
#define FLASH                                                                  \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define testCases(t)                                                           \\
  cin >> t;                                                                    \\
  while (t--)
#define PN(n) cout << (n)
#define PN1(n) cout << (n) << " "
#define PN2(a, b) cout << (a) << " " << (b) << " "
#define PNN1(n) cout << (n) << endl
#define PNN2(a, b) cout << (a) << " " << (b) << endl
#define PNN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define PrintArray(ar, n)                                                      \\
  for (i = 0; i < n; i++)                                                      \\
    cout << ar[i] << " ";                                                      \\
  cout << endl
#define PrintObject(ar, it)                                                    \\
  loopIterators(it, ar) cout << *it << " ";                                    \\
  cout << endl
#define PrintMap(map, it) loopIterators(it, map) PNN2(it->first, it->second)
#define sz(a) sizeof(a)
#define IN1(n) cin >> n
#define IN2(a, b) cin >> a >> b
#define IN3(a, b, c) cin >> a >> b >> c
#define ALL(s) s.begin(), s.end()
#define SWAP(a, b, c)                                                          \\
  c = a;                                                                       \\
  a = b;                                                                       \\
  b = c
#define STRSP(s) scanf("%[^\\n]%*c", s)
#define ENTER PNN1("");
#define MOD7 1000000007
#define MOD9 10000009
#define MAX 1000000000
#define llPair std::pair<lli, lli>
#define iiPair std::pair<int, int>
#define ONLINE_JUDGE

typedef long long int lli;
typedef long int li;
typedef unsigned long long int ulli;
typedef long double ld;

using namespace std;

int main(void) {
  FLASH

#ifndef ONLINE_JUDGE
  freopen("input-stream.txt", "r", stdin);
  freopen("output-stream.txt", "w", stdout);
#endif

  int a, b;
  IN2(a, b);
  int ans = a * (a - 1) / 2;
  ans += b * (b - 1) / 2;

  PNN1(ans);

#ifndef ONLINE_JUDGE
  fclose(stdin);
  fclose(stdout);
#endif

  return 0;
}


Error: WA

Fixed submission:

#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>

#include <float.h>
#include <time.h>

#define loop(i, start, end) for (i = (start); i <= (end); i++)
#define loopIterators(it, vec) for (it = (vec).begin(); it != (vec).end(); it++)
#define loopIteratorsRev(it, vec)                                              \\
  for (it = (vec).rbegin(); it != (vec).rend(); it++)
#define loopRev(i, start, end) for (i = (start); i >= (end); i--)
#define FLASH                                                                  \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define testCases(t)                                                           \\
  cin >> t;                                                                    \\
  while (t--)
#define PN(n) cout << (n)
#define PN1(n) cout << (n) << " "
#define PN2(a, b) cout << (a) << " " << (b) << " "
#define PNN1(n) cout << (n) << endl
#define PNN2(a, b) cout << (a) << " " << (b) << endl
#define PNN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define PrintArray(ar, n)                                                      \\
  for (i = 0; i < n; i++)                                                      \\
    cout << ar[i] << " ";                                                      \\
  cout << endl
#define PrintObject(ar, it)                                                    \\
  loopIterators(it, ar) cout << *it << " ";                                    \\
  cout << endl
#define PrintMap(map, it) loopIterators(it, map) PNN2(it->first, it->second)
#define sz(a) sizeof(a)
#define IN1(n) cin >> n
#define IN2(a, b) cin >> a >> b
#define IN3(a, b, c) cin >> a >> b >> c
#define ALL(s) s.begin(), s.end()
#define SWAP(a, b, c)                                                          \\
  c = a;                                                                       \\
  a = b;                                                                       \\
  b = c
#define STRSP(s) scanf("%[^\\n]%*c", s)
#define ENTER PNN1("");
#define MOD7 1000000007
#define MOD9 10000009
#define MAX 1000000000
#define llPair std::pair<lli, lli>
#define iiPair std::pair<int, int>
// #define ONLINE_JUDGE

typedef long long int lli;
typedef long int li;
typedef unsigned long long int ulli;
typedef long double ld;

using namespace std;

int main(void) {
  FLASH

#ifndef ONLINE_JUDGE
  freopen("input-stream.txt", "r", stdin);
  freopen("output-stream.txt", "w", stdout);
#endif

  int a, b;
  IN2(a, b);
  int ans = a * (a - 1) / 2;
  ans += b * (b - 1) / 2;

  PNN1(ans);

#ifndef ONLINE_JUDGE
  fclose(stdin);
  fclose(stdout);
#endif

  return 0;
}