prithivMLmods/Coder-Stat huggingface dataset:
Problem p02622 (C++)

Buggy submission (status: Time Limit Exceeded):
#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;
}


Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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)) {
      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;
}

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)) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
Problem p02622 (C++)

Buggy submission (status: 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++)
    for (int j = 0; j < a.length(); j++)
      if (s[i] != a[j] && i == j)
        o++;
  cout << o;
  return 0;
}

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++) {
    if (s[i] != a[i]) {
      o++;
    }
  }
  cout << o;
  return 0;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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() {
  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;
}


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() {
  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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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;
}

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 (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}


Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}


Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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[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;
}

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[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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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[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;
}


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[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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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];
  cin >> s >> z;
  for (i = 0; s[i]; i++) {
    if (s[i] != z[i]) {
      y++;
    }
  }
  cout << y << endl;
}


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];
  string s, z;
  cin >> s >> z;
  for (i = 0; s[i]; i++) {
    if (s[i] != z[i]) {
      y++;
    }
  }
  cout << y << endl;
}
Problem p02622 (C++)

Buggy submission (status: 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 = 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;
}

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 = 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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (Python)

Buggy submission (status: Runtime Error):
S = input()
T = input()
N = len(S)
ans = 0
for i in range(N):
    if not S[i] == T[i]:
        S[i] = T[i]
        ans += 1
print(ans)


Fixed submission:
S = input()
T = input()
N = len(S)
ans = 0
for i in range(N):
    if S[i] != T[i]:
        ans += 1
print(ans)
Problem p02622 (Python)

Buggy submission (status: Runtime Error):
S = input()
T = input()
replaces = 0
for ch in range(S):
    if S[ch] == T[ch]:
        replaces += 1

print(replaces)


Fixed submission:
S = input()
T = input()
replaces = 0
for ch in range(len(S)):
    if S[ch] != T[ch]:
        replaces += 1

print(replaces)
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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; S.size(); i++) {
    if (S[i] != T[i])
      ans++;
  }

  cout << ans << endl;
}


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; i < S.size(); i++) {
    if (S[i] != T[i])
      ans++;
  }

  cout << ans << endl;
}
Problem p02622 (C++)

Buggy submission (status: 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() {
  string S, T;
  cin >> S >> T;
  int c = 0;
  int n = S.size();
  for (int i = 0; i < n; i++)
    c += (S[i] != T[i]);
  cout << c << '\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

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() {
  string S, T;
  cin >> S >> T;
  int c = 0;
  int n = S.size();
  for (int i = 0; i < n; i++)
    c += (S[i] != T[i]);
  cout << c << '\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
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

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

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

  int i = 0;
  int diff = 0;

  while (s[i] != '\0') {
    if (s[i] != t[i]) {
      diff++;
    }

    i++;
  }

  printf("%d", diff);
}

Fixed submission:
#include <stdio.h>

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

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

  int i = 0;
  int diff = 0;

  while (s[i] != '\0') {
    if (s[i] != t[i]) {
      diff++;
    }

    i++;
  }

  printf("%d", diff);
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  char s[20010], t[20010];
  int c = 0;
  scanf("%s %s", s, t);
  for (int i = 0; i < strlen(s); i++) {
    // printf("%c ",s[i]);
    if (s[i] == t[i]) {
      c++;
    }
  }
  printf("%ld\n", (strlen(s) - c));
}

Fixed submission:
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  char s[200010], t[200010];
  int c = 0;
  scanf("%s %s", s, t);
  for (int i = 0; i < strlen(s); i++) {
    // printf("%c ",s[i]);
    if (s[i] == t[i]) {
      c++;
    }
  }
  printf("%ld\n", (strlen(s) - c));
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

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

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

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

Fixed submission:
#include <stdio.h>

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

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

  for (int i = 0; S[i] != '\0'; i++) {
    if (S[i] != T[i])
      ans++;
  }
  printf("%d\n", ans);
  return 0;
}
Problem p02622 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string A, B;
  int m, n, count = 0;
  n = A.length();
  m = B.length();
  while (n == m) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (A[i] == B[j])
          continue;
        else if (A[i] != B[j])
          count++;
        i++;
        j++;
      }
    }
  }
  cout << count;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int64_t sum = 0;
  for (int i = 0; i < s1.size(); i++)
    sum += (s1[i] != s2[i]);
  cout << sum << "\n";
  return 0;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
