alexjercan/bugnet huggingface dataset:
Problem p02622 (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;
  string str1;
  cin >> str;
  cin >> str1;
  int count = 0;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] != str1[i])
      count++;
  }
  cout << count << "\\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;
  string str1;
  cin >> str;
  cin >> str1;
  int count = 0;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] != str1[i])
      count++;
  }
  cout << count << "\\n";

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

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

int main() {
  string s, p;
  cin >> s >> p;
  int c = 0;
  if (s == p) {
    cout << 0;
  } else {
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != p[i]) {
        c += 1;
      }
    }

    cout << c;
  }
}

Error: -11

Fixed submission:

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

int main() {
  string s, p;
  cin >> s >> p;
  int c = 0;
  for (char i = 'a'; i <= 'z'; i++) {
    c += abs(count(s.begin(), s.end(), i) - count(p.begin(), s.end(), i));
  }

  cout << c;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

int main(void) {
  char s[200010];
  scanf("%s", s);
  char t[200010];
  scanf("%s", t);
  int count = 0;

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

  printf("%d\\n", count);
  return 0;
}

Error: 0

Fixed submission:

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

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

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

  printf("%d\\n", count);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main() {
  string s, t;

  cin >> s >> t;

  int sum = 0;
  for (int j = 0; j < s.size(); j++) {
    if (s[j] != t[j])
      sum++;
  }
  cout << sum;
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  char s[20005], t[20005];

  int i = 0;
  while (cin >> s[i]) {
    i++;
  }
  i = 0;
  while (cin >> t[i]) {
    i++;
  }

  int sum = 0;
  for (int j = 0; j < i; j++) {
    if (s[j] != t[j])
      sum++;
  }
  cout << sum;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int cnt = 0, i = 0;
  while (s[i]) {
    if (s[i] != t[i])
      cnt++;
    i++;
  }
  cout << cnt;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
  ll n, m, k;
  scanf("%lld%lld%lld", &n, &m, &k);
  ll a[n + 1], b[m + 1];
  for (int i = 0; i < n; i++)
    scanf("%lld", &a[i]);
  for (int i = 0; i < m; i++)
    scanf("%lld", &b[i]);
  ll ans = 0, j = 0, l = 0, cnt = 0;
  while (ans < k && (j < n || l < m)) {
    if (a[j] < b[l] && j < n) {
      ans += a[j];
      j++;
      cnt++;
    } else if (l < m) {
      ans += b[l];
      l++;
      cnt++;
    }
    // printf("%lld\\n",ans);
  }
  if (ans == k)
    printf("%lld", cnt);
  else if (cnt != 0)
    printf("%lld", cnt - 1);

  else
    printf("0");

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  int l, cnt = 0;
  cin >> s;
  cin >> t;
  l = s.length();
  for (int i = 0, j = 0; i < l, j < t.length(); i++, j++) {
    if (s[i] != t[j]) {
      cnt++;
    }
  }
  cout << cnt;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[1000];
  char t[1000];
  int l, cnt = 0;
  cin >> s;
  cin >> t;
  l = strlen(s);
  for (int i = 0, j = 0; i < l, j < strlen(t); i++, j++) {
    if (s[i] != t[j]) {
      cnt++;
    }
  }
  cout << cnt;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

#define _LL long long

int main() {
  string s, t;
  cin >> s;
  cin >> t;

  int ans = 0;
  for (int i = 0; i < (int)s.length(); i++) {
    if (s[i] != t[i])
      ans++;
  }

  cout << ans;

  return 0;
}

Error: 1

Fixed submission:

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

#define _LL long long

int main() {
  string s, t;
  cin >> s;
  cin >> t;

  int ans = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != t[i])
      ans++;
  }

  cout << ans;

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

/***** author :  C0d1ngPhenomena *****/

#include <bits/stdc++.h>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#define endl "\\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(), c.end()
#define mp(x, y) make_pair(x, y)
#define mem(a, val) memset(a, val, sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define pb push_back

using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  char arr1[1000000];
  char arr2[1000000];
  cin >> arr1 >> arr2;
  ll sum = 0;
  for (int i = 0; i < strlen(arr1); ++i) {
    if (arr1[i] != arr2[i])
      sum++;
  }

  cout << sum;
  return 0;
}


Error: WA

Fixed submission:

/***** author :  C0d1ngPhenomena *****/

