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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for ((i) = 1; (i) <= (n); (i)++)
using namespace std;
const int mod = 1e9 + 7;
int n, m, i, lst, dp[200005], s[200005], f[200005][2], tmp, mi = 0x3f3f3f3f, l;
string st;
int main() {
  cin >> n >> m;
  cin >> st;
  st = " " + st;
  i = 1;
  lst = 1;
  while (i <= n) {
    if (st[i] != st[i - 1]) {
      if (st[i] != st[1]) {
        if (lst == 1 || ((i - lst) & 1)) {
          mi = min(mi, i - lst);
        }
      } else {
        lst = i;
      }
    }
    i++;
  }
  if (mi < 0x3f3f3f3f) {
    if (n & 1) {
      puts("0");
      return 0;
    }
    mi = mi / 2 + 1;
    n /= 2;
    l = 1;
    /*		s[1]=1;s[mi+1]+=mod-1;
                    rep(i,n){
                            tmp=(tmp+s[i])%mod;
                            dp[i]=tmp;
                            s[min(n,i+1)]=(s[min(n,i+1)]+dp[i])%mod;
                            s[min(n,i+mi)+1]=(s[min(n,i+mi)+1]+mod-dp[i])%mod;
                    }
                    cout<<dp[n]<<endl;*/
  } else {
    l = 2;
  }
  for (i = l; i <= n; i++) {
    dp[i] = (s[i - l] + (i > mi ? -s[i - mi - 1] : (3ll - l) * i)) % mod;
    s[i] = (s[i - 1] + dp[i]) % mod;
  }
  cout << (dp[n] + l - 1 + mod) % mod << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for ((i) = 1; (i) <= (n); (i)++)
using namespace std;
const int mod = 1e9 + 7;
int n, m, i, lst, dp[200005], s[200005], f[200005][2], tmp, mi = 0x3f3f3f3f, l;
string st;
int main() {
  cin >> n >> m;
  cin >> st;
  st = " " + st;
  i = 1;
  lst = 1;
  while (i <= m) {
    if (st[i] != st[i - 1]) {
      if (st[i] != st[1]) {
        if (lst == 1 || ((i - lst) & 1)) {
          mi = min(mi, i - lst);
        }
      } else {
        lst = i;
      }
    }
    i++;
  }
  if (mi < 0x3f3f3f3f) {
    if (n & 1) {
      puts("0");
      return 0;
    }
    mi = mi / 2 + 1;
    n /= 2;
    l = 1;
    /*		s[1]=1;s[mi+1]+=mod-1;
                    rep(i,n){
                            tmp=(tmp+s[i])%mod;
                            dp[i]=tmp;
                            s[min(n,i+1)]=(s[min(n,i+1)]+dp[i])%mod;
                            s[min(n,i+mi)+1]=(s[min(n,i+mi)+1]+mod-dp[i])%mod;
                    }
                    cout<<dp[n]<<endl;*/
  } else {
    l = 2;
  }
  for (i = l; i <= n; i++) {
    dp[i] = (s[i - l] + (i > mi ? -s[i - mi - 1] : (3ll - l) * i)) % mod;
    s[i] = (s[i - 1] + dp[i]) % mod;
  }
  cout << (dp[n] + l - 1 + mod) % mod << endl;
  return 0;
}
Problem p03057 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define Tp template <typename Ty>
#define Ts template <typename Ty, typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int &
#define I inline
#define W while
#define N 200000
#define X 1000000007
using namespace std;
int n, m, t, a[N + 5], f[N + 5], g[N + 5];
char s[N + 5];
int w[N + 5][2];
I void Work() {
#define DP()                                                                   \
  for (RI i = 2; i <= n; ++i)                                                  \
    w[i][0] = w[i - 1][1], w[i][1] = (w[i - 1][0] + w[i - 1][1]) % X;
  w[1][1] = 1;
  DP();
  RI t = (w[n][0] + w[n][1]) % X;
  w[1][0] = 1, w[1][1] = 0;
  DP();
  printf("%d\n", (t + w[n][1]) % X);
}
int main() {
  RI i;
  for (scanf("%d%d%s", &n, &m, s + 1), i = 1; i <= m; ++i)
    s[i] ^ s[i - 1] && ++t, ++a[t];
  if (t & 1 && --t, !t)
    return Work(), 0;
  if (n & 1)
    return puts("0");
  RI p = a[1] + (a[1] & 1 ^ 1);
  for (i = 3; i <= t; i += 2)
    a[i] & 1 && (p = min(p, a[i]));
  for (f[0] = g[0] = 1, i = 2; i <= n; ++i)
    f[i] = (g[i - 2] + (i - p - 3 >= 0 ? X - g[i - p - 3] : 0)) % X,
    g[i] = (g[i - 2] + f[i]) % X;
  RI res = 0;
  for (i = 2; i <= p + 1 && i <= n; ++i)
    res = (1LL * i * f[n - i] + res) % X;
  return printf("%d\n", res), 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define Tp template <typename Ty>
#define Ts template <typename Ty, typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int &
#define I inline
#define W while
#define N 200000
#define X 1000000007
using namespace std;
int n, m, t, a[N + 5], f[N + 5], g[N + 5];
char s[N + 5];
int w[N + 5][2];
I void Work() {
#define DP()                                                                   \
  for (RI i = 2; i <= n; ++i)                                                  \
    w[i][0] = w[i - 1][1], w[i][1] = (w[i - 1][0] + w[i - 1][1]) % X;
  w[1][1] = 1;
  DP();
  RI t = (w[n][0] + w[n][1]) % X;
  w[1][0] = 1, w[1][1] = 0;
  DP();
  printf("%d\n", (t + w[n][1]) % X);
}
int main() {
  RI i;
  for (scanf("%d%d%s", &n, &m, s + 1), i = 1; i <= m; ++i)
    s[i] ^ s[i - 1] && ++t, ++a[t];
  if (t & 1 && --t, !t)
    return Work(), 0;
  if (n & 1)
    return puts("0"), 0;
  RI p = a[1] + (a[1] & 1 ^ 1);
  for (i = 3; i <= t; i += 2)
    a[i] & 1 && (p = min(p, a[i]));
  for (f[0] = g[0] = 1, i = 2; i <= n; ++i)
    f[i] = (g[i - 2] + (i - p - 3 >= 0 ? X - g[i - p - 3] : 0)) % X,
    g[i] = (g[i - 2] + f[i]) % X;
  RI res = 0;
  for (i = 2; i <= p + 1 && i <= n; ++i)
    res = (1LL * i * f[n - i] + res) % X;
  return printf("%d\n", res), 0;
}
Problem p03057 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
const int Q = 1 << 19;
char s[Q];
int n, m;
const int MOD = 1e9 + 7;
inline int add(int a, int b) {
  a += b;
  return a >= MOD ? a - MOD : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + MOD : a;
}
inline int mul(int a, int b) { return 1LL * a * b % MOD; }
int dp[Q];
void DP(int n, int lim) {
  dp[0] = 1;
  int sm = 1;
  for (int i = 1; i <= n; i++) {
    if (i > lim)
      sm = sub(sm, dp[i - lim - 1]);
    dp[i] = sm;
    sm = add(sm, dp[i]);
  }
}
void s1() {
  exit(-1);
  dp[0] = 1;
  int sm = 0;
  for (int i = 1; i <= n; i++) {
    if (i >= 2)
      sm = add(sm, dp[i - 2]);
    dp[i] = sm;
  }
  int als = 1;
  for (int i = 2; i <= n; i++) {
    als = add(als, mul(i, dp[n - i]));
  }
  printf("%d\n", als);
}
void s2(int fir) {
  if (n & 1) {
    puts("0");
    return;
  }
  int mus = fir + (fir % 2 == 0);
  for (int len = 0, i = fir + 2; i <= m; i++) {
    if (s[i] == s[1])
      ++len;
    else {
      if (len & 1)
        mus = min(mus, len);
      len = 0;
    }
  }
  n /= 2, mus = (mus + 1) / 2;
  // printf("%d %d WCNM\n",n,mus);

  DP(n, mus);
  // for(int i=0;i<=n;i++)
  // printf("%d ????\n",dp[i]);
  int als = 0;
  for (int i = 1; i <= n && i <= mus; i++) {
    als = add(als, mul(2 * i, dp[n - i]));
  }
  printf("%d", als);
}
int main() {
  scanf("%d%d%s", &n, &m, s + 1);
  for (int i = 2; i <= m; i++)
    if (s[i] != s[1]) {
      s2(i - 1);
      return 0;
    }
  s1();
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
const int Q = 1 << 19;
char s[Q];
int n, m;
const int MOD = 1e9 + 7;
inline int add(int a, int b) {
  a += b;
  return a >= MOD ? a - MOD : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + MOD : a;
}
inline int mul(int a, int b) { return 1LL * a * b % MOD; }
int dp[Q];
void DP(int n, int lim) {
  dp[0] = 1;
  int sm = 1;
  for (int i = 1; i <= n; i++) {
    if (i > lim)
      sm = sub(sm, dp[i - lim - 1]);
    dp[i] = sm;
    sm = add(sm, dp[i]);
  }
}
void s1() {
  dp[0] = 1;
  int sm = 0;
  for (int i = 1; i <= n; i++) {
    if (i >= 2)
      sm = add(sm, dp[i - 2]);
    dp[i] = sm;
  }
  int als = 1;
  for (int i = 2; i <= n; i++) {
    als = add(als, mul(i, dp[n - i]));
  }
  printf("%d\n", als);
}
void s2(int fir) {
  if (n & 1) {
    puts("0");
    return;
  }
  int mus = fir + (fir % 2 == 0);
  for (int len = 0, i = fir + 2; i <= m; i++) {
    if (s[i] == s[1])
      ++len;
    else {
      if (len & 1)
        mus = min(mus, len);
      len = 0;
    }
  }
  n /= 2, mus = (mus + 1) / 2;
  // printf("%d %d WCNM\n",n,mus);

  DP(n, mus);
  // for(int i=0;i<=n;i++)
  // printf("%d ????\n",dp[i]);
  int als = 0;
  for (int i = 1; i <= n && i <= mus; i++) {
    als = add(als, mul(2 * i, dp[n - i]));
  }
  printf("%d", als);
}
int main() {
  scanf("%d%d%s", &n, &m, s + 1);
  for (int i = 2; i <= m; i++)
    if (s[i] != s[1]) {
      s2(i - 1);
      return 0;
    }
  s1();
  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int a, b, t;
  cin >> a >> b >> t;
  cout << (t / a) * b;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a, b, t;
  cin >> a >> b >> t;
  cout << (t / a) * b;
}
Problem p03059 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define ld long double
#define MAX 100007
#define pb push_back
#define MOD 1000000007
using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ll a, b, t;
  cin >> a >> b >> t;
  cout << b * (t / a);
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define ld long double
#define MAX 100007
#define pb push_back
#define MOD 1000000007
using namespace std;

int main() {
  ll a, b, t;
  cin >> a >> b >> t;
  cout << b * (t / a);
  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int a, b, t;
  cin >> a >> b >> t;
  int ans = 0;
  for (int i = a; i <= t; ++a) {
    ans += b;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int a, b, t;
  cin >> a >> b >> t;
  int ans = 0;
  for (int i = a; i <= t; i += a) {
    ans += b;
  }
  cout << ans << endl;
  return 0;
}
Problem p03059 (C++)

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repa(i, a, n) for (int i = (a); i < (n); i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define rrepa(i, a, n) for (int i = n - 1; i >= (a); i--)
#define all(a) (a).begin(), (a).end()
#define MOD 1000000007
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

int main() {

  int a, b, t;
  cin >> a >> b >> t;
  int ans = 0, time = 0;

  while (time < t) {
    ans += b;
  }

  cout << ans << "\n";

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repa(i, a, n) for (int i = (a); i < (n); i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define rrepa(i, a, n) for (int i = n - 1; i >= (a); i--)
#define all(a) (a).begin(), (a).end()
#define MOD 1000000007
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

int main() {

  int a, b, t;
  cin >> a >> b >> t;
  int ans = t / a;
  ans *= b;

  cout << ans << "\n";

  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, a, b) for (int i = (a); i <= (b); i++)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define sz(x) (sizeof(x) / sizeof(*x))
#define F first
#define S second

int main() {
  // ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  double a, b, t, sum = 0;
  cin >> a >> b >> t;
  while (a <= t + 0.5) {
    sum += b;
  }
  cout << sum << endl;
  //    system("pause");
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, a, b) for (int i = (a); i <= (b); i++)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define sz(x) (sizeof(x) / sizeof(*x))
#define F first
#define S second

int main() {
  // ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  double a, b, t, sum = 0;
  cin >> a >> b >> t;

  cout << int((t + 0.5) / a) * b << endl;
  //    system("pause");
  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int d = 0;

  for (int i = a; i <= c; i * a) {
    d++;
  }
  cout << d;
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;

  cout << (c / a) * b;
  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Runtime Error):

#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, T;
  cin >> A >> B >> T;
  cout << B * T / A << endl;
  return 1;
}

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, T;
  cin >> A >> B >> T;
  cout << B * (T / A) << endl;
  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <string>
using namespace std;

int main() {
  int a, b, t, x;
  cin >> a >> b >> t;
  t = t + 0.5;
  a = t / a;
  x = a * b;
  cout << x << endl;
  while (1) {
  }
  return 0;
}

Fixed submission:
#include <iostream>
#include <string>
using namespace std;

int main() {
  int a, b, t, x;
  cin >> a >> b >> t;
  t = t + 0.5;
  a = t / a;
  x = a * b;
  cout << x << endl;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main() {
  int a, b, t, j;
  while (scanf("%d %d %d", &a, &b, &t)) {
    j = 1;
    int c = 0;
    if (a <= t) {
      for (int i = a; i <= t; i = i + a) {
        c = c + b;
      }
      printf("%d\n", c);
    }
    if (a > t)
      printf("0");
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main() {
  int a, b, t, sum = 0;
  scanf("%d%d%d", &a, &b, &t);
  int num;
  num = t / a;
  sum = sum + num * b;
  printf("%d\n", sum);
  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int A, B, T;
  cin >> A >> B >> T;
  int t = A, ans = 0;
  while (t < T + 0.5) {
    ans += A;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int A, B, T;
  cin >> A >> B >> T;
  int t = A, ans = 0;
  while (t < T + 0.5) {
    ans += B;
    t += A;
  }
  cout << ans << endl;
  return 0;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int i = 1;
  int z = 0;
  while (a * i <= c) {
    z += b;
  }
  cout << z << endl;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int i = 1;
  int z = 0;
  while (a * i <= c) {
    z += b;
    i++;
  }
  cout << z << endl;
}
Problem p03059 (C++)

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

#define N 1000
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define all(cont) cont.begin(), cont.end()
#define sortcmp(n, cmpfunc) sort(all(n), cmpfunc)
#define fastio                                                                 \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0)

ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
ll powm(ll a, ll b);
ll divm(ll a, ll b);
ll multm(ll a, ll b);
ll subm(ll a, ll b);
ll addm(ll a, ll b);

int main() {
  fastio;
#ifndef ONLINE_JUDGE
  freopen("input.in", "r", stdin);
  freopen("output.out", "w", stdout);
#endif
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << endl;

  return 0;
}

// template function
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

ll powm(ll a, ll b) {
  ll x = 1, y = a;
  while (b > 0) {
    if (b % 2)
      x = (x * y) % mod;
    y = (y * y) % mod;
    b /= 2;
  }
  return x % mod;
}

ll multm(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }

ll divm(ll a, ll b) { return (a * powm(b, mod - 2)); }

ll subm(ll a, ll b) {
  a -= b;
  if (a < 0)
    a += mod;
  return a;
}

ll addm(ll a, ll b) {
  a += b;
  if (a >= mod)
    a -= mod;
  return a;
}

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

#define N 1000
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define all(cont) cont.begin(), cont.end()
#define sortcmp(n, cmpfunc) sort(all(n), cmpfunc)
#define fastio                                                                 \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0)

ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
ll powm(ll a, ll b);
ll divm(ll a, ll b);
ll multm(ll a, ll b);
ll subm(ll a, ll b);
ll addm(ll a, ll b);

int main() {
  fastio;
  // #ifndef ONLINE_JUDGE
  //    	freopen("input.in", "r", stdin);
  //    	freopen("output.out", "w", stdout);
  // #endif
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << endl;

  return 0;
}

// template function
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

ll powm(ll a, ll b) {
  ll x = 1, y = a;
  while (b > 0) {
    if (b % 2)
      x = (x * y) % mod;
    y = (y * y) % mod;
    b /= 2;
  }
  return x % mod;
}

ll multm(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }

ll divm(ll a, ll b) { return (a * powm(b, mod - 2)); }

ll subm(ll a, ll b) {
  a -= b;
  if (a < 0)
    a += mod;
  return a;
}

ll addm(ll a, ll b) {
  a += b;
  if (a >= mod)
    a -= mod;
  return a;
}
Problem p03059 (C++)

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

#define int long long
#define str string
#define rep(x, y) for (int i = x; i < y; i++)
#define REP(x, y) for (int j = x; j < y; j++)
#define all(x) x.begin(), x.end()
#define vint vector<int>
#define vchar vector<char>
#define vstr vector<string>
#define pb(n) push_back(n)

signed main() {
  int A, B, N, M, count = 0, count2 = 0, count3 = 0, stack = 0;
  str S, T;
  int C = 'A' - 'a';
  vstr W(N);
  vint l(N);
  vector<vchar> a(N, vchar(M));
  cin >> A >> B >> N;
  cout << B * (N / A) << endl;
}


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

#define int long long
#define str string
#define rep(x, y) for (int i = x; i < y; i++)
#define REP(x, y) for (int j = x; j < y; j++)
#define all(x) x.begin(), x.end()
#define vint vector<int>
#define vchar vector<char>
#define vstr vector<string>
#define pb(n) push_back(n)

signed main() {
  int A, B, N;
  cin >> A >> B >> N;
  cout << B * (N / A) << endl;
}
Problem p03059 (C++)

Buggy submission (status: Time Limit Exceeded):
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include <bits/stdc++.h>
#define pi 2 * acos(0.0)
#define ll long long
#define FIO                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define Node struct node
#define spc " "
#define E 2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx, ny) nx >= 0 && nx < n &&ny >= 0 && ny < m
#define ee endl
#define pii pair<int, int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[] = {0, 0, +1, -1};
int fy[] = {+1, -1, 0, 0};

using namespace std;
/// check n=1;
/// check corner case;
const int maX = 1e5 + 1;
vector<ll> Graph[maX], cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main() {
  ll a, b, c, d, cc = 0;
  cin >> a >> b >> c;
  double x = (b * 1.0) / (a * 1.0);
  ll rem = c % a;
  ll ans = c / a;
  ll sum = ans * b;
  ll i = 1;
  double z = rem + 0.5;
  while (i) {
    double y = x * i * 1.0;
    if (y >= z) {
      sum += (i - 1);
      i = 0;
    }
    i++;
  }
  cout << sum << endl;
  return 0;
}


Fixed submission:
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include <bits/stdc++.h>
#define pi 2 * acos(0.0)
#define ll long long
#define FIO                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define Node struct node
#define spc " "
#define E 2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx, ny) nx >= 0 && nx < n &&ny >= 0 && ny < m
#define ee endl
#define pii pair<int, int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[] = {0, 0, +1, -1};
int fy[] = {+1, -1, 0, 0};

using namespace std;
/// check n=1;
/// check corner case;
const int maX = 1e5 + 1;
vector<ll> Graph[maX], cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main() {
  ll a, b, c, d, cc = 0;
  cin >> a >> b >> c;
  ll x = c / a;
  cout << x * b << endl;
  return 0;
}
Problem p03059 (C++)

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

using namespace std;

int sumDigits(int n) {
  int s;
  while (n < 0) {
    s += n % 10;
    n /= 10;
  }
  return s;
}

int main() {
  int A, B;
  int ans = 0;
  float T;
  cin >> A >> B >> T;
  int n = 1;
  while (A * n <= T + 0.5) {
    ans += B;
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int sumDigits(int n) {
  int s;
  while (n < 0) {
    s += n % 10;
    n /= 10;
  }
  return s;
}

int main() {
  int A, B;
  int ans = 0;
  float T;
  cin >> A >> B >> T;
  int n = 1;
  while (A * n <= T + 0.5) {
    ans += B;
    n += 1;
  }
  cout << ans << endl;
}
Problem p03059 (C++)

Buggy submission (status: Runtime Error):
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

#define PI 3.14159265
#define OO 1e9
#define SS second
#define FF first
#define Trace(n) cout << #n << " = " << n << endl;
#define ll long long
// #define endl		"\n"
#define all(v) ((v).begin()), ((v).end())
#define boom main
#define cn(n) scanf("%d", &n)
#define cnl(n) scanf("%lld", &n)
#define F(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define Fill(ar, val) memset(ar, val, sizeof(ar))
#define bit(n) (1 << (n))

int dx[] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};

void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int main() {
  fast();
  int a, b, T;
  cin >> a >> b >> T;
  int ans = 0;
  int tm = 0;
  while (tm + a <= T)
    ans += b, tm += a;

  cout << ans;
}

Fixed submission:
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

#define PI 3.14159265
#define OO 1e9
#define SS second
#define FF first
#define Trace(n) cout << #n << " = " << n << endl;
#define ll long long
// #define endl		"\n"
#define all(v) ((v).begin()), ((v).end())
#define boom main
#define cn(n) scanf("%d", &n)
#define cnl(n) scanf("%lld", &n)
#define F(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define Fill(ar, val) memset(ar, val, sizeof(ar))
#define bit(n) (1 << (n))

int dx[] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};

void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}

int main() {
  fast();
  int a, b, T;
  cin >> a >> b >> T;
  int ans = 0;
  int tm = 0;
  while (tm + a <= T)
    ans += b, tm += a;

  cout << ans;
}
Problem p03059 (C++)

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

int main(int argc, char *argv[]) {
  int a, b, t;
  a = atoi(argv[1]);
  b = atoi(argv[2]);
  t = atoi(argv[3]);

  int n = t / a;
  printf("%d\n", b * n);

  return 0;
}


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

int main(int argc, char *argv[]) {
  int a, b, t;
  scanf("%d %d %d", &a, &b, &t);
  int n = t / a;
  printf("%d\n", b * n);

  return 0;
}
Problem p03059 (C++)

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

using namespace std;

int main() {

  int A, B, T;
  int sum;
  for (int i = 1; A * i < T + 0.5; i++) {
    sum += B;
  }
  cout << sum << endl;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int main() {

  int A, B, T;
  int sum;
  cin >> A >> B >> T;
  for (int i = 1; A * i < T + 0.5; i++) {
    sum += B;
  }
  cout << sum << endl;
}
Problem p03059 (Python)

Buggy submission (status: Runtime Error):
a, b, t = (int(i) for i in input())

times = int(t / a)

num = times * b

print(num)


Fixed submission:
a, b, t = (int(i) for i in input().split())

times = int(t / a)

num = times * b

print(num)
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  vector<int> C(N);
  long long answer = 0;
  for (int i = 0; i < N; i++) {
    cin >> V.at(i);
    cin >> C.at(N);
    if (V.at(i) - C.at(i) > 0) {
      answer += V.at(i) - C.at(i);
    }
  }
  cout << answer << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  vector<int> C(N);
  long long answer = 0;
  for (int i = 0; i < N; i++) {
    cin >> V.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
  }
  for (int i = 0; i < N; i++) {
    if (V.at(i) - C.at(i) > 0) {
      answer += V.at(i) - C.at(i);
    }
  }
  cout << answer << endl;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vn;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    vn.push_back(a);
  }
  vector<int> vc;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    vc.push_back(a);
  }

  vector<int> va;

  for (int i = 0; i < n; ++i) {
    va.push_back(vn[i] - vc[i]);
  }

  sort(va.begin(), va.end(), greater<int>());
  int a = 0, i = 0;
  while (va[i] >= 0) {
    a += va[i];
    i++;
  }

  cout << a << endl;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vn;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    vn.push_back(a);
  }
  vector<int> vc;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    vc.push_back(a);
  }

  vector<int> va;

  for (int i = 0; i < n; ++i) {
    va.push_back(vn[i] - vc[i]);
  }

  sort(va.begin(), va.end(), greater<int>());
  int a = 0, i = 0;
  while (i < n && va[i] >= 0) {
    a += va[i];
    i++;
  }

  cout << a << endl;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ll long long
ll INF = 10001000100;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  rep(i, n) cin >> v[i];
  rep(i, n) cin >> c[i];

  bitset<20> sum;
  int ans = 0;
  rep(i, 1 << n) {
    if (v[i] > c[i])
      ans += v[i] - c[i];
  }
  cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  rep(i, n) cin >> v[i];
  rep(i, n) cin >> c[i];

  bitset<20> sum;
  int ans = 0;
  rep(i, n) {
    if (v[i] > c[i])
      ans += v[i] - c[i];
  }
  cout << ans << endl;
}
Problem p03060 (C++)

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

int main() {
  int N, ans = 0;
  cin >> N;
  vector<int> vec1, vec2;
  for (int i = 0; i < N; i++)
    cin >> vec1[i];
  for (int j = 0; j < N; j++)
    cin >> vec2[j];
  for (int k = 0; k < N; k++) {
    if (vec1[k] > vec2[k]) {
      ans += vec1[k];
      ans -= vec2[k];
    }
  }
  cout << ans << endl;
}

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

int main() {
  int N, ans = 0;
  cin >> N;
  vector<int> vec1(20), vec2(20);
  for (int i = 0; i < N; i++)
    cin >> vec1[i];
  for (int j = 0; j < N; j++)
    cin >> vec2[j];
  for (int k = 0; k < N; k++) {
    if (vec1[k] > vec2[k]) {
      ans += vec1[k];
      ans -= vec2[k];
    }
  }
  cout << ans << endl;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define __                                                                     \
  {                                                                            \
    freopen("input.txt", "r", stdin);                                          \
    freopen("output.txt", "w", stdout);                                        \
  }

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  __;
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += max(0, a[i] - b[i]);
  }
  cout << ans;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define __                                                                     \
  {                                                                            \
    freopen("input.txt", "r", stdin);                                          \
    freopen("output.txt", "w", stdout);                                        \
  }

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //  __;
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += max(0, a[i] - b[i]);
  }
  cout << ans;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w.at(i);
  }
  vector<int> vw(n);
  for (int i = 0; i < n; i++) {
    vw.at(i) = v.at(i) - w.at(i);
  }
  sort(vw.begin(), vw.end());
  reverse(vw.begin(), vw.end());
  int count = 0;
  int j = 0;
  while ((vw.at(j) > 0) && (j < n)) {
    count += vw.at(j);
    j++;
  }
  cout << count << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w.at(i);
  }
  vector<int> vw(n);
  for (int i = 0; i < n; i++) {
    vw.at(i) = v.at(i) - w.at(i);
  }
  sort(vw.begin(), vw.end());
  reverse(vw.begin(), vw.end());
  int count = 0;
  int j = 0;
  while ((j < n) && (vw.at(j) > 0)) {
    count += vw.at(j);
    j++;
  }
  cout << count << endl;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rept(i, a, b) for (int i = a; i < b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int main() {
  int N;
  cin >> N;
  vector<int> V, C;
  rep(i, N) cin >> V[i];
  rep(i, N) cin >> C[i];
  int sum = 0;
  rep(i, N) if (V[i] - C[i] > 0) sum += V[i] - C[i];
  cout << sum << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rept(i, a, b) for (int i = a; i < b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int main() {
  int N;
  cin >> N;
  vector<int> V(N), C(N);
  rep(i, N) cin >> V[i];
  rep(i, N) cin >> C[i];
  int sum = 0;
  rep(i, N) if (V[i] - C[i] > 0) sum += V[i] - C[i];
  cout << sum << endl;

  return 0;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1 << 30)
#define INFLL (1ll << 60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll &a, ll b) {
  a *= b;
  a %= MOD;
}

void add_mod(ll &a, ll b) {
  a += b;
  a %= MOD;
}

ll v[22], c[22];

int main(void) {
  int n, i, j;
  ll ans = -INFLL, tmp;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> v[i];
  }
  for (i = 0; i < n; ++i) {
    cin >> c[i];
  }
  for (i = 0; i < (1 << n); ++i) {
    tmp = 0ll;
    for (j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        tmp += v[i] - c[i];
      }
    }
    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1 << 30)
#define INFLL (1ll << 60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll &a, ll b) {
  a *= b;
  a %= MOD;
}

void add_mod(ll &a, ll b) {
  a += b;
  a %= MOD;
}

ll v[22], c[22];

int main(void) {
  int n, i, j;
  ll ans = -INFLL, tmp;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> v[i];
  }
  for (i = 0; i < n; ++i) {
    cin >> c[i];
  }
  for (i = 0; i < (1 << n); ++i) {
    tmp = 0ll;
    for (j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        tmp += v[j] - c[j];
      }
    }
    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int max = 0;
  int V[n], C[n];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> V[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> C[i];
  }
  for (int i = 0; i < n; i++) {
    if (V[i] > C[i]) {
      max += V[i] - C[i];
    }
  }
  cout << max << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int max = 0;
  vector<int> V(n);
  vector<int> C(n);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> V[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> C[i];
  }
  for (int i = 0; i < n; i++) {
    if (V[i] > C[i]) {
      max += V[i] - C[i];
    }
  }
  cout << max << endl;
  return 0;
}
Problem p03060 (C++)

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

typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  int n;
  int v[n + 10];
  int c[n + 10];
  cin >> n;
  REP(i, n) { cin >> v[i]; }
  REP(i, n) { cin >> c[i]; }
  int ans = 0;
  REP(i, n) {
    if (v[i] - c[i] > 0) {
      ans += v[i] - c[i];
    }
  }
  cout << ans << endl;
}

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

typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  int n;
  int v[n + 100];
  int c[n + 100];
  cin >> n;
  REP(i, n) { cin >> v[i]; }
  REP(i, n) { cin >> c[i]; }
  int ans = 0;
  REP(i, n) {
    if (v[i] - c[i] > 0) {
      ans += v[i] - c[i];
    }
  }
  cout << ans << endl;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
/*
        Author: ankrypt
*/

#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
ll Vs[25];
ll Cs[25];
ll dp[25][55][55];

ll rec(int ind, int val, int cost) {
  if (ind == N) {
    return val - cost;
  }
  ll &ans = dp[ind][val][cost];
  if (ans != -1) {
    return ans;
  }
  ans =
      max(rec(ind + 1, val, cost), rec(ind + 1, val + Vs[ind], cost + Cs[ind]));
  return ans;
}

int main() {
  scanf("%lld", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &Vs[i]);
  }
  for (int i = 0; i < N; i++) {
    scanf("%lld", &Cs[i]);
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(0, 0, 0);
  return 0;
}
/*
        Powered by Buggy Plugin
*/


Fixed submission:
/*
        Author: ankrypt
*/

#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
ll Vs[25];
ll Cs[25];
ll dp[25][2005][2005];

ll rec(int ind, int val, int cost) {
  if (ind == N) {
    return val - cost;
  }
  ll &ans = dp[ind][val][cost];
  if (ans != -1) {
    return ans;
  }
  ans =
      max(rec(ind + 1, val, cost), rec(ind + 1, val + Vs[ind], cost + Cs[ind]));
  return ans;
}