#define NUM 20001
int main() {
  int i, cnt = 0, errno;
  char s[NUM], t[NUM];
  errno = scanf("%s", s);
  errno = scanf("%s", t);

  if (errno) {
    ;
  }

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

Fixed submission:
#include <stdio.h>
#define NUM 200001
int main() {
  int i, cnt = 0, errno;
  char s[NUM], t[NUM];
  errno = scanf("%s", s);
  errno = scanf("%s", t);

  if (errno) {
    ;
  }

  for (i = 0; s[i] != '\0'; i++) {
    if (s[i] != t[i]) {
      cnt++;
    }
  }
  printf("%d", cnt);
}
Problem p02622 (C++)

Buggy submission (status: 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 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;
}


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 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;
}
Problem p02622 (C++)

Buggy submission (status: 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[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;
}


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[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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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[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;
}

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[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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: 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;
}


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 (status: 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[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;
}

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[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;
}
Problem p02622 (C++)

Buggy submission (status: Memory Limit Exceeded):
#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;
}

Fixed submission:
#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;
}
Problem p02622 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02623 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll n, m, k, ans = 0;
  cin >> n >> m >> k;
  ll a[n + 1], b[n + 1];
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));

  for (ll i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (ll i = 1; i <= m; i++) {
    cin >> b[i];
    b[i] += b[i - 1];
  }
  for (ll i = 0; i <= n; i++)
    if (k >= a[i])
      ans = max(ans, upper_bound(b + 1, b + 1 + m, k - a[i]) - b - 1 + i);
  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll n, m, k, ans = 0;
  cin >> n >> m >> k;
  ll a[n + 1] = {0}, b[m + 1] = {0};
  for (ll i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (ll i = 1; i <= m; i++) {
    cin >> b[i];
    b[i] += b[i - 1];
  }
  for (ll i = 0; i <= n; i++)
    if (k >= a[i])
      ans = max(ans, upper_bound(b + 1, b + 1 + m, k - a[i]) - b - 1 + i);
  cout << ans;
}
Problem p02623 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define int long long int
using namespace std;
signed main() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < m; j++) {
    cin >> b[j];
  }
  int x = 0, y = 0, sum1 = 0, sum2 = 0;
  while (y < m && (sum2 + b[y]) <= k) {
    sum2 += b[y];
    y++;
  }
  y--;
  int ans = y + 1;

  for (int i = 0; i < n; i++) {
    sum1 += a[i];
    while (sum2 > (k - sum1) && y >= 0) {
      sum2 -= b[y];
      y--;
    }
    if (sum1 <= k) {
      ans = max(i + y + 2, ans);
    }
  }
  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
#define int long long int
using namespace std;
signed main() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[n], b[m];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < m; j++) {
    cin >> b[j];
  }
  int x = 0, y = 0, sum1 = 0, sum2 = 0;
  while (y < m && (sum2 + b[y]) <= k) {
    sum2 += b[y];
    y++;
  }
  y--;
  int ans = y + 1;

  for (int i = 0; i < n; i++) {
    sum1 += a[i];
    while (sum2 > (k - sum1) && y >= 0) {
      sum2 -= b[y];
      y--;
    }
    if (sum1 <= k) {
      ans = max(i + y + 2, ans);
    }
  }
  cout << ans;
}
Problem p02623 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

void solve(long long N, long long M, long long K, std::vector<long long> A,
           std::vector<long long> B) {
  ll rv = 0;
  vector<ll> sA(N + 1, 0);
  vector<ll> sB(N + 1, 0);
  for (ll i = 0; i < N; ++i) {
    sA[i + 1] = A[i] + sA[i];
  }
  for (ll i = 0; i < M; ++i) {
    sB[i + 1] = B[i] + sB[i];
  }

  ll j = M;
  for (ll i = 0; i <= N;) {
    if (sA[i] + sB[j] <= K) {
      rv = max(rv, i + j);
      i++;
      continue;
    } else {
      if (j != 0) {
        j--;
      } else {
        i++;
      }
    }
  }
  cout << rv << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  std::vector<long long> B(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &B[i]);
  }
  solve(N, M, K, std::move(A), std::move(B));
  return 0;
}


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

