alexjercan/bugnet huggingface dataset:
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

#define REP(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

using i32 = int;
using i64 = long long;
using ll = long long;

using namespace std;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int64_t a;
  cin >> a;
  cout << a + a * a + a * a * a << '\\n';
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>

#define REP(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

using ll = int64_t;

using namespace std;

/*
 * Modint struct
 * library author : @snuke
 * */
const int mod = 1e9 + 7;
struct mint {
  long long x; // typedef long long ll;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  mint a;
  cin >> a;

  mint ans = a.pow(2) * (a.inv() + 1 + a);
  cout << ans << '\\n';
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <math.h>
#include <stdio.h>
using namespace std;

int main() {
  int a;
  scanf("%d", &a);
  int ans = a + (a * a) + (a * a * a);
  printf("%d", ans);
  return 0;
}


Error: -11

Fixed submission:

#include <math.h>
#include <stdio.h>
using namespace std;

int main() {
  int a;
  scanf("%d", a);
  int ans = a + (a * a) + (a * a * a);
  printf("%d", ans);
  return 0;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error


#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  cout << n + n * n + n * n * n;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {

  long long n, m, k;
  cin >> n >> m >> k;
  long long a[n], b[m];
  long long sum = 0, c = 0;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < m; i++)
    cin >> b[i];
  int i = 0, j = 0;
  while (sum < k) {
    if (i < n and j < m) {
      if (sum + a[i] <= sum + b[j]) {
        sum += a[i];
        i++;
      } else {
        sum += b[j];
        j++;
      }
      c++;
    } else {

      if (j == m and i < n) {
        sum += a[i];
        i++;
      } else if (j < m and i == n) {
        sum += b[j];
        j++;
      }
      c++;
    }
  }
  if (sum <= k)
    cout << c;
  else
    cout << c - 1;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vv vector<ll>
#define fr(i, x) for (int i = 0; i < x; i++)
int dx[4] = {-1, 0, 0, 1};
int dy[4] = {0, -1, 1, 0};

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {

  if (a.first == b.first)
    return a.second < b.second;
  return (a.first < b.first);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n, x, r, cnt = 0;
  cin >> n;
  cout << n + (pow(n, 2)) + pow(n, 3) << endl;
}

Error: -6
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc


Fixed submission:

#include <bits/stdc++.h>

using namespace std;
#define fr for (int i = 0; i < n; i++)
#define pb push_back
void printVector(vector<char> x) {
  for (auto i : x) {
    cout << i << " ";
  }
  cout << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, m, k, x;

  cin >> n >> m >> k;
  vector<int> a;
  for (int i = 0; i < (n + m); i++) {
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  long long int sum = 0;
  int _count = 0;
  int i = 0;
  while (sum <= k) {
    sum += a[i];
    _count++;
    i++;
  }

  // if(flag == 0) cout << (n+m) << endl;
  // else cout << (_count + 1) << endl;
  cout << _count << endl;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  long long a;
  cin >> a;
  cout << (a + a * a + a * a * a) << endl;
}


Error: 14

Fixed submission:

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

int main() {
  long long a;
  cin >> a;
  return (a + a * a + a * a * a);
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod (int)1000000007
#define pb push_back
#define endl "\\n"
#define all(a) a.begin(), a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repe(i, a, b) for (int i = a; i <= b; i++)
#define repo(i, b) for (int i = (int)0; i < b; i++)
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);                                                                  \\
  cout.tie(0)

signed solve() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
  return 0;
}

signed main() {
  fast;
  int tests = 1;
  // cin>>tests;
  while (tests--) {
    solve();
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod (int)1000000007
#define pb push_back
#define endl "\\n"
#define all(a) a.begin(), a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repe(i, a, b) for (int i = a; i <= b; i++)
#define repo(i, b) for (int i = (int)0; i < b; i++)
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);                                                                  \\
  cout.tie(0)

signed solve() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
}

signed main() {
  fast;
  int tests = 1;
  // cin>>tests;
  while (tests--) {
    solve();
  }
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int a, b, c = 0;
  cin >> a;
  b = a * a;
  c = a * a * a;
  cout << a + b + c;
  return 0;
}

Error: 14

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b, c = 0;
  cin >> a;
  b = a * a;
  c = a * a * a;