int main() {
  scanf("%lld", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &Vs[i]);
  }
  for (int i = 0; i < N; i++) {
    scanf("%lld", &Cs[i]);
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(0, 0, 0);
  return 0;
}
/*
        Powered by Buggy Plugin
*/
Problem p03060 (C++)

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

int main() {
  int n;
  cin >> n;
  int sum = 0;
  vector<int> v, c;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < n; i++) {
    if (v[i] - c[i] > 0) {
      sum += v[i] - c[i];
    }
  }
  cout << sum << endl;
}


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

int main() {
  int n;
  cin >> n;
  int sum = 0;
  vector<int> v(n), c(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < n; i++) {
    if (v[i] - c[i] > 0) {
      sum += v[i] - c[i];
    }
  }
  cout << sum << endl;
}
Problem p03060 (C++)

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

#define C continue;
#define D double
#define ll long long
#define ld long double
#define ull unsigned long long

#define pb push_back
#define vi vector<int>
#define vs vector<string>
#define vb vector<bool>
#define vd vector<D>
#define vll vector<ll>
#define vull vector<ull>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>

#define all(v) (v).begin(), (v).end()
#define allrev(v) (v).rbegin(), (v).rend()

#define pii pair<int, int>
#define vii vector<pii>
#define F first
#define S second
#define mp make_pair