#include <bits/stdc++.h>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#define endl "\\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(), c.end()
#define mp(x, y) make_pair(x, y)
#define mem(a, val) memset(a, val, sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define pb push_back

using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  char arr1[10000];
  char arr2[10000];
  cin >> arr1 >> arr2;
  ll sum = 0;
  for (int i = 0; i < strlen(arr1); ++i) {
    if (arr1[i] != arr2[i])
      sum++;
  }

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

#include <iostream>
using namespace std;

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


Error: 0

Fixed submission:

#include <stdio.h>

int mc(char *s, char *t) {
  int result = 0;
  for (int i = 0; s[i] != '\\0'; i++) {
    if (s[i] != t[i]) {
      s[i] = t[i];
      result++;
    }
  }
  return result;
}

int main(void) {
  char S[199999];
  char T[199999];
  int ret;
  ret = scanf("%s", S);
  if (ret == EOF) {
    printf("scanfでエラー\\n");
    return -1;
  }
  scanf("%s", T);
  if (ret == EOF) {
    printf("scanfでエラー\\n");
    return -1;
  }
  printf("%d\\n", mc(S, T));
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <istream>
#include <vector>
#define rep(I, N) for (int I = 0; I < N; I++)
using ll = long long int;
using namespace std;

int main() {
  ll N = 0;
  char s[2000000], t[2000000];

  cin >> s;
  cin >> t;
  string S = s;
  rep(i, S.size()) {
    if (!(s[i] == t[i]))
      N++;
  }
  cout << N;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <istream>
#include <vector>
#define rep(I, N) for (int I = 0; I < N; I++)
using ll = long long int;
using namespace std;

int main() {
  int N = 0;
  char s[200000], t[200000];
  vector<char> ss(0);
  vector<char> tt(0);

  cin >> s;
  cin >> t;
  string S = s;
  rep(i, S.size()) {
    if (!(s[i] == t[i]))
      N++;
  }
  cout << N;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <iterator>
#include <math.h>
#include <set>
#include <vector>

#define lp(i, a, n) for (int i = a; i < n; ++i)
#define rep(i, a, n) for (ll i = a; i <= n; ++i)
#define all(v) v.begin(), v.end()
#define clr(n, a) memset(n, a, sizeof(n))
#define vi vector<int>
#define sc set<char>
#define si set<int>
#define pb push_back
#define vb vector<bool>
#define pi(n) printf("%d\\n", n)
#define ln "\\n"
#define mahmoud_abdelsamie                                                     \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  mahmoud_abdelsamie string s, t;
  int cnt = 0;
  cin >> s >> t;
  for (int i = 0; i < s.size() && s != t; ++i) {
    if (s[i] == t[i])
      continue;
    else {
      t[i] = s[i];
      ++cnt;
    }
  }
  cout << cnt << ln;
  return 0;
}


Error: WA

Fixed submission:

#include <cstring>
#include <iostream>
using namespace std;

int main() {
  int x = 0;
  int z = 0;
  char S[199999], T[199999];
  cin >> S >> T;
  for (int i = 0; i < strlen(S); i++) {
    if (S[i] == T[i])
      z++;
    else
      x++;
  }
  if (z == 0)
    cout << z;
  else
    cout << x;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

using namespace std;

int main() {

  string s, k;
  cin >> s >> k;
  int num = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != k[i]) {
      num++;
    }
  }

  cout << num << endl;

  return 0;
}


Error: 0

Fixed submission:

#include <cstring>
#include <iostream>
using namespace std;

int main() {
  long limit = 2 * (10 ^ 5);
  char str1[limit];
  cin >> str1;
  char str2[limit];
  cin >> str2;
  int answer = 0;
  int size_ = strlen(str1);
  for (int i = 0; i < size_; i++) {
    if (str1[i] != str2[i]) {
      answer++;
    }
  }

  cout << answer << endl;

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[200006], t[200006];
  cin >> s >> t;
  int l, c = 0, i;
  l = strlen(s);
  for (i = 0; i < l; i++) {
    if (s[i] != t[i])
      c++;
  }
  cout << c << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100006], t[100006];
  cin >> s >> t;
  int l, c = 0, i;
  l = strlen(s);
  for (i = 0; i < l; i++) {
    if (s[i] != t[i])
      c++;
  }
  cout << c << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string S, T;
  cin >> S >> T;

  int N = S.size();
  int sum = 0;

  if (S == T) {
    cout << 0 << endl;
  } else {
    for (int i = 0; i < N; i++) {

      if (S.at(i) != T.at(i)) {
        sum++;
      } else {
        sum += 0;
      }
    }
    cout << sum << endl;
  }
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 11) >= this->size() (which is 11)


Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string S, T;
  cin >> S >> T;

  int sum = 0;

  if (S == T) {
    cout << 0 << endl;
  } else {
    for (int i = 0; i < 20000; i++) {

      if (S.at(i) != T.at(i)) {
        sum++;
      } else {
        sum += 0;
      }
    }
  }

  cout << sum << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;