  return a + b + c;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, s, n) for (int i = (s); i < (n); i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define REPR(i, s, n) for (int i = (s); i >= (n); i--)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
const int INF = 1e9;
const double pi = acos(-1.0);
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, s, n) for (int i = (s); i < (n); i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define REPR(i, s, n) for (int i = (s); i >= (n); i--)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
const int INF = 1e9;
const double pi = acos(-1.0);
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main() {
  int a;
  cin >> a;
  cout << a * (1 - a * a * a) / (1 - a) << endl;
  return 0;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main() {

  ll a;
  cin >> a;
  cout << a + (a * a) + (a * a * a) << endl;
}

Error: 14

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main() {

  ll a;
  cin >> a;
  return a + (a * a) + (a * a * a);
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

using namespace std;

int a;
int main() {
  cin >> a;
  cout << a + a * a + a * a * a << endl;
  return 0;
}


Error: 14

Fixed submission:

#include <iostream>

using namespace std;

int a;
int main() {
  cin >> a;
  int s = 0;
  for (int i = 0; i < a; i++)
    s = s + a + 1 + a * a;
  return s;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, k, n) for (ll i = k; i < (n); i++)
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ll a;
  cin >> a;
  ll ans = a + a * a + a * a * a;
  cout << ans << endl;
}

Error: -6
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc


Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, k, n) for (ll i = k; i < (n); i++)
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  string s, t;
  cin >> s >> t;
  ll n;
  cin >> n;
  vector<ll> a(n, 0);
  rep1(i, n) cin >> a[i];
  ll ans = 0;
  cout << ans << endl;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

// Tue May 26 19:06:02 IST 2020
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define forn(ii, a, b) for (int ii = (int)a; ii < (int)b; ii++)
#define debug(x) cerr << #x << " " << x << " -- \\n"
#define I__O ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define int64 long long
#define MOD 998244353
#define pb push_back
#define f1 first
#define s1 second
#define all(x) (x).begin(), (x).end()
#define precise(x) cout << fixed << setprecision(12) << x << '\\n';
#define tough_nut numeric_limits<int64>::min()

const double pi = 3.141592653589793238;
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
const int N = 3e5 + 7;
const int INF = INT_MAX;
struct comp {
  bool operator()(const pair<int, int> A, const pair<int, int> &B) const {
    if (A.first == B.first)
      return A.second < B.second;
    return A.first > B.first;
  }
};
int tests() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << '\\n';
  return 0;
  // cout << (n+1-min(a,b)+max(a,b)-1)/max(a,b) << '\\n';
}
int32_t main() {
  I__O;
  int cases = 1;
  // cin >> cases ;
  while (cases--)
    tests();

  return 0;
}
// g++ -std=c++17 -O2 -Wall test.cpp


Error: 0

Fixed submission:

// Tue May 26 19:06:02 IST 2020
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define forn(ii, a, b) for (int ii = (int)a; ii < (int)b; ii++)
#define debug(x) cerr << #x << " " << x << " -- \\n"
#define I__O ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define int64 long long
#define MOD 998244353
#define pb push_back
#define f1 first
#define s1 second
#define all(x) (x).begin(), (x).end()
#define precise(x) cout << fixed << setprecision(12) << x << '\\n';
#define tough_nut numeric_limits<int64>::min()

const double pi = 3.141592653589793238;
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
const int N = 3e5 + 7;
const int INF = INT_MAX;
struct comp {
  bool operator()(const pair<int, int> A, const pair<int, int> &B) const {
    if (A.first == B.first)
      return A.second < B.second;
    return A.first > B.first;
  }
};
int tests() {
  int a, b, n;
  cin >> a;
  cout << a + a * a + a * a * a << '\\n';
  // cout << (n+1-min(a,b)+max(a,b)-1)/max(a,b) << '\\n';
}
int32_t main() {
  I__O;
  int cases = 1;
  // cin >> cases ;
  while (cases--)
    tests();

  return 0;
}
// g++ -std=c++17 -O2 -Wall test.cpp
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

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