#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define mod 1000000007

#define pp(n) printf("%.10f", n);
#define line cout << "\n";

const D pie = acos(-1);
const D hpie = asin(1);
const D qpie = atan2(-1, 1);
const D tpie = 2 * pie;

void solve(int test_case) {
  int n;
  cin >> n;

  vi a;
  vi b;

  int ans = 0;
  int temp;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> temp;
    ans += max(0, a[i] - temp);
  }

  cout << ans << "\n";
}

int main() {
  fast int t = 1;
  // cin>>t;

  for (int i = 0; i < t; i++)
    solve(i);
  return 0;
}


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

#define C continue;
#define D double
#define ll long long
#define ld long double
#define ull unsigned long long

#define pb push_back
#define vi vector<int>
#define vs vector<string>
#define vb vector<bool>
#define vd vector<D>
#define vll vector<ll>
#define vull vector<ull>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>

#define all(v) (v).begin(), (v).end()
#define allrev(v) (v).rbegin(), (v).rend()

#define pii pair<int, int>
#define vii vector<pii>
#define F first
#define S second
#define mp make_pair

#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define mod 1000000007

#define pp(n) printf("%.10f", n);
#define line cout << "\n";

const D pie = acos(-1);
const D hpie = asin(1);
const D qpie = atan2(-1, 1);
const D tpie = 2 * pie;