int main() {
  string s, t;
  int num = 0;

  cin >> s >> t;

  for (int i = 0; i < (int)s.size(); ++i) {
    if (s[i] != t[i]) {
      num++;
    }
  }

  cout << num;
}

Error: WA

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main() {
  string s, t;
  int num = 0;

  cin >> s, t;

  for (int i = 0; i < (int)s.size(); ++i) {
    if (s[i] != t[i]) {
      num++;
    }
  }

  cout << num;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <cstring>
using namespace std;
int main() {
  int c = 0, i = 0;
  string s, t;
  cin >> s >> t;
  int x = s.length();
  while (x--) {
    if (s[i] != t[i])
      c++;
    i++;
  }
  cout << c;
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int i = 0, c = 0, x = 0;
  char ch[200], d[200];
  while (cin >> ch[i]) {
    c++;
  }
  for (i = 0; i <= c; i++) {
    cin >> d[i];
    if (d[i] != ch[i])
      x++;
  }
  cout << x;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  char S[200001], T[200001];
  int ans = 0, j = 0;
  cin >> S >> T;
  while (S[j] != '\\0') {
    j++;
  }

  for (int i = 0; i < j; i++) {
    if (S[i] != T[i])
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  char S[200000], T[200000];
  int ans = 0, j = 0;
  cin >> S >> T;
  while (S[j] != '\\0') {
    j++;
  }

  for (int i = 0; i < j; i++) {
    if (S[i] != T[i])
      ans++;
  }
  cout << ans << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  const int NUM = 2000000;
  char S[NUM], T[NUM];
  cin >> S >> T;
  int a = 0;
  for (int i = 0; S[i] != '\\0'; i++) {
    if (S[i] != T[i]) {
      a = a + 1;
    }
  }
  cout << a;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  const int num = 200000;
  char S[num], T[num];
  cin >> S;
  cin >> T;
  int a = 0;
  for (int i = 0; S[i] != '\\0'; i++) {
    if (S[i] != T[i]) {
      a++;
    }
  }
  cout << a;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  string S;
  string T;
  cin >> S >> T;
  int ans = 0;
  int N = S.size();
  for (long long int i = 0; i < N; i++) {
    if (S[i] != T[i]) {
      ans += 1;
    }
  }
  cout << ans << endl;
}


Error: -11

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  string S;
  string T;
  cin >> S >> T;
  int ans = 0;
  for (long long int i = 0; i < 2 * 10000; i++) {
    if (S[i] != T[i]) {
      ans += 1;
    }
  }
  cout << ans << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
char s[200005], t[200005];
int main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  int d = 0;
  for (int i = 1; i <= 200005; i++) {
    if (s[i] == 0)
      break;
    if (s[i] != t[i]) {
      d++;
    }
  }
  printf("%d", d);
  return 0;
}

Error: WA

Fixed submission:

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int a, b = 0;
  for (int i = 0; i <= 10086; i++) {
    if (s[i] != t[i]) {
      b++;
    }
  }
  printf("%d", b);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, ans;
char s[1000005], t[1000005];
int main() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; i++) {
    if (s[i] != t[i])
      ans++;
  }
  cout << ans;
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, ans;
char s[10005], t[10005];
int main() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; i++) {
    if (s[i] != t[i])
      ans++;
  }
  cout << ans;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error


#include <cstdio>
#include <cstring>
using namespace std;
const int maxn = 2 * 1e5 + 10;
char a[maxn], b[maxn];
int ans = 0;
int main() {
  scanf(" %s %s", a, b);
  int len = strlen(a);
  for (int i = 0; i < len; ++i) {
    if (a[i] != b[i])
      ans++;
  }
  printf("%d\\n", ans);
  return 0;
}

Error: 0

Fixed submission:

#include <cstdio>
#include <cstring>
using namespace std;