int sum(int a) {
  int Tong = 0;
  while (a >= 1 && a <= 10) {
    for (int i = 1; i <= 3; ++i) {
      Tong += pow(a, i);
    }
    cout << Tong;
    break;
  }
  return 0;
}

int main() {
  int a;
  cin >> a;
  sum(a);
  return 0;
}


Error: WA

Fixed submission:

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

int sum(int a) {
  int Tong = 0;
  while (a >= 1 && a <= 10) {
    for (int i = 1; i <= 3; ++i) {
      Tong += pow(a, i);
    }
    cout << Tong;
    break;
  }
}

int main() {
  int a;
  cin >> a;
  sum(a);
  return 0;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

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

int exp(int a, int n) {
  if (n == 0)
    return 1;
  else {
    int ret = exp(a, n - 1) * a;
    return ret;
  }
}

int main() {
  int a;
  cin >> a;
  int ans = 0;
  ans = exp(a, 3) + exp(a, 2) + exp(a, 1);
  cout << ans << endl;
}


Error: 0

Fixed submission:

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

int exp(int a, int n) {
  if (n > 0) {
    int ret = exp(a, n - 1) * a;
  } else if (n == 0)
    return (int)1;
}

int main() {
  int a;
  cin >> a;
  int ans = 0;
  ans = exp(a, 3) + exp(a, 2) + exp(a, 1);
  cout << ans << endl;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int a;
  cin >> a;
  int temp = 1;
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    temp *= a;
    ans += temp;
  }
  cout << ans << endl;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int a;
  cin >> a;
  cout << a * (a * a * a - 1) / (a - 1) << endl;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int a;
int main() {
  cin >> a;
  if (a == 1)
    cout << "3\\n";
  else
    cout << ((a * a * a * a - 1) / (a - 1)) - 1 << "\\n";
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int a;
int main() {
  cin >> a;
  cout << ((a * a * a * a - 1) / (a - 1)) - 1 << "\\n";
  return 0;
}
Problem p02621 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007

int main() {
  int a;
  string str;
  cin >> a;
  cout << a + a * a + a * a * a << "\\n";

  return 0;
}

Error: MLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007

long long int fastexpo(long long int a, long long int b) {
  long long int ans = 1;
  while (b) {
    if (b & 1)
      ans = (ans * a) % mod;
    b = b / 2;
    a = (a * a) % mod;
  }
  return ans;
}
bool vis[500000000] = {0};
bool child[50000000] = {0};
vector<int> vec[50000000];
int ans = 1;
int bfs(int node) {
  queue<int> qu;
  qu.push(node);
  while (!qu.empty()) {
    int t = qu.front();
    vis[t] = 1;
    qu.pop();
    //  cout << t << "\\n";
    for (int i = 0; i < vec[t].size(); i++) {
      if (child[t])
        if (!vis[vec[t][i]]) {
          qu.push(vec[t][i]);
          vis[vec[t][i]] = 1;
          //  child[vec[t][i]] = 1;
          ans++;
        }
      if (!child[t]) {
        if (!vis[vec[t][i]]) {
          qu.push(vec[t][i]);
          vis[vec[t][i]] = 1;
          child[vec[t][i]] = 1;
          // ans++;
        }
      }
    }
  }
  return ans;
}

int main() {
  int a;
  string str;
  cin >> a;
  cout << a + a * a + a * a * a << "\\n";

  return 0;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a;

  return 0;
}

Error: 1

Fixed submission:

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

int main() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a;

  return 1;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {

  int a;
  cin >> a;
  cout << a + a * a + a * a * a;
}

Error: -11

Fixed submission:

#include <iostream>
#include <vector>

const int MOD = 1e9 + 7;
std::vector<long long> fact, fact_inv, inv;

// 前処理
void init_nCk(int size) {
  fact.resize(size + 5);
  fact_inv.resize(size + 5);
  inv.resize(size + 5);
  fact[0] = fact[1] = 1;
  fact_inv[0] == 1;

  for (int i = 2; i < size + 5; i++) {
    fact[i] = fact[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
  }
}

long long nCk(int n, int k) {

  return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}

long long nPk(int n, int k) { return fact[n] * fact_inv[n - k] % MOD; }

int main() {
  int M, N;
  long long temp, ans;
  std::cin >> N >> M;
  for (int i = 0; i <= N; i++) {
    temp = nCk(N, i) * (1 - i % 2 * 2) * nPk(M, i) * (nPk(M - i, N - i)) *
           (nPk(M - i, N - i));
  }
  ans = nPk(M, N) * nPk(M, N) - temp;
  std::cout << ans;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int a;
  cin >> a;

  cout << a + (a * a) + (a * a * a) << endl;

  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b, s;
  cin >> a;
  b = (a * a * a * a - a);
  s = (b / (a - 1));
  cout << s << endl;
}
Problem p02621 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const int MAX = 510000;
const double pi = acos(-1);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a;
  cin >> a;
  if (a == 1) {
    cout << 3 << endl;
    return 0;
  }
  int ans = a * a * a * a;
  cout << (ans - 1) / (a - 1) - 1 << endl;

  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const int MAX = 510000;
const double pi = acos(-1);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a;
  cin >> a;
  int ans = a * a * a * a;
  cout << ans / (a - 1) << endl;

  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, len, ans = 0;
char s1[1000005], s2[1000005];
int main() {
  cin >> s1 >> s2;
  len = strlen(s1);
  // printf("%d\\n",len);
  for (i = 0; i < len; i++) {
    if (s1[i] != s2[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, len, ans = 0;
char s1[100005], s2[100005];
int main() {
  cin >> s1 >> s2;
  len = strlen(s1);
  // printf("%d\\n",len);
  for (i = 0; i < len; i++) {
    if (s1[i] != s2[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;
int main() {
  int i, count = 0;

  string str;
  string change_str;

  cin >> str;
  cin >> change_str;

  for (i = 0; i < change_str.length(); i++) {
    if (str[i] != change_str[i])
      count++;
  }

  cout << count;

  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <string>

using namespace std;
int main() {
  int i, str_len, count = 0;

  char str[256];
  char changed_str[256];
  string temp;

  cin >> str;
  cin >> changed_str;

  temp = str;
  str_len = temp.length();

  for (i = 0; i < str_len; i++) {
    if (str[i] != changed_str[i])
      count++;
  }

  cout << count;

  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
#include <string.h>

int main(void) {
  int j = 0;
  char s[200001], t[200001];
  scanf("%s%s", &s, &t);

  for (int i = 0; i <= strlen(s); i++)
    if (s[i] != t[i])
      j++;
  printf("%d", j);
  return 0;
}


Error: WA

Fixed submission:

// #include<stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
int main(void) {
  int j = 0;
  // string s,t;
  char s[200000], t[200000];
  scanf("%s%S", &s, &t);

  // cin >> s >> t;

  for (int i = 0; i < strlen(s); i++) {
    if (s[i] != t[i]) {
      j++;
    }
  }

  printf("%d", j);
  // cout << j << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <string>
#define ll long long
using namespace std;
int main() {
  string s;
  string t;
  ll cou = 0;
  cin >> s >> t;
  for (ll i = 0; i < s.size(); ++i) {
    if (s[i] == t[i]) {
      continue;
    } else {
      cou++;
    }
  }
  cout << cou;
}

Error: WA

Fixed submission:

#include <cstring>
#include <iostream>
using namespace std;
int main() {
  int x = 0, z = 0;
  char S[19999], T[19999];
  cin >> S;
  cin >> T;
  for (int i = 0; i <= strlen(S); i++) {
    if (S[i] == T[i]) {
      z++;
    } else {
      x++;
    }
  }
  if (0 == z) {
    cout << z << endl;
  } else {
    cout << x;
  }
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;

int main() {
  int Count = 0;
  string S, T;
  cin >> S >> T;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != T[i]) {
      Count += 1;
    }
  }
  cout << Count;

  return 0;
}


Error: WA

Fixed submission:

#include <cstring>
#include <iostream>

using namespace std;

int main() {
  int Count = 0;
  char S[200000];
  char T[200000];
  cin >> S >> T;
  for (int i = 0; i < strlen(S); i++) {
    if (S[i] != T[i]) {
      Count += 1;
    }
  }
  cout << Count;

  return 0;
}