void solve(int test_case) {
  int n;
  cin >> n;

  vi a(n);

  int ans = 0;
  int temp;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> temp;
    ans += max(0, a[i] - temp);
  }

  cout << ans << "\n";
}

int main() {
  fast int t = 1;
  // cin>>t;

  for (int i = 0; i < t; i++)
    solve(i);
  return 0;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (ll i = a; i < b; i++)
int main() {
  int n;
  cin >> n;
  int ans = 0;
  vector<int> v, c;
  rep(i, 0, n) { cin >> v[i]; }
  rep(i, 0, n) {
    cin >> c[i];
    if (v[i] > c[i])
      ans += v[i] - c[i];
  }
  cout << ans;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (ll i = a; i < b; i++)
int main() {
  int n;
  cin >> n;
  int ans = 0;
  vector<int> v(n), c(n);
  rep(i, 0, n) { cin >> v[i]; }
  rep(i, 0, n) {
    cin >> c[i];
    if (v[i] > c[i])
      ans += v[i] - c[i];
  }
  cout << ans;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
/** Author: Nicklaus **/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(b);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];
  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    int x = 0, y = 0;
    for (int j = 0; j < n; j++) {
      if ((1 << j) & i) {
        y += b[j];
        x += a[j];
      }
    }
    ans = max(ans, x - y);
  }
  cout << ans << endl;
}

