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

#include <iostream>

using namespace std;

int main() {
  char a[1000000] = {0}, b[1000000] = {0};
  int i, flag = 0;
  cin >> b >> a;
  for (i = 0; i < 1000000; i++) {
    if (a[i] != b[i]) {
      flag = flag + 1;
    }
  }
  cout << flag << endl;
}

Error: WA

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  char a[200000] = {0}, b[200000] = {0};
  int i, flag = 0;
  cin >> b >> a;
  for (i = 0; b[i] != '\\n'; i++) {
    if (a[i] != b[i]) {
      flag = flag + 1;
    }
  }
  cout << flag << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

// Common file
#include <ext/pb_ds/assoc_container.hpp>
// Including tree_order_statistics_node_update
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set                                                            \\
  tree<int, null_type, less<int>, rb_tree_tag,                                 \\
       tree_order_statistics_node_update>

#define pb push_back
#define F first
#define S second
#define rep(i, n) for (int i = 0; i < (n); i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta                                                                  \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define ReadFile freopen("input.in", "r", stdin)
#define WriteFile freopen("output.txt", "w", stdout)
const ll mod7 = 1000000007, mod = 1000000000, OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi = acos(-1);
const ld rad = Pi / 180.0;
ll power(ll x, ll y, ll p) {
  ll res = 1;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
ll nCr(ll n, ll m) { return (m == 0) ? 1 : n * nCr(n - 1, m - 1) / m; }

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

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

  int len = s.length(), l = 0, r = 0;

  for (int i = 0; i < len; ++i)
    if (s[i] != t[i])
      ++l;
  for (int i = len - 1; i >= 0; --i)
    if (s[i] != t[i])
      ++r;

  cout << min(l, r) << "\\n";

  return 0;
}


Error: WA

Fixed submission:

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

int hs[100000];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  string s1, s2;
  cin >> s1 >> s2;
  int l = s1.size();
  for (int i = 0; i < l; i++) {
    if (s1[i] - s2[i] != 0) {
      hs[i] = 2;
    }
  }
  cout << count(hs, hs + s1.size(), 2);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java,
PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly,
HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere
in world.

*******************************************************************************/
#include <iostream>
#include <string.h>
using namespace std;

int main() {
  char ch1[400000];
  char ch2[400000];
  cin >> ch1 >> ch2;
  int n = strlen(ch1);
  int m = strlen(ch2);
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (ch1[i] != ch2[i]) {
      count++;
    }
  }
  cout << count;
  return 0;
}


Error: WA

Fixed submission:

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

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java,
PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly,
HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere
in world.

*******************************************************************************/
#include <iostream>
#include <string.h>
using namespace std;

int main() {
  char ch1[1000];
  char ch2[1000];
  cin >> ch1 >> ch2;
  int n = strlen(ch1);
  int m = strlen(ch2);
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (ch1[i] != ch2[i]) {
      count++;
    }
  }
  cout << count;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

