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


//		HYSO SERIOUS? WHY SO SERIOUS                            RIOUS? WHY
//SO SERIOUS? WHYSO SERIO 		 ERIOUS? WHY SO SERIOUS ? WHY WHY SO SERIOUS? WHY
//SOSERIOUSWHYS 		       OSERIOUS? WHY SO SERIOU         SERIOUS        ERIOUS? WHY SO
//SERIOUS? WHYS 		          WHY SO SERIOUS? WHY SOSERIOUS? WHYSOSERIOUS? WHY SO SERIOUS?WHY
//SO SE 		           ERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SOSERIO 		           WHY
//SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WH 		            SERIOUS?WHYSO
//SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHYSO SE 		              ?WHYSOSERIOUS?WHY SO
//SERIOUS? WHY SO SERIOUS?WHYSO SERIOUS? 		                           OSERIOUS? WHY SO SERIOUS?WHYSOSER
//		                                 HYSOSERIOUS?WHYSOSERI
//		                                     SOSERIOUS?W
//		                                         SER
//		                                          W

#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long int
#define read(a)                                                                \\
  long long int a;                                                             \\
  cin >> a;
#define readstr(s)                                                             \\
  string s;                                                                    \\
  cin >> s;
#define readarr(a, l)                                                          \\
  long long int a[l] = {0};                                                    \\
  for (ll i = 0; i < l; i++)                                                   \\
    cin >> a[i];
#define loop(i, a, b) for (ll i = a; i < b; i++)
#define rloop(i, a, b) for (ll i = a; i > b; i--)
#define ff first
#define ss second
#define readmtrx(i, j, a, b)                                                   \\
  ll arr[a][b] = {0};                                                          \\
  for (ll i = 0; i < a; i++)                                                   \\
    for (ll j = 0; j < b; j++)                                                 \\
      cin >> arr[i][j];
#define v(pi) vector<ll> pi
#define vp(pi) vector<pair<ll, ll>> pi
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);
#define pb(p) push_back(p)
#define mp make_pair
#include <cmath>
#include <map>
#include <string>
#define mi(lol) map<ll, ll> lol
#define fsort(vec) sort(vec.begin(), vec.end())
#define rsort(vec) sort(vec.begin(), vec.end(), compare)
#define inf ll inf = INT_MAX
// sorting according to the second element vector

bool compare(pair<ll, ll> p, pair<ll, ll> q) { return p.second < q.second; }

//   example:-
//   sort(vec.begin(),vec.end(),compare);

int main() {
  fast;
  // #ifndef ONLINE_JUDGE
  //   freopen("input.txt","r",stdin);
  //   freopen("output.txt","w",stdout);
  // #endif
  read(a) read(b) ll m = a * (a - 1) / 2;
  ll n = b * (b - 1) / 2;
  cout << m + n << endl;
  return 0;
}


Error: WA

Fixed submission:


//		HYSO SERIOUS? WHY SO SERIOUS                            RIOUS? WHY
//SO SERIOUS? WHYSO SERIO 		 ERIOUS? WHY SO SERIOUS ? WHY WHY SO SERIOUS? WHY
//SOSERIOUSWHYS 		       OSERIOUS? WHY SO SERIOU         SERIOUS        ERIOUS? WHY SO
//SERIOUS? WHYS 		          WHY SO SERIOUS? WHY SOSERIOUS? WHYSOSERIOUS? WHY SO SERIOUS?WHY
//SO SE 		           ERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SOSERIO 		           WHY
//SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WH 		            SERIOUS?WHYSO
//SERIOUS? WHY SO SERIOUS? WHY SO SERIOUS? WHYSO SE 		              ?WHYSOSERIOUS?WHY SO
//SERIOUS? WHY SO SERIOUS?WHYSO SERIOUS? 		                           OSERIOUS? WHY SO SERIOUS?WHYSOSER
//		                                 HYSOSERIOUS?WHYSOSERI
//		                                     SOSERIOUS?W
//		                                         SER
//		                                          W

#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long int
#define read(a)                                                                \\
  long long int a;                                                             \\
  cin >> a;
#define readstr(s)                                                             \\
  string s;                                                                    \\
  cin >> s;
#define readarr(a, l)                                                          \\
  long long int a[l] = {0};                                                    \\
  for (ll i = 0; i < l; i++)                                                   \\
    cin >> a[i];
#define loop(i, a, b) for (ll i = a; i < b; i++)
#define rloop(i, a, b) for (ll i = a; i > b; i--)
#define ff first
#define ss second
#define readmtrx(i, j, a, b)                                                   \\
  ll arr[a][b] = {0};                                                          \\
  for (ll i = 0; i < a; i++)                                                   \\
    for (ll j = 0; j < b; j++)                                                 \\
      cin >> arr[i][j];
#define v(pi) vector<ll> pi
#define vp(pi) vector<pair<ll, ll>> pi
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);
#define pb(p) push_back(p)
#define mp make_pair
#include <cmath>
#include <map>
#include <string>
#define mi(lol) map<ll, ll> lol
#define fsort(vec) sort(vec.begin(), vec.end())
#define rsort(vec) sort(vec.begin(), vec.end(), compare)
#define inf ll inf = INT_MAX
// sorting according to the second element vector

bool compare(pair<ll, ll> p, pair<ll, ll> q) { return p.second < q.second; }

//   example:-
//   sort(vec.begin(),vec.end(),compare);

int main() {
  fast;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  read(a) read(b) ll m = a * (a - 1) / 2;
  ll n = b * (b - 1) / 2;
  cout << m + n << endl;
  return 0;
}