alexjercan/bugnet huggingface dataset:
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;
typedef long long ll;
const int mod = 1000000007;

int main() {
  char s[2 * 100000 + 1] = {};
  char t[2 * 100000 + 1] = {};
  cin >> s >> t;
  int p = strlen(s);
  int ans = 0;
  rep(i, p) {
    if (s[i] != t[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}

Error: 0

Fixed submission:

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

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

#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
  char M[200020], R[200010];
  int count = 0, i = 0;
  cin >> M >> R;
  // cout << M << ' ' << R;
  while (M[i] != NULL) {
    if (M[i] != R[i]) {
      count++;
    }
    i++;
  }
  cout << count << endl;
}

Error: 0

Fixed submission:

#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
  char M[100020], R[100010];
  int count = 0, i = 0;
  cin >> M >> R;
  // cout << M << ' ' << R;
  while (M[i] != NULL) {
    if (M[i] != R[i]) {
      count++;
    }
    i++;
  }
  cout << count << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

// const int N=1e5;
#define INF 1e9
#include <bits/stdc++.h>
using namespace std;

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

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int t = 1;
  // cin >> t;
  while (t--) {
    sol();
  }

  return 0;
}

Error: WA

Fixed submission:

// const int N=1e5;
#define INF 1e9
#include <bits/stdc++.h>
using namespace std;
const int mxn = 2001;
int memo[mxn][mxn];
int minoperation(string s, string t) {
  int m = s.length();
  int n = t.length();

  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= n; j++) {
      if (i == 0 && j == 0)
        memo[i][j] = 0;
      else if (i == 0)
        memo[i][j] = j;
      else if (j == 0)
        memo[i][j] = i;
      else if (s[i - 1] == t[j - 1])
        memo[i][j] = memo[i - 1][j - 1];
      else
        memo[i][j] =
            1 + min(min(memo[i - 1][j], memo[i][j - 1]), memo[i - 1][j - 1]);
    }
  }
  return memo[m][n];
}

void sol() {
  string s, t;
  cin >> s;
  cin >> t;

  cout << minoperation(s, t);
}