/*
 * Project: AtCoder Beginners Contest 172 B - Minor Change
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/27
 * Copyright (c) 2020 toms74209200
 *
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;

string s;
string t;

void solve() {

  int cnt = 0;

  for (int i = 0; i < s.length(); i++) {
    if (s[i] != t[i]) {
      cnt++;
    }
  }
  printf("%d\\n", cnt);
}

int main() {

  cin >> s >> t;

  solve();
}

Error: 0

Fixed submission:

/*
 * Project: AtCoder Beginners Contest 172 B - Minor Change
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/27
 * Copyright (c) 2020 toms74209200
 *
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstring>
using namespace std;

char s[200000];
char t[200000];

void solve() {

  int cnt = 0;

  for (int i = 0; i < strlen(s); i++) {
    if (s[i] != t[i]) {
      cnt++;
    }
  }
  printf("%d\\n", cnt);
}

int main() {

  scanf("%s", s);
  scanf("%s", t);

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

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int count = 0;
  string s;
  string t;
  cin >> s;
  cin >> t;
  for (int i = 0; s[i] != '\\0'; i++) {
    if (s[i] != t[i]) {
      count++;
    }
  }
  cout << count << endl;

  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int count = 0;
  unsigned char s[200000];
  unsigned char t[200000];
  cin >> s;
  cin >> t;
  for (int i = 0; s[i] != '\\0'; i++) {
    if (s[i] != t[i]) {
      count++;
    }
  }
  cout << count << endl;

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

#include <iostream>
#include <string>
using namespace std;
int main() {
  int x = 0;
  string S, T;
  cin >> S >> T;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] != T[i])
      x += 1;
  }
  cout << x << "\\n";
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main() {
  int x;
  string S, T;
  cin >> S >> T;
  for (int i = 0;; i++) {
    if (S[i] != T[i])
      x += 1;
  }
  cout << x << "\\n";
}
Problem p02622 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
using namespace std;
int diff(string &a, string &b) {
  int ans = 0;
  for (int i = 0; i < 2 * 100000; ++i) {
    if (int(a[i]) >= int('a') && int(a[i]) <= int('z')) {
      if (a[i] != b[i])
        ans++;
    } else
      break;
  }
  return ans;
}
int main() {
  string a, b;
  cin >> a >> b;
  cout << diff(a, b) << endl;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int size(string a) {
  for (int i = 0; i <= 2 * 100000; ++i) {
    if (int(a[i]) >= int('a') && int(a[i]) <= int('z'))
      ;
    else
      return i;
  }
}
int diff(string a, string b) {
  int ans = 0;
  for (int i = 0; i < size(a); ++i) {
    if (a[i] != b[i])
      ans++;
  }
  return ans;
}
int main() {
  string a, b;
  cin >> a >> b;
  cout << diff(a, b) << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

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

Error: -11

Fixed submission:

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

int main() {
  char s[20000], t[20000];
  int count = 0;
  cin >> s >> t;
  for (int i = 0; i < 200000; i++) {
    if (s[i] == t[i])
      count++;
  }
  cout << count << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  int count = 0;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != t.at(i)) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

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>
using namespace std;
int main() {
  string s, t;
  int count = s.size();
  int n = s.size() + 1;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == t.at(i)) {
      count = count - 1;
    }
  }
  cout << count << endl;
  return 0;
}
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 p = pair<int, int>;
typedef long long ll;

int main() {
  char s[1000000], t[1000000];
  cin >> s >> t;
  ll k = 0;
  ll m = strlen(s);
  rep(i, m) {
    if (s[i] != t[i]) {
      k++;
    }
  }
  cout << k << endl;
  return 0;
}

Error: 0

Fixed submission:

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

using namespace std;
using p = pair<int, int>;
typedef long long ll;

int main() {
  char s[100000], t[100000];
  cin >> s >> t;
  ll k = 0;
  ll m = strlen(s);
  rep(i, m) {
    if (s[i] != t[i]) {
      k++;
    }
  }
  cout << k << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <iostream>

using namespace std;

int main() {
  string S, T;

  cin >> S >> T;

  int len = S.size();
  int ans = 0;
  for (int i = 0; i < len; i++)
    if (S[i] != T[i])
      ++ans;

  cout << ans;
}


Error: WA

Fixed submission:

#include <cstring>
#include <iostream>

using namespace std;

int main() {
  char S[200000], T[200000];

  cin >> S >> T;

  int ans = 0;
  for (int i = 0; i < strlen(S); i++)
    if (S[i] != T[i])
      ans++;

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

#include <stdio.h>
#define N 200005
int n, m, i, j, k;
char a[N], b[N];
int main() {
  scanf("%s%s", a, b);
  for (i = 0; a[i]; i++) {
    n += a[i] != b[i];
  }
  printf("%d\\n", n);
  return 0;
}

Error: 0

Fixed submission:

#include <stdio.h>
int n, m, i, j, k;
char a[100005], b[100005];
int main() {
  scanf("%s%s", a, b);
  for (i = 0; a[i]; i++) {
    n += a[i] != b[i];
  }
  printf("%d\\n", n);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

int main() {

  string S, T;
  int n = 0, sum = 0;

  cin >> S >> T;
  S.c_str();
  T.c_str();

  for (int i = 0; S[i] != '\\0'; i++) {
    int j = (int)S[i];
    int k = (int)T[i];
    if (j == k)
      n++;
    sum++;
  }
  printf("%d\\n", sum - n);
}

Error: WA

Fixed submission:

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

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

  int n = 0;
  cin >> s >> t;

  for (long unsigned int i = 0; i < strlen(s); i++) {
    int j = s[i];
    int k = t[i];
    if (j == k)
      n++;
  }

  cout << sizeof(s) - n << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

// 設定言語check
#include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <string>
using namespace std;

int lenght(char *str) {
  int i = 0;
  while (str[i]) {
    i++;
  }
  return i;
}

int main() {
  char S[200005], T[200005];
  int N, ans = 0, check = 0, len;
  cin >> S >> T;
  len = lenght(S);
  for (int i = 0; i < len; i++) {
    if (S[i] != T[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Error: 0

Fixed submission:

// 設定言語check
#include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <string>
using namespace std;

int lenght(char *str) {
  int i = 0;
  while (str[i]) {
    i++;
  }
  return i;
}

int main() {
  char S[200000], T[200000];
  int N, ans = 0, check = 0, len;
  cin >> S >> T;
  len = lenght(S);
  for (int i = 0; i < len; i++) {
    if (S[i] != T[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>

using namespace std;

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

  int len = S.size(), counter = 0;

  for (int i = 0; i < len; i++) {
    if (S[i] != T[i])
      counter++;
  }

  cout << counter << endl;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

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

  int i = 0, counter = 0;

  while (1) {
    if (S[i] == T[i])
      counter++;

    if (i == S.size() - 1)
      break;
  }

  cout << counter << 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) < (n); (i)++)
typedef long long ll;

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


Error: WA

Fixed submission:

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

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

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

using namespace std;
typedef long long llong;

#define MAX 200010

int main() {
  int ans = 0;
  char S[MAX], T[MAX];

  scanf("%s", S);
  scanf("%s", T);

  int len = strlen(S);
  for (int i = 0; i < len; i++) {
    if (S[i] != T[i])
      ans++;
  }

  printf("%d\\n", ans);

  return 0;
}

Error: 0

Fixed submission:

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

using namespace std;
typedef long long llong;

#define MAX 20001

int main() {
  int ans = 0;
  char S[MAX], T[MAX];

  scanf("%s", S);
  scanf("%s", T);

  int len = strlen(S);
  for (int i = 0; i < len; i++) {
    if (S[i] != T[i])
      ans++;
  }

  printf("%d\\n", ans);

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s, t;
  getline(cin, s);
  getline(cin, t);
  int k = 0;
  for (int i = 0; i < s.size(); i++)
    if (t[i] != s[i])
      k++;

  cout << k;
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  char s[20000], t[20000];
  cin >> s >> t;
  int k = 0;
  for (int i = 0; i < strlen(s); i++)
    if (t[i] != s[i])
      k++;

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

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

int main() {
  int score = 0;
  string S1;
  string S2;
  cin >> S1 >> S2;

  for (int i = 0; i < S1.length(); i++) {
    if (S1[i] != S2[i])
      score++;
  }

  cout << score;
  return 0;
}


Error: WA

Fixed submission:

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

int main() {
  int score = 0;
  string S1;
  string S2;
  cin >> S1, S2;
  for (int i = 0; i < S1.length(); i++) {
    if (S1[i] != S2[i])
      score++;
  }
  cout << score;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  string A, B;
  cin >> A >> B;
  int count = 0;
  int n = A.size();
  for (int i = 0; i < n; i++) {
    if (A[i] != B[i])
      count++;
  }
  cout << count << endl;
}

Error: -11

Fixed submission:

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

int main() {
  char A[200000], B[200000];
  cin >> A >> B;
  int count = 0;
  for (int i = 0; A[i] != '\\n'; i++) {
    if (A[i] != B[i])
      count++;
  }
  cout << count;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
#include <string.h>
int main() {
  char S[200001], T[200001];
  long long a = 0;
  if (!scanf("%s %s", S, T))
    return 0;
  for (long long i = 0; i < (long long)strlen(S); i++) {
    if (S[i] != T[i])
      a++;
  }
  return printf("%lld\\n", a), 0;
}

Error: 0

Fixed submission:

#include <stdio.h>
#include <string.h>
int main() {
  char S[200000], T[200000];
  long long a = 0;
  if (!scanf("%s %s", S, T))
    return 0;
  for (long long i = 0; i < (long long)strlen(S); i++) {
    if (S[i] != T[i])
      a++;
  }
  return printf("%lld\\n", a), 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  char S[200001];
  char T[200001];
  cin >> S >> T;

  int64_t l = strlen(S);
  int count = 0;
  for (int i = 0; i < l; i++) {
    if (S[i] != T[i]) {
      count++;
    } else {
    }
  }

  cout << count << endl;
  return 0;
}


Error: 0

Fixed submission:

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

int main() {
  char S[200000];
  char T[200000];
  cin >> S >> T;

  int64_t l = strlen(S);
  int count = 0;
  for (int i = 0; i < l; i++) {
    if (S[i] != T[i]) {
      count++;
    }
  }

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

/*
    author: Ibrahim-Elsayed (Codeforces Handle)
    date: 8/01/2020
*/
//======================================================================
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1e18
#define N_INF -1e18
#define MD 1000000007
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double PI = 3.141592653589793;
//======================================================================

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

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

  cout << ans;
  return 0;
}