typedef long long ll;

void solve(long long N, long long M, long long K, std::vector<long long> A,
           std::vector<long long> B) {
  ll rv = 0;
  vector<ll> sA(N + 1, 0);
  vector<ll> sB(M + 1, 0);
  for (ll i = 0; i < N; ++i) {
    sA[i + 1] = A[i] + sA[i];
  }
  for (ll i = 0; i < M; ++i) {
    sB[i + 1] = B[i] + sB[i];
  }

  ll j = M;
  for (ll i = 0; i <= N;) {
    if (sA[i] + sB[j] <= K) {
      rv = max(rv, i + j);
      i++;
      continue;
    } else {
      if (j != 0) {
        j--;
      } else {
        i++;
      }
    }
  }
  cout << rv << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  std::vector<long long> B(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &B[i]);
  }
  solve(N, M, K, std::move(A), std::move(B));
  return 0;
}
Problem p02623 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  long long A[N + 1];
  A[0] = 0;
  for (int i = 1; i < N + 1; i++) {
    cin >> A[i];
    A[i] += A[i - 1];
  }
  long long B[M + 1];
  B[0] = 0;
  for (int i = 1; i < M + 1; i++) {
    cin >> B[i];
    B[i] += B[i - 1];
  }

  int ans = 0;
  for (int i = N; i >= 0; i--) {
    for (int j = M; j >= 0; j--) {
      if (A[i] + B[j] <= K) {
        ans = max(ans, i + j);
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  long long A[N + 1];
  A[0] = 0;
  for (int i = 1; i < N + 1; i++) {
    cin >> A[i];
    A[i] += A[i - 1];
  }
  long long B[M + 1];
  B[0] = 0;
  for (int i = 1; i < M + 1; i++) {
    cin >> B[i];
    B[i] += B[i - 1];
  }

  int ans = 0;
  for (int i = 0; i < N + 1; i++) {
    int l = -1;
    int r = M + 1;
    while (r - l > 1) {
      int c = l + (r - l) / 2;
      if (A[i] + B[c] > K) {
        r = c;
      } else {
        ans = max(ans, i + c);
        l = c;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p02623 (Python)

Buggy submission (status: Runtime Error):
n, m, k = map(int, input().split())
(*A,) = map(int, input().split())
(*B,) = map(int, input().split())
A.append(0)
B.append(0)
time = 0
cnt = 0
a, b = 0, 0
while (a < m and time + A[a] <= k) or (b < n and time + B[b] <= k):
    if (a < m and time + A[a] <= k) and (b < n and time + B[b] <= k):
        if A[a] <= B[b]:
            cnt += 1
            time += A[a]
            a += 1
        else:
            cnt += 1
            time += B[b]
            b += 1
    elif a < m and time + A[a] <= k:
        cnt += 1
        time += A[a]
        a += 1
    else:
        cnt += 1
        time += B[b]
        b += 1
print(cnt)


Fixed submission:
n, m, k = map(int, input().split())
(*A,) = map(int, input().split())
(*B,) = map(int, input().split())
SA, SB = [0], [0]
for i in range(n):
    SA.append(SA[i] + A[i])
for j in range(m):
    SB.append(SB[j] + B[j])
ans, tmp = 0, m
for i in range(n + 1):
    if SA[i] > k:
        break
    for j in range(tmp + 1)[::-1]:
        if SA[i] + SB[j] <= k:
            break
    ans = max(ans, i + j)
    tmp = j
print(ans)
Problem p02623 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  // input
  int64_t N, M, K;
  cin >> N >> M >> K;

  vector<int64_t> A(N), B(M);
  for (int64_t i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int64_t i = 0; i < M; i++) {
    cin >> B[i];
  }

  // calculation
  vector<int64_t> sum_A(N + 1), sum_B(M + 1);
  int64_t temp_sum = 0;
  sum_A[0] = 0;
  for (int64_t i = 0; i < N; i++) {
    temp_sum += A[i];
    sum_A[i + 1] = temp_sum;
  }
  temp_sum = 0;
  sum_B[0] = 0;
  for (int64_t i = 0; i < M; i++) {
    temp_sum += B[i];
    sum_B[i + 1] = temp_sum;
  }

  int64_t output = 0;
  for (int64_t i = 0; i <= N; i++) {
    for (int64_t j = 0; j <= M; j++) {
      if (sum_A[i] + sum_B[j] > K) {
        break;
      }
      if (output < i + j) {
        output = i + j;
      }
    }
  }

  // output
  cout << output << endl;

  return 0;
}


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

int main() {
  // input
  int64_t N, M, K;
  cin >> N >> M >> K;

  vector<int64_t> A(N), B(M);
  for (int64_t i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int64_t i = 0; i < M; i++) {
    cin >> B[i];
  }

  // calculation
  vector<int64_t> sum_A(N + 1), sum_B(M + 1);
  int64_t temp_sum = 0;
  sum_A[0] = 0;
  for (int64_t i = 0; i < N; i++) {
    temp_sum += A[i];
    sum_A[i + 1] = temp_sum;
  }
  temp_sum = 0;
  sum_B[0] = 0;
  for (int64_t i = 0; i < M; i++) {
    temp_sum += B[i];
    sum_B[i + 1] = temp_sum;
  }

  int64_t output = 0;
  for (int64_t i = 0; i <= N; i++) {
    int64_t start_j = output - i;
    if (start_j < 0) {
      start_j = 0;
    }
    for (int64_t j = start_j; j <= M; j++) {
      if (sum_A[i] + sum_B[j] > K) {
        break;
      }
      if (output < i + j) {
        output = i + j;
      }
    }
  }

  // output
  cout << output << endl;

  return 0;
}
Problem p02623 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  VL a(n), b(m);
  VL sa(n + 1, 0), sb(m + 1, 0);
  rep(i, n) {
    cin >> a[i];
    sa[i + 1] = sa[i] + a[i];
  }
  rep(i, m) {
    cin >> b[i];
    sb[i + 1] = sb[i] + b[i];
  }
  ll ans = 0;
  rep(i, k + 1) {
    ll cur = upper_bound(ALL(sa), i) - sa.begin() - 1;
    cur += upper_bound(ALL(sb), k - i) - sb.begin() - 1;
    // cerr << i << " " << cur << endl;
    chmax(ans, cur);
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  VL a(n), b(m);
  VL sa(n + 1, 0), sb(m + 1, 0);
  rep(i, n) {
    cin >> a[i];
    sa[i + 1] = sa[i] + a[i];
  }
  rep(i, m) {
    cin >> b[i];
    sb[i + 1] = sb[i] + b[i];
  }
  ll ans = 0;
  rep(i, n + 1) {
    if (sa[i] > k) {
      continue;
    }
    ll cur = i;
    cur += upper_bound(ALL(sb), k - sa[i]) - sb.begin() - 1;
    // cerr << i << " " << cur << endl;
    chmax(ans, cur);
  }
  cout << ans << endl;
  return 0;
}
Problem p02623 (C++)

Buggy submission (status: 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>;
using V = vector<int>;

int main(int argc, char const *argv[]) {
  int n, m, k;
  cin >> n >> m >> k;
  long long int a, b, c[20010], d[20010];
  c[0] = 0;
  rep(i, n) {
    cin >> a;
    c[i + 1] = c[i] + a;
  }
  d[0] = 0;
  rep(i, m) {
    cin >> b;
    d[i + 1] = d[i] + b;
  }
  int ans = 0;
  int j = m;
  rep(i, n + 1) {
    if (k < c[i])
      break;
    while (k < c[i] + d[j]) {
      j--;
    }
    ans = max(ans, i + j);
    // cout << ans << " " << i << " " << j << endl;
  }
  cout << ans << endl;

  return 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>;
using V = vector<int>;

int main(int argc, char const *argv[]) {
  int n, m, k;
  cin >> n >> m >> k;
  long long int a, b, c[200010], d[200010];
  c[0] = 0;
  rep(i, n) {
    cin >> a;
    c[i + 1] = c[i] + a;
  }
  d[0] = 0;
  rep(i, m) {
    cin >> b;
    d[i + 1] = d[i] + b;
  }
  int ans = 0;
  int j = m;
  rep(i, n + 1) {
    if (k < c[i])
      break;
    while (k < c[i] + d[j]) {
      j--;
    }
    ans = max(ans, i + j);
    // cout << ans << " " << i << " " << j << endl;
  }
  cout << ans << endl;

  return 0;
}