int main() {
  // std::ios::sync_with_stdio(false);
  // cin.tie(nullptr);
  // cout.tie(nullptr);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int t = 1;
  // cin >> t;
  while (t--) {
    sol();
  }

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

#include <cstring>
#include <iostream>
#include <stdio.h>
#define N 200005
using namespace std;
char s[N], t[N];
int n, i, ans;
int main() {
  scanf("%s\\n%s", s, t);
  n = strlen(s);
  for (i = 0; i < n; i++) {
    if (s[i] != t[i])
      ans++;
  }
  printf("%d", ans);
  return 0;
}

Error: WA

Fixed submission:

#include <cstring>
#include <iostream>
#include <stdio.h>
#define N 100005
using namespace std;
char s[N], t[N];
int n, i, ans;
int main() {
  scanf("%s\\n%s", s, t);
  n = strlen(s);
  for (i = 0; i < n; i++) {
    if (s[i] != t[i])
      ans++;
  }
  printf("%d", ans);
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>

int main() {
  using namespace std;
  char a[300000], b[300000];
  long long s = 0, o;
  cin >> a >> b;
  o = strlen(a);
  for (long long i = 0; i < o; ++i) {
    if (a[i] != b[i])
      s++;
  }
  cout << s;

  return 0;
}

Error: WA

Fixed submission:

#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>

int main() {
  using namespace std;
  char a[100000], b[100000];
  int s = 0, o;
  cin >> a >> b;
  o = strlen(a);
  for (int i = 0; i < o; ++i) {
    if (a[i] != b[i])
      s++;
  }
  cout << s;

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  int count = 0;
  cin >> s;
  cin >> t;

  int l1 = s.length();
  int l2 = t.length();

  for (int i = 0, j = 0; i < l1, j < l2; i++, j++) {

    if (i != j) {
      continue;
    } else if (s[i] != t[j]) {
      count++;
    }
  }
  cout << count << endl;
  count = 0;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  int count = 0;
  cin >> s;
  cin >> t;
  int l1 = s.length();
  int l2 = s.length();

  for (int i = 0; i < l1; i++) {
    for (int j = 0; j < l2; j++) {

      if (i != j) {
        continue;
      } else if (s[i] != t[j]) {
        count++;
      }
    }
  }
  cout << count << endl;
  count = 0;
  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 a = s.length();
  char c[a];
  char d[a];

  for (int i = 0; i < a; i++) {
    c[i] = s[i];
    d[i] = t[i];
  }

  int e = 0;

  for (int i = 0; i < a; i++) {
    if (c[i] != d[i]) {
      e++;
    }
  }

  cout << e << endl;
  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  vector<string> s;
  vector<string> t;

  for (int i = 0; i < 20001; i++) {
    cin >> s[i];
  }

  for (int i = 0; i < 20001; i++) {
    cin >> t[i];
  }

  int j = 0;
  int cont = 0;
  while (s != t) {
    if (s[j] != t[j]) {
      s[j] = t[j];
    }
    j++;
    cont++;
  }

  cout << cont << endl;

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

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

int main() {
  int a, c = 0;
  char s[200001], t[200001];

  cin >> s >> t;
  for (int i = 0; i < strlen(s); i++) {
    if (s[i] != t[i])
      c++;
  }
  cout << c << endl;
  return 0;
}


Error: 0

Fixed submission:


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

int main() {
  int a, c = 0;
  char s[100001], t[100001];

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

// seabreeeze //

#include <bits/stdc++.h>

using namespace std;

#define lli long long
lli MOD = 1e9 + 7;

#define MAXN 2000006

// Template function //
lli powermod(lli x, lli y) {
  lli res = 1;
  x = x % MOD;
  if (x == 0)
    return 0;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % MOD;
    y = y >> 1;
    x = (x * x) % MOD;
  }
  return res;
}
lli modinv(lli x) { return powermod(x, MOD - 2); }
// Template functions end //

// Custom funtions //
lli tree[MAXN];

void buildTree(vector<lli> a, int n) {
  for (int i = 0; i < n; i++)
    tree[n + i] = a[i];
  for (int i = n - 1; i > 0; i--) {
    tree[i] = min(tree[i << 1], tree[i << 1 | 1]);
  }
}

void updateTree(int n, int p, lli value) {
  tree[p + n] = value;
  p += n;
  for (int i = p; i > 1; i >>= 1)
    tree[i >> 1] = min(tree[i], tree[i ^ 1]);
}

lli queryTree(int n, int l, int r) {
  lli res = INT_MAX;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1)
      res = min(res, tree[l++]);
    if (r & 1)
      res = min(res, tree[--r]);
  }
  return res;
}

// Custom functions end //

int main() {
  lli q = 1;
  // cin>>q;
  time_t start, end;
  time(&start);
  for (lli tc = 1; tc <= q; tc++) {
    // Start solution //
    string s, t;
    cin >> s >> t;
    int n = s.length(), ans = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] != t[i])
        ans++;
    }
    cout << ans << endl;
  end:;
    // End Solution //
  }

  time(&end);
  // cout<<fixed<<double(end - start)<<setprecision(10)<<endl;
  return 0;
}

Error: 4

Fixed submission:

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


#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  long long int a, b, c, d, i, x[100000], y = 0;
  // char s[100000],z[100000];
  string s, z;
  cin >> s >> z;
  for (i = 0; s[i]; i++) {
    if (s[i] != z[i]) {
      y++;
    }
  }
  cout << y << endl;
}


Error: 0

Fixed submission:


#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  long long int a, b, c, d, i, x[100000], y = 0;
  char s[100000], z[100000];
  cin >> s >> z;
  for (i = 0; s[i]; i++) {
    if (s[i] != z[i]) {
      y++;
    }
  }
  cout << y << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main() {
  //    vector <> vec;
  //    vec.clear;
  // char a[10000],b[10000];
  string a, b;
  int n, c = 0;
  cin >> a >> b;
  //  cout<< b+a+t <<endl;
  //    while (t--){}
  //    n=strlen(a);
  n = a.size();
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i])
      c++;
  }
  cout << c << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  //    vector <> vec;
  //    vec.clear;
  char t, a[10000], b[10000];
  int n, c = 0;
  cin >> a >> b;
  //  cout<< b+a+t <<endl;
  //    while (t--){}
  n = strlen(a);
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i])
      c++;
  }
  cout << c << endl;
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <iostream>
using namespace std;
int main() {
  int a = 0, b = 0;
  char S[200001], T[200001];
  cin >> S;
  cin >> T;
  for (int i = 0; i <= strlen(S); i++) {
    if (S[i] == T[i])
      b++;
    else
      a++;
  }
  if (0 == a && 0 == b)
    cout << b;
  else
    cout << a;
  return 0;
}

Error: WA

Fixed submission:

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

