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

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

#define int long long

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

#define endl '\\n'
#define fi first
#define se second
#define all(v) v.begin(), v.end()

#define print(x) cout << #x << " : " << x << endl;
#define darr(a, n)                                                             \\
  for (int i = 0; i < n; i++)                                                  \\
    cout << a[i] << ' ';                                                       \\
  cout << '\\n';
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(nullptr);
#define dvec(vct)                                                              \\
  for (auto i : vct)                                                           \\
    cout << i << " ";                                                          \\
  cout << endl;

const int maxn = 1e6;
const int mod = 1e9 + 7;
// const int mod = 998244353;

/*****************************************************************************/

void solve() {
  int n, m;
  cin >> n >> m;
  int ans = 0;
  ans += (n < 2) ? 0 : (n * (n - 1)) / 2;
  ans += (m < 2) ? 0 : (m * (m - 1)) / 2;
  cout << ans << endl;
}

/*****************************************************************************/

int32_t main() {
  fast;

  auto start = chrono::steady_clock::now();
  solve();

  auto end = chrono::steady_clock::now();
  auto diff = end - start;
}


Error: WA

Fixed submission:

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

#define int long long

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

#define endl '\\n'
#define fi first
#define se second
#define all(v) v.begin(), v.end()

#define print(x) cout << #x << " : " << x << endl;
#define darr(a, n)                                                             \\
  for (int i = 0; i < n; i++)                                                  \\
    cout << a[i] << ' ';                                                       \\
  cout << '\\n';
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(nullptr);
#define dvec(vct)                                                              \\
  for (auto i : vct)                                                           \\
    cout << i << " ";                                                          \\
  cout << endl;

const int maxn = 1e6;
const int mod = 1e9 + 7;
// const int mod = 998244353;

/*****************************************************************************/

void solve() {
  int n, m;
  cin >> n >> m;
  int ans = 0;
  ans += (n < 2) ? 0 : (n * (n - 1)) / 2;
  ans += (m < 2) ? 0 : (m * (m - 1)) / 2;
  cout << ans << endl;
}

/*****************************************************************************/

int32_t main() {
  fast;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  auto start = chrono::steady_clock::now();
  solve();

  auto end = chrono::steady_clock::now();
  auto diff = end - start;
#ifndef ONLINE_JUDGE
  cout << "\\n\\n";
  cout << "TIME : " << chrono::duration<double, milli>(diff).count() << " ms"
       << endl;
#endif
}