Error: -6
munmap_chunk(): invalid pointer


Fixed submission:

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

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

  int ans = 0;
  string s, t;
  cin >> s >> t;
  vector<int> v1((int)s.length(), 0), v2((int)t.length(), 0);
  for (char c : s) {
    v1[c - 'a']++;
  }
  for (char c : t) {
    v2[c - 'a']++;
  }
  for (int i = 0; i < 25; i++) {
    if (v1[i] < v2[i]) {
      ans++;
    }
  }

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\\n", a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
using namespace std;

int main() {
  char s[200001], t[200001];
  rep(i, 200001) { s[i] = t[i] = '\\0'; }
  scanf("%s", s);
  scanf("%s", t);
  int counter = 0;
  rep(i, 200001) {
    if (s[i] != t[i]) {
      counter++;
    }
  }
  printInt(counter);
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\\n", a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
using namespace std;

int main() {
  char s[20001], t[20001];
  rep(i, 20001) { s[i] = t[i] = '\\0'; }
  scanf("%s", s);
  scanf("%s", t);
  int counter = 0;
  rep(i, 20001) {
    if (s[i] != t[i]) {
      counter++;
    }
  }
  printInt(counter);
  return 0;
}
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>;

const int M = 200005;

int main() {
  char S[M] = "";
  char T[M] = "";
  cin >> S;
  cin >> T;

  int ans = 0;
  rep(i, strlen(S)) {
    if (S[i] != T[i])
      ++ans;
  }

  cout << ans << endl;

  return 0;
}

Error: 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>;

const int M = 100005;

int main() {
  char S[M] = "";
  char T[M] = "";
  cin >> S;
  cin >> T;

  int ans = 0;
  rep(i, strlen(S)) {
    if (S[i] != T[i])
      ++ans;
  }

  cout << ans << endl;

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

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

  char s[2000000];
  char t[2000000];
  cin >> s >> t;
  int ans = 0;
  int size = strlen(s);

  for (int i = 0; i < size; i++) {
    if (s[i] != t[i]) {
      ans += 1;
    } else {
      continue;
    }
  }
  cout << ans << endl;
  return 0;
}

Error: 0

Fixed submission:

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

  char s[200000];
  char t[200000];
  cin >> s >> t;
  int ans = 0;
  int size = strlen(s);

  for (int i = 0; i < size; i++) {
    if (s[i] != t[i]) {
      ans += 1;
    } else {
      continue;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Time Limit Exceeded

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, a;
  int o = 0;
  cin >> s >> a;
  for (int i = 0; i < s.length(); i++)
    for (int j = 0; j < a.length(); j++)
      if (s[i] != a[j] && i == j)
        o++;
  cout << o;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string s, t;
  cin >> s >> t;
  int cnt = 0;
  int x = s.size();
  for (int i = 0; i < x; i++) {
    if (s.at(i) != t.at(i)) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

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

#include <iostream>
using namespace std;

int main() {
  char s[200001], t[200001];
  int ct = 0;
  cin >> s;
  cin >> t;
  for (int i = 0; s[i] != '\\0'; i++) {
    ct += (s[i] != t[i]);
  }
  cout << ct << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  char s[200000], t[200000];
  int ct = 0;
  cin >> s;
  cin >> t;
  for (int i = 0; s[i] != '\\0'; i++) {
    ct += (s[i] != t[i]);
  }
  cout << ct << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  string s, t;

  cin >> s >> t;

  int i = 0, c = 0;
  while (s[i] != 0) {
    if (s[i] != t[i]) {
      s[i] = t[i];
      c++;
    }
    i++;
  }
  cout << c << endl;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  char s[200000], t[200000];
  cin >> s >> t;

  int i = 0, c = 0;
  while (s[i] != 0) {
    if (s[i] != t[i]) {
      s[i] = t[i];
      c++;
    }
    i++;
  }
  cout << c << endl;
}