#include <bits/stdc++.h>

using namespace std;

string s1, s2;
long ans;

int main() {
  cin >> s1 >> s2;
  for (int i = 0; i < s1.size(); i++)
    if (s1[i] != s2[i])
      ans++;
  cout << ans;
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;
char a[100005], b[100005];
int sum = 0;
int main() {

  cin >> a >> b;
  for (int i = 0; i < 100000; i++) {
    if (a[i] != b[i])
      sum++;
  }
  cout << sum;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int ans = 0;
char a[200005], b[200005];
int main() {
  for (int i = 0;; i++) {
    a[i] = getchar();
    if (a[i] == '\\n') {
      break;
    }
  }
  for (int i = 0;; i++) {
    b[i] = getchar();
    if (a[i] == '\\n') {
      break;
    }
  }
  int len = strlen(a);
  for (int i = 0; i < len; i++) {
    if (a[i] != b[i]) {
      ans++;
    }
  }
  cout << ans;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int ans = 0;
char a[20000], b[20000];
int main() {
  for (int i = 0;; i++) {
    a[i] = getchar();
    if (a[i] == '\\n') {
      break;
    }
  }
  for (int i = 0;; i++) {
    b[i] = getchar();
    if (a[i] == '\\n') {
      break;
    }
  }
  int len = strlen(a);
  for (int i = 0; i < len; i++) {
    if (a[i] != b[i]) {
      ans++;
    }
  }
  cout << ans;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

int t = 0;
char S[200001], T[200001];
int main() {

  cin >> S >> T;
  int length = sizeof S / sizeof S[0];
  for (int i = 0; i < length; i++) {
    if (S[i] != T[i]) {
      t += 1;
    }
  }
  cout << t << endl;
}

Error: 0

Fixed submission:

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

int t = 0;
char S[100000], T[100000];
int main() {

  cin >> S >> T;
  for (int i = 0; i < sizeof S / sizeof S[0]; i++) {
    if (S[i] != T[i]) {
      t += 1;
    }
  }
  cout << t << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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

Error: -11

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < 200000; i++) {
    if (s[i] != t[i])
      i++;
  }
  return 0;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

// BadWaper gg
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define N 200010
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline ll read() {
  char ch = getchar();
  ll s = 0, w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
char s[N], t[N];
int main() {
  // freopen(".in","r",stdin);
  // freopen(".out","w",stdout);
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  int len = strlen(s + 1);
  int ans = 0;
  for (register int i = 1; i <= len; i++)
    if (s[i] != t[i])
      ans++;
  cout << ans << endl;
  return 0;
}


Error: 0

Fixed submission:

// BadWaper gg
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define N 10010
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline ll read() {
  char ch = getchar();
  ll s = 0, w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
char s[N], t[N];
int main() {
  // freopen(".in","r",stdin);
  // freopen(".out","w",stdout);
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  int len = strlen(s + 1);
  int ans = 0;
  for (register int i = 1; i <= len; 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() {
  string S, T;
  cin >> S >> T;
  int counter = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != T[i]) {
      counter++;
    }
  }
  cout << counter << endl;
}

Error: 0

Fixed submission:

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

int editDistDP(string str1, string str2, int m, int n) {
  vector<vector<int>> dp(m + 1, vector<int>(n + 1));

  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= n; j++) {
      if (i == 0)
        dp[i][j] = j;

      else if (j == 0)
        dp[i][j] = i;

      else if (str1[i - 1] == str2[j - 1])
        dp[i][j] = dp[i - 1][j - 1];

      else
        dp[i][j] = 1 + min(min(dp[i][j - 1], dp[i - 1][j]), dp[i - 1][j - 1]);
    }
  }

  return dp[m][n];
}
int main() {
  string First_String, Second_String;
  cin >> First_String >> Second_String;

  cout << editDistDP(First_String, Second_String, First_String.size(),
                     Second_String.size())
       << endl;
}
Problem p02622 (C++) — buggy submission, verdict: Runtime Error

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


Error: 0

Fixed submission:

#include <cstring>
#include <iostream>
using namespace std;
int main() {
  int limit = 2000;
  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: Time Limit Exceeded

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

const double PI = 3.141592653589793238463;
#define pb push_back
#define pf push_front
#define sz(v) ((int)(v).size());
#define all(v) ((v).begin()), ((v).end())
typedef unsigned long long ull;
typedef long long ll;

typedef vector<int> vi;
typedef pair<int, int> pi;
// 2 7 3 4 9

void printVec(vi v1) {
  for (int i = 0; i < v1.size(); i++)
    cout << v1[i] << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  string s;
  cin >> s;
  string t;
  cin >> t;
  ll ctr = 0;
  for (ll i = 0; i < s.length(); i++) {
    if (s[i] != t[i]) {
      ctr++;
    }
  }
  cout << ctr;
  return 0;
}


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;
      break;
    }
  }
}
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 <cstring>
#include <iostream>
using namespace std;

int main() {
  int x = 0;
  int z = 0;
  char S[200001], T[200001];
  cin >> S >> T;
  for (int i = 0; i < strlen(S); i++) {
    if (S[i] == T[i])
      z++;
    else
      x++;
  }
  if (z == 0 && x == 0)
    cout << z;
  else
    cout << x;
  return 0;
}


Error: WA

Fixed submission:

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

int main() {
  int x = 0;
  int z = 0;
  char S[19999], T[19999];
  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 <bits/stdc++.h>
#include <iostream>
#define input                                                                  \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define dl endl
#define ft first
#define sc second
using namespace std;
string a, b;
int cnt = 0;
int main() {
  // freopen("", "r", stdin);
  // freopen("", "w", stdout);
  input;
  cin >> a >> b;
  for (int i = 0; i < a.length(); ++i)
    if (a[i] != b[i])
      cnt++;
  cout << cnt;
}

Error: WA

Fixed submission:

#include <cstring>
#include <iostream>
using namespace std;
int main() {
  int a = 0, b = 0;
  char S[200000], T[200000];
  cin >> S;
  cin >> T;
  for (int i = 0; i <= strlen(S); i++) {
    if (S[i] == T[i]) {
      b++;
    } else {
      a++;
    }
  }
  if (0 == a && 0 == b) {
    cout << b << endl;
  } else {
    cout << a;
  }
  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 n = s.size();
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i])
      count++;
  }

  cout << count << endl;
}