Fixed submission:
/** Author: Nicklaus **/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = 0; i < n; i++)
    cin >> b[i];
  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    int x = 0, y = 0;
    for (int j = 0; j < n; j++) {
      if ((1 << j) & i) {
        y += b[j];
        x += a[j];
      }
    }
    ans = max(ans, x - y);
  }
  cout << ans << endl;
}
Problem p03060 (C++)

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

int main() {
  int N;
  vector<int> V(N);
  vector<int> C(N);
  int P = 0;

  cin >> N;

  // N個の宝石の価値を代入する
  for (int i = 0; i < N; i++) {
    cin >> V.at(i);
  }
  // N個の宝石のコストを代入する
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
  }

  // 宝石の価値とコストを比較する
  // 0以上であれば利益が出るので、Pに代入する
  for (int i = 0; i < N; i++) {
    if (V.at(i) - C.at(i) > 0) {
      P += V.at(i) - C.at(i);
    }
  }

  cout << P;
}


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

int main() {
  int N;
  vector<int> V(21);
  vector<int> C(21);
  int P = 0;

  cin >> N;

  // N個の宝石の価値を代入する
  for (int i = 0; i < N; i++) {
    cin >> V.at(i);
  }
  // N個の宝石のコストを代入する
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
  }

  // 宝石の価値とコストを比較する
  // 0以上であれば利益が出るので、Pに代入する
  for (int i = 0; i < N; i++) {
    if (V.at(i) - C.at(i) > 0) {
      P += V.at(i) - C.at(i);
    }
  }

  cout << P;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, s = 0, ans = 0;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> b.at(i);
    c.at(i) = a.at(i) - b.at(i);
  }
  sort(c.begin(), c.end());
  reverse(c.begin(), c.end());
  while (true) {
    if (c.at(s) < 0)
      break;
    ans = c.at(s) + ans;
    s++;
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, s = 0, ans = 0;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> b.at(i);
    c.at(i) = a.at(i) - b.at(i);
  }
  sort(c.begin(), c.end());
  reverse(c.begin(), c.end());
  while (true) {
    if (s == n)
      break;
    if (c.at(s) < 0)
      break;
    ans = c.at(s) + ans;
    s++;
  }
  cout << ans << endl;
}
Problem p03060 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cfenv>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int V[20], C[20];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i)
    cin >> V[i];
  for (int i = 0; i < N; ++i)
    cin >> C[i];

  int sum = 0;
  for (int i = 0; N; ++i) {
    int a = V[i] - C[i];
    if (a > 0)
      sum += a;
  }
  cout << sum << endl;
  return 0;
}