char a[1000], b[1000];
int ans = 0;
int main() {
  scanf(" %s %s", a, b);
  int len = strlen(a);
  for (int i = 0; i < len; ++i) {
    if (a[i] != b[i])
      ans++;
  }
  printf("%d\\n", ans);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
string s, t;

int main() {
  ios_base::sync_with_stdio(false);
  cin >> s >> t;
  int c = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) {
      c++;
    }
  }
  cout << c;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
string s, t;

int main() {
  ios_base::sync_with_stdio(false);
  cin >> s, t;
  int c = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i])
      c++;
  }
  cout << c;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string S, T;
  int p = 0;
  cin >> S >> T;
  int a = S.size();
  for (int i = 0; i < a; i++) {
    if (S.at(i) == T.at(i)) {
      p++;
    }
  }
  cout << a - p << endl;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 0) >= this->size() (which is 0)


Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string s, t;
  int p = 0;
  cin >> s, t;
  for (int i = 0; i < s.size() + 1; i++) {
    if (s.at(i) == t.at(i)) {
      p++;
    }
  }
  cout << s.size() - p << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main(void) {
  char s[200001], t[200001];
  int i, cnt = 0;

  scanf("%s", s);
  scanf("%s", t);
  for (i = 0; s[i] != '\\0'; i++) {
    if (s[i] != t[i])
      cnt++;
  }

  printf("%d", cnt);

  return 0;
}

Error: WA

Fixed submission:

#include <stdio.h>

int main(void) {
  char s[20001], t[20001];
  int i, cnt = 0;

  scanf("%s", s);
  scanf("%s", t);
  for (i = 0; s[i] != '\\0'; i++) {
    if (s[i] != t[i])
      cnt++;
  }

  printf("%d", cnt);

  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
using namespace std;

int main() {
  int count = 0;
  unsigned int n;
  string s, t;
  cin >> s >> t;
  for (n = 0; n < s.size(); n++) {
    if (s[n] != t[n]) {
      s[n] = t[n];
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main() {
  int count = 0;
  unsigned char n;
  string s, t;
  cin >> s >> t;
  for (n = 0; n < s.size(); n++) {
    if (s[n] != t[n]) {
      s[n] = t[n];
      count++;
    }
  }
  cout << count << endl;
  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);
  scanf("%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 <string.h>

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

  for (int i = 0; i <= strlen(s); i++)
    if (s[i] != t[i])
      j++;
  printf("%d", j);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S;
  string T;
  int count = 0;
  int ans = 0;
  cin >> S >> T;

  count = S.length();

  for (int i = 0; i < count; i++) {
    if (S[i] != T[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define array 2 * 10 ^ 5

int main() {
  char S[array];
  char T[array];
  int count = 0;
  int ans = 0;
  cin >> S >> T;

  while (S[count] != '\\0') {
    count++;
  }

  for (int i = 0; i < count; i++) {
    if (S[i] != T[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main() {
  int leng, i, j, cnt = 0;
  //    char s[100005],t[100005];
  string s, t;
  //    scanf(" %s %s",s,t);
  //    leng = s.size();
  //    cout<<leng;
  cin >> s >> t;
  for (i = 0; i < (s.length()); i++) {
    if (s[i] != t[i])
      cnt++;
  }
  printf("%d\\n", cnt);
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  int len, i, j, cnt = 0;
  char s[100005], t[100005];
  scanf(" %s %s", s, t);
  len = strlen(s);
  for (i = 0; i < len; i++) {
    if (s[i] != t[i])
      cnt++;
  }
  printf("%d\\n", cnt);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int count = 0, n;
  string a, b;

  cin >> a >> b;
  n = a.size();
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i])
      count++;
  }

  cout << count;
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
int main() {
  char a[2 * (10 ^ 5)], b[2 * (10 ^ 5)];

  cin >> a >> b;

  ll n = strlen(a);
  ll count = 0;

  for (ll i = 0; i < n; i++) {
    if (a[i] != b[i])
      count++;
  }

  cout << count;

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

#include <iostream>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.length(), cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i])
      cnt++;
  }
  cout << cnt << endl;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.length(), cnt = 0;
  int dp[26] = {0};
  for (int i = 0; i < n; i++) {
    dp[s[i] - 'a']++;
    dp[t[i] - 'a']++;
  }
  for (int i = 0; i < n; i++) {
    if (dp[i] % 2)
      cnt++;
  }
  cout << cnt << endl;
}