Error: 0

Fixed submission:

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

int main() {
  int lens;
  int i;
  int count = 0;
  char s[10000];
  char t[10000];

  cin >> s >> t;
  lens = strlen(s);

  for (i = 0; i < lens; i++) {
    if (s[i] != t[i]) {
      s[i] = t[i];
      count++;
    }
  }
  cout << count << endl;
}
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 ans = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != T[i])
      ans++;
  }

  cout << ans << endl;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main(void) {

  string S, T;
  cin >> S >> T;

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

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

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

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

  int count = 0, i;
  int l = s.size();
  for (i = 0; i < l; i++)
    if (s[i] != t[i])
      count++;

  cout << count << endl;

  return 0;
}

Error: WA

Fixed submission:

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

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

#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {
  /*
  int a,b;
  cin >> a;
  b=a*a;
  b=b+b*a+a;
  cout << b;
  */
  char txt1[200010], txt2[200010];
  cin >> txt1;
  cin >> txt2;
  int count = 0;
  int n = strlen(txt1);
  int i;
  for (i = 0; i < n; i++) {
    if (txt1[i] != txt2[i]) {
      count++;
    }
  }
  cout << count;
}

Error: WA

Fixed submission:

#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {

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

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

  char arr1[200001];
  char arr2[200001];
  char c;

  for (int i = 0; 1; i++) {
    c = getchar();
    if (c == '\\n') {
      arr1[i] = '\\0';
      break;
    }
    arr1[i] = c;
  }

  for (int i = 0; 1; i++) {
    c = getchar();
    if (c == '\\n') {
      arr2[i] = '\\0';
      break;
    }
    arr2[i] = c;
  }

  int cnt = 0;
  for (int i = 0; arr1[i] != '\\0'; i++) {
    if (arr1[i] != arr2[i])
      cnt++;
  }

  cout << cnt;

  return 0;
}

Error: WA

Fixed submission:

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

  char arr1[20001];
  char arr2[20001];
  char c;

  for (int i = 0; 1; i++) {
    c = getchar();
    if (c == '\\n') {
      arr1[i] = '\\0';
      break;
    }
    arr1[i] = c;
  }

  for (int i = 0; 1; i++) {
    c = getchar();
    if (c == '\\n') {
      arr2[i] = '\\0';
      break;
    }
    arr2[i] = c;
  }

  int cnt = 0;
  for (int i = 0; arr1[i] != '\\0'; i++) {
    if (arr1[i] != arr2[i])
      cnt++;
  }

  cout << cnt;

  return 0;
}