Fixed submission:
#include <cfenv>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int V[20], C[20];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i)
    cin >> V[i];
  for (int i = 0; i < N; ++i)
    cin >> C[i];

  int sum = 0;
  for (int i = 0; i < N; ++i) {
    int a = V[i] - C[i];
    if (a > 0)
      sum += a;
  }
  cout << sum << endl;
  return 0;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int N, c, sum;
  int V[10];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> c;
    if (c < V[i]) {
      sum += V[i] - c;
    }
  }
  cout << sum << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int N, c, sum;
  int V[20];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> c;
    if (c < V[i]) {
      sum += V[i] - c;
    }
  }
  cout << sum << endl;
  return 0;
}
Problem p03060 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
// #include <fstream>

using namespace std;

int main(int argc, const char *argv[]) {
  //    ifstream in("input.txt");
  //    cin.rdbuf(in.rdbuf());

  int N;
  cin >> N;

  int max = 0;
  vector<int> V, C;
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }
  for (int i = 0; i < N; i++) {
    if (V[i] > C[i])
      max += V[i] - C[i];
  }

  cout << max << endl;

  return 0;
}


Fixed submission:
#include <iostream>
#include <vector>
// #include <fstream>

using namespace std;

int main(int argc, const char *argv[]) {
  //    ifstream in("input.txt");
  //    cin.rdbuf(in.rdbuf());

  int N;
  cin >> N;

  int max = 0;
  vector<int> V(N), C(N);
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }
  for (int i = 0; i < N; i++) {
    if (V[i] > C[i])
      max += V[i] - C[i];
  }

  cout << max << endl;

  return 0;
}