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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;
struct Edge {
  ll s, t, d;
};
typedef vector<vector<Edge>> Graph;

vi getDist(Graph graph, ll V, ll r) {
  vi dist(V);
  REP(i, V) dist[i] = INF;
  priority_queue<pii, vpii, greater<pii>> pq;
  dist[r] = 0;
  pq.push({0ll, r});
  while (pq.size()) {
    ll s = pq.top().second;
    for (Edge e : graph[s])
      if (dist[e.t] > dist[e.s] + e.d) {
        dist[e.t] = dist[e.s] + e.d;
        pq.push({dist[e.t], e.t});
      }
    pq.pop();
  }
  return dist;
}

int main() {
  ll N, M, R;
  cin >> N >> M >> R;
  vi r(R);
  REP(i, R) cin >> r[i];
  REP(i, R) r[i]--;
  Graph G(N);
  REP(i, M) {
    ll a, b, c;
    cin >> a >> b >> c;
    a -= 1;
    b -= 1;
    Edge x = {a, b, c};
    Edge y = {b, a, c};
    G[a].PB(x);
    G[b].PB(y);
  }

  UM<ll, vi> dist;
  REP(i, R) { dist[i] = getDist(G, N, r[i]); }

  sort(ALL(r));
  ll ans = INF;
  do {
    ll sum = 0;
    REP(i, R - 1) { sum += dist[r[i]][r[i + 1]]; }
    ans = min(ans, sum);
  } while (next_permutation(ALL(r)));
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;
struct Edge {
  ll s, t, d;
};
typedef vector<vector<Edge>> Graph;

vi getDist(Graph graph, ll V, ll r) {
  vi dist(V);
  REP(i, V) dist[i] = INF;
  priority_queue<pii, vpii, greater<pii>> pq;
  dist[r] = 0;
  pq.push({0ll, r});
  while (pq.size()) {
    ll s = pq.top().second;
    for (Edge e : graph[s])
      if (dist[e.t] > dist[e.s] + e.d) {
        dist[e.t] = dist[e.s] + e.d;
        pq.push({dist[e.t], e.t});
      }
    pq.pop();
  }
  return dist;
}

int main() {
  ll N, M, R;
  cin >> N >> M >> R;
  vi r(R);
  REP(i, R) cin >> r[i];
  REP(i, R) r[i]--;
  Graph G(N);
  REP(i, M) {
    ll a, b, c;
    cin >> a >> b >> c;
    a -= 1;
    b -= 1;
    Edge x = {a, b, c};
    Edge y = {b, a, c};
    G[a].PB(x);
    G[b].PB(y);
  }

  UM<ll, vi> dist;
  REP(i, R) { dist[r[i]] = getDist(G, N, r[i]); }

  sort(ALL(r));
  ll ans = INF;
  do {
    ll sum = 0;
    REP(i, R - 1) { sum += dist[r[i]][r[i + 1]]; }
    ans = min(ans, sum);
  } while (next_permutation(ALL(r)));
  cout << ans << endl;
}
Problem p03609 (Python)

Buggy submission (status: Runtime Error):
print(max(int(input()) - int(input()), 0))


Fixed submission:
x, t = list(map(int, input().split()))
print(max((x - t), 0))
Problem p03609 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  long long x, y, n, m, a;
  cin >> n >> m >> a;
  cout << ((n + a - 1) / a) * ((m + a - 1) / a) << endl;
  system("pause");
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  long long x, t;
  cin >> x >> t;
  if (x >= t)
    cout << x - t << endl;
  else
    cout << 0 << endl;
  system("pause");
  return 0;
}
Problem p03609 (C++)

Buggy submission (status: Memory Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
#define SORT(x) sort((x).begin(), (x).end(), greater<int>())
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
vector<vector<int>> memo(10000 + 1, vector<int>(10000 + 1, -1));
int main() {
  int x, t;
  cin >> x >> t;
  cout << (x < t ? 0 : x - t) << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
int main() {
  int x, t;
  cin >> x >> t;
  cout << (x < t ? 0 : x - t) << endl;
  return 0;
}
Problem p03609 (C++)

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

int main() {
  string s;
  cin >> s;
  string ans;
  for (int i = 0; 2 * i <= s.size(); i++) {
    ans += s.at(2 * i);
  }
  cout << ans << endl;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  cout << max(0, a - b) << endl;
}
Problem p03609 (C++)

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

int main(void) {
  int X = 0, t = 0, a = 0;

  scanf("%d %d", &X, t);

  if (X >= t) {
    a = X - t;
  } else {
    a = 0;
  }
  printf("%d\n", a);

  return 0;
}

Fixed submission:
#include <stdio.h>

int main(void) {
  int X = 0, t = 0, a = 0;

  scanf("%d %d", &X, &t);

  if (X >= t) {
    a = X - t;
  } else {
    a = 0;
  }
  printf("%d\n", a);

  return 0;
}
Problem p03609 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int X;
  int t;

  scanf("%d %d", &X, &t);

  if (X >= t) {
    X = X - t;
  } else {
    X = 0;
  }

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

  while (0 == 0) {
  }

  return 0;
}

Fixed submission:
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int X;
  int t;

  scanf("%d %d", &X, &t);

  if (X >= t) {
    X = X - t;
  } else {
    X = 0;
  }

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

  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
using namespace std;
int main(void) {
  char c;
  int flg = true;
  while (scanf("%c", &c), c) {
    if (flg) {
      printf("%c", c);
    }
    flg = !flg;
  }
  puts("");
  return 0;
}

Fixed submission:
#include <cstdio>
using namespace std;
int main(void) {
  char c;
  int flg = true;
  while (scanf("%c", &c), c >= 'a' && c <= 'z') {
    if (flg) {
      printf("%c", c);
    }
    flg = !flg;
  }
  puts("");
  return 0;
}
Problem p03610 (C++)

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

int main() {
  // 入力
  string S;
  cin >> S;

  // 出力
  string ans;
  for (int i = 0; i <= S.size() / 2; i++) {
    ans += S.at(2 * i);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  // 入力
  string S;
  cin >> S;

  // 出力
  string ans;
  for (int i = 0; i < (S.size() + 1) / 2; i++) {
    ans += S.at(2 * i);
  }
  cout << ans << endl;
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> T gcd(T a, T b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
// cout << 'H' << endl;
/*--------------------------------------------*/

int main() {
  // cout << fixed << setprecision(10)
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >> s;

  rep(i, sz(s)) {
    if (i %= 0) {
      cout << s[i];
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> T gcd(T a, T b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
// cout << 'H' << endl;
/*--------------------------------------------*/

int main() {
  // cout << fixed << setprecision(10)
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >> s;

  rep(i, sz(s)) {
    if (i % 2 == 0) {
      cout << s[i];
    }
  }
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  char s[10001];
  cin >> s;
  int n = strlen(s);
  string ans;
  for (int i = 0; i < n; i += 2) {
    ans += s[i];
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);                 // 標準入出力高速化
  std::ios_base::sync_with_stdio(false); // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15); // 小数を10進数表示
  Main();
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  char s[100001];
  cin >> s;
  int n = strlen(s);
  string ans;
  for (int i = 0; i < n; i += 2) {
    ans += s[i];
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);                 // 標準入出力高速化
  std::ios_base::sync_with_stdio(false); // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15); // 小数を10進数表示
  Main();
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;

int main() {
  char s[100];

  cin >> s;

  int x, i;

  for (x = 0; s[x] != '\0'; x++)
    ;

  for (i = 0; i < x; i++) {
    if (i < (x + 1) / 2) {
      s[i] = s[i * 2];
    } else {
      s[i] = ' ';
    }
  }

  cout << s;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;

int main() {
  char s[100000];

  cin >> s;

  int x, i;

  for (x = 0; s[x] != '\0'; x++)
    ;

  for (i = 0; i < x; i++) {
    if (i < (x + 1) / 2) {
      s[i] = s[i * 2];
    } else {
      s[i] = ' ';
    }
  }

  cout << s;

  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

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

  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0) {
      answer.at(i / 2) = s.at(i);
    }
  }

  cout << answer << endl;
}

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

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

  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0) {
      answer += s[i];
    }
  }

  cout << answer << endl;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0;; i += 2)
    cout << s[i];
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i += 2)
    cout << s[i];
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
  char s[1000];
  int a, len;
  cin >> s;
  len = strlen(s);
  for (a = 0; a < len; a += 2) {
    cout << s[a];
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
  char s[100000];
  int a, len;
  cin >> s;
  len = strlen(s);
  for (a = 0; a < len; a += 2) {
    cout << s[a];
  }
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; 2 * i <= s.size(); i++) {
    cout << s.at(2 * i);
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; 2 * i < s.size(); i++) {
    cout << s.at(2 * i);
  }
}
Problem p03610 (C++)

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

int main() {
  char s[10001];
  scanf("%s", s);
  for (int i = 0; i < strlen(s); i = i + 2) {
    printf("%c", s[i]);
  }
  printf("\n");
  return 0;
}

Fixed submission:
#include <stdio.h>
#include <string.h>

int main() {
  char s[100001];
  scanf("%s", s);
  for (int i = 0; i < strlen(s); i = i + 2) {
    printf("%c", s[i]);
  }
  printf("\n");
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  string a;
  cin >> a;
  for (int i = 0; i < a.size(); i + 2)
    cout << a[i];

  cout << endl;
}


Fixed submission:
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  string a;
  cin >> a;
  int b = 0;
  while (b < a.size()) {
    cout << a[b];
    b += 2;
  }

  cout << endl;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
using namespace std;
const int MaxN = 105;
int n;
char a[MaxN];
int main() {
  while (~scanf("%s", a)) {
    int n = strlen(a);
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0)
        printf("%c", a[i]);
    }
    printf("\n");
  }
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
using namespace std;
const int MaxN = 1e5 + 5;
int n;
char a[MaxN];
int main() {
  while (~scanf("%s", a)) {
    int n = strlen(a);
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0)
        printf("%c", a[i]);
    }
    printf("\n");
  }
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>
using namespace std;

int main() {
  string s;
  cin >> s;
  for (int i = 1; i <= s.size(); i++) {
    s.erase(s.begin() + i);
  }
  cout << s << endl;
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  for (int i = 1; i < s.size(); i++) {
    s.erase(s.begin() + i);
  }
  cout << s << endl;
  return 0;
}
Problem p03610 (C++)

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

int main() {
  string s;
  cin >> s;
  string ans;
  for (int i = 0; i < s.size() / 2 + 1; i++) {
    ans[i] = s[i * 2];
  }
  for (int i = 0; i < s.size() / 2 + 1; i++) {
    cout << ans[i];
  }
  cout << endl;
}


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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i += 2) {
    cout << s[i];
  }
  cout << endl;
}
Problem p03610 (Python)

Buggy submission (status: Runtime Error):
s = list(int(input()))
print(s[1::2])


Fixed submission:
s = input()
print(s[::2])
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string S;
  cin >> S;
  string ans;
  for (int i = 0; i < S.size() + 1; i++) {
    if (i % 2 == 0)

    {
      ans += S.at(i);
    }
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string S;
  cin >> S;
  string ans;
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0)

    {
      ans += S.at(i);
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p03610 (C++)

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

int main() {
  string s, ans;
  int n;
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i = i + 2) {
    ans.at(i / 2) = s.at(i);
  }
  cout << ans << endl;
}


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

int main() {
  string s, ans;
  int n;
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i += 2) {
    ans += s.at(i);
  }
  cout << ans << endl;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  char s[1000];
  cin >> s;
  for (int i = 0; i < strlen(s); i++) {
    if (i == 0 || i % 2 == 0)
      cout << s[i];
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  char s[100000];
  cin >> s;
  for (int i = 0; i < strlen(s); i++) {
    if (i == 0 || i % 2 == 0)
      cout << s[i];
  }
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  cin >> s;
  string t;
  int i;
  for (i = 0; 2 * i <= s.size(); i += 2) {
    t[i] = s[2 * i];
  }
  cout << t << endl;
  return 0;
}


Fixed submission:
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  cin >> s;
  string t;
  int i;
  for (i = 0; i < s.size(); i += 2) {
    t += s[i];
  }
  cout << t << endl;
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
  char S[100005];
  scanf("%s", S);
  for (int i = 0; i < strlen(S); i + 2) {
    printf("%c", S[i]);
  }
  printf("\n");
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
  char S[100005];
  scanf("%s", S);
  int l = strlen(S);
  for (int i = 0; i < l; i = i + 2) {
    printf("%c", S[i]);
  }
  printf("\n");
  return 0;
}
Problem p03610 (C++)

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

int main() {
  string s;
  cin >> s;
  string ans;
  for (int i = 0; 2 * i < s.size(); i++) {
    ans[i] = s[2 * i];
  }
  cout << ans << endl;
}

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

int main() {
  string s;
  cin >> s;
  string ans;
  int l = s.size();
  for (int i = 0; i < l; i += 2) {
    ans += s.at(i);
  }
  cout << ans << endl;
}
Problem p03610 (C++)

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

int main() {
  char a;
  string s;
  cin >> s;

  for (int i = 0; i < 10000; i++) {
    if (i % 2 == 0)
      cout << s.at(i);
  }

  cout << endl;
}

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

int main() {
  char a;
  string s;
  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0)
      cout << s.at(i);
  }

  cout << endl;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <string>

using namespace std;

int main() {
  vector<char> s(100000);
  for (int i = 0; i < s.size(); i++) {
    cin >> s.at(i);
  }
  for (int i = 0; i < s.size(); i++) {
    cout << s.at(2 * i);
  }
}

Fixed submission:
#include <bits/stdc++.h>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i += 2) {
    cout << s[i];
  }
}
Problem p03610 (C++)

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

int main() {
  string s;
  cin >> s;
  int N = s.size();
  N = (N + 1) / 2;
  for (int i = 0; i < N; i++) {
    cout << s.at(i * 2 - 1);
  }
  cout << endl;
}

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

int main() {
  string s;
  cin >> s;
  int N = s.size();
  N = (N + 1) / 2;
  for (int i = 1; i < N + 1; i++) {
    cout << s.at(i * 2 - 2);
  }
  cout << endl;
}
Problem p03610 (C++)

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

int main() {
  int i = 1;
  char c;
  while (scanf("%c", &c) && i != 32) {
    if (i)
      printf("%c", c);
    i ^= 1;
  }
  printf("\n");
}


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

int main() {
  int i = 1;
  char c;
  while (scanf("%c", &c) == 1 && i != 32) {
    if (i)
      printf("%c", c);
    i ^= 1;
  }
  printf("\n");
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>
using namespace std;

int main() {
  int i;
  string s;
  cin >> s;
  for (i = 0; i < s.size() - 3; i = i + 2) {
    cout << s[i] << endl;
  }
  return 0;
}

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

int main() {
  int i;
  string s;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    if (i % 2 == 0)
      cout << s[i];
  }
  return 0;
}
Problem p03610 (C++)

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

using namespace std;

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

  int N = s.size();

  for (int i = 0; i < N / 2 + 1; i++) {
    cout << s.at(2 * i);
  }

  cout << endl;
}

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

using namespace std;

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

  int N = s.size();

  for (int i = 0; i < (N + 1) / 2; i++) {
    cout << s.at(2 * i);
  }

  cout << endl;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}; // 前４つで４近傍
const int c_Dy[8] = {1, -1, 0, 0, 1, -1, 1, -1}; // 全部で８近傍
const int c_div = 1000000007;                    // 10^9 + 7
const double PI = 3.14159265358979323846;

int main() {

  char S[10000], R[19999];

  scanf("%s", S);

  for (int i = 0; i < strlen(S); i += 2) {
    printf("%c", S[i]);
  }
}


Fixed submission:
#include <algorithm>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}; // 前４つで４近傍
const int c_Dy[8] = {1, -1, 0, 0, 1, -1, 1, -1}; // 全部で８近傍
const int c_div = 1000000007;                    // 10^9 + 7
const double PI = 3.14159265358979323846;

int main() {

  char S[1000000], R[19999];

  scanf("%s", S);

  for (int i = 0; i < strlen(S); i += 2) {
    printf("%c", S[i]);
  }
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>

using namespace std;

int main(void) {

  string s;
  cin >> s;

  string ans = s;

  for (int i = 0; i < s.length(); ++i) {
    if (i % 2 == 1)
      ans.erase(ans.begin() + i);
  }

  cout << ans;
}


Fixed submission:
#include <iostream>
#include <string>

using namespace std;

int main(void) {

  string s;
  cin >> s;

  int len = s.length();
  // cout << len <<endl;
  int i;
  string ans;
  for (i = 0; i < len; i += 2) {
    ans += s[i];
  }

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

Buggy submission (status: Runtime Error):
// #include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)                                                               \
  cout << #v << ":";                                                           \
  for (auto x : v) {                                                           \
    cout << x << ' ';                                                          \
  }                                                                            \
  cout << endl;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
// cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  string ans = 0;
  for (int i = 0; i < s.size(); i += 2) {
    ans += s[i];
  }
  cout << ans << "\n";
}


Fixed submission:
// #include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)                                                               \
  cout << #v << ":";                                                           \
  for (auto x : v) {                                                           \
    cout << x << ' ';                                                          \
  }                                                                            \
  cout << endl;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
// cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  string ans = "";
  for (int i = 0; i < s.size(); i += 2) {
    ans += s[i];
  }
  cout << ans << "\n";
}
Problem p03610 (C++)

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

int main() {
  char s[10000];
  scanf("%s", s);
  int i;
  int len = strlen(s);
  for (i = 0; i < len; i += 2)
    printf("%c", s[i]);
  return 0;
}

Fixed submission:
#include <stdio.h>
#include <string.h>

int main() {
  char s[100000];
  scanf("%s", s);
  int i;
  int len = strlen(s);
  for (i = 0; i < len; i += 2)
    printf("%c", s[i]);
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
char s[10050];
int main() {
  scanf("%s", s);
  for (int i = 0; s[i]; i++)
    if (i % 2 == 0)
      printf("%c", s[i]);
  printf("\n");
}

Fixed submission:
#include <stdio.h>
char s[100500];
int main() {
  scanf("%s", s);
  for (int i = 0; s[i]; i++)
    if (i % 2 == 0)
      printf("%c", s[i]);
  printf("\n");
}
Problem p03610 (C++)

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

using namespace std;

int main() {
  char s[10000];
  cin >> s;

  for (int i = 0; i < strlen(s); i++) {
    if (i % 2 == 0)
      cout << s[i];
  }

  printf("\n");
}


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

using namespace std;

int main() {
  char s[100000];
  cin >> s;

  for (int i = 0; i < strlen(s); i++) {
    if (i % 2 == 0)
      cout << s[i];
  }

  printf("\n");
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
#include <cstring>
using namespace std;

int main(void) {
  char a[1000];
  int i, n;

  scanf("%s", a);

  n = strlen(a);

  for (i = 0; i < n; i++) {
    if (i % 2 == 0)
      printf("%c", a[i]);
  }
  printf("\n");

  return 0;
}


Fixed submission:
#include <cstdio>
#include <cstring>
using namespace std;

int main(void) {
  char a[100001];
  int i, n;

  scanf("%s", a);

  n = strlen(a);

  for (i = 0; i < n; i++) {
    if (i % 2 == 0)
      printf("%c", a[i]);
  }
  printf("\n");

  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  char c[5005];
  while (cin >> c) {
    for (int i = 0; c[i] != '\0'; i += 2) {
      cout << c[i];
      if (c[i + 1] == '\0')
        i--;
    }
    cout << endl;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  char c[100005];
  while (cin >> c) {
    for (int i = 0; c[i] != '\0'; i += 2) {
      cout << c[i];
      if (c[i + 1] == '\0')
        i--;
    }
    cout << endl;
  }
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
char c[10001];
int la = 0;
int main() {
  scanf("%s", &c);
  int la = strlen(c);
  for (int i = 0; i < la; i += 2) {
    cout << c[i];
  }
  cout << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
char c[100001];
int la = 0;
int main() {
  scanf("%s", &c);
  int la = strlen(c);
  for (int i = 0; i < la; i += 2) {
    cout << c[i];
  }
  cout << endl;
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  char c;
  int i = 0;
  while (c = getchar()) {
    i++;
    if (i % 2 == 1)
      cout << c;
  }
  cout << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i += 2)
    cout << s[i];
  cout << endl;
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Time Limit Exceeded):
// luogu-judger-enable-o2
#include <iostream>
using namespace std;
int main() {
  string a;
  cin >> a;
  for (int i = 0; i < a.length(); i + 2) {
    cout << a[i];
  }
  cout << endl;
  return 0;
}

Fixed submission:
// luogu-judger-enable-o2
#include <iostream>
using namespace std;
int main() {
  string a;
  cin >> a;
  for (int i = 0; i < a.length(); i += 2) {
    cout << a[i];
  }
  cout << endl;
  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;

  cin >> s;

  for (int i = 0; i < s.max_size(); i = i + 2)
    cout << s[i];
  cout << endl;

  return 0;
}


Fixed submission:
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;

  cin >> s;

  for (int i = 0; i < s.length(); i = i + 2)
    cout << s[i];
  cout << endl;

  return 0;
}
Problem p03610 (C++)

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

using namespace std;

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

  string ans;
  for (int i = 0; i <= s.length() / 2; i++) {
    ans[i] = s[2 * i];
    cout << ans[i];
  }

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

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

  string ans;
  for (int i = 0; i < s.length(); i += 2) {
    // ans[i]=s[2*i];
    // cout<<ans[i];
    cout << s[i];
  }

  return 0;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):

#include <cstdio>

int main() {
  char s[10001];
  scanf("%s", s);
  for (int i = 0; s[i] != '\0'; i++) {
    if (i % 2 == 0) {
      printf("%c", s[i]);
    }
  }
  printf("\n");

  return 0;
}

Fixed submission:

#include <cstdio>

int main() {
  char s[100001];
  scanf("%s", s);
  for (int i = 0; s[i] != '\0'; i++) {
    if (i % 2 == 0) {
      printf("%c", s[i]);
    }
  }
  printf("\n");

  return 0;
}
Problem p03610 (C++)

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

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

  for (i = 0; i < s.size(); i = 2 * i) {
    t = t + s[i];
  }
  cout << t << endl;
}


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

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

  for (i = 0; i < s.size(); i = 2 + i) {
    t = t + s[i];
  }
  cout << t << endl;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define debug(x) cout
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size)
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define per(i, a, n) for (int i = (n)-1; i >= (a); --i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9')
    f = (ch == '-') ? -1 : 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
inline void fileio() {
  freopen("t.in", "r", stdin);
  // freopen("t.out","w",stdout);
}
// Produced By MiracleEEEE
// head
char s[10005];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  rep(i, 0, n) if ((i % 2 == 0)) putchar(s[i]);
  puts("");
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define debug(x) cout
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size)
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define per(i, a, n) for (int i = (n)-1; i >= (a); --i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9')
    f = (ch == '-') ? -1 : 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
inline void fileio() {
  freopen("t.in", "r", stdin);
  // freopen("t.out","w",stdout);
}
// Produced By MiracleEEEE
// head
char s[100005];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  rep(i, 0, n) if ((i % 2 == 0)) putchar(s[i]);
  puts("");
  return 0;
}
Problem p03610 (C++)

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); s += 2) {
    cout << s.at(i);
  }
  cout << endl;
}

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i += 2) {
    cout << s.at(i);
  }
  cout << endl;
}
Problem p03610 (C++)

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

int main() {
  // 文字列を代入する
  string word;
  cin >> word;

  int i = 0;
  while (i <= word.size()) {
    cout << word.at(i);
    i += 2;
  }
}


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

int main() {
  // 文字列を代入する
  string word;
  cin >> word;

  int i = 0;
  while (i <= word.size() - 1) {
    cout << word.at(i);
    i += 2;
  }
}
Problem p03610 (C++)

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

using namespace std;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i + 2)
    cout << s.at(i);
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i = i + 2)
    cout << s.at(i);
}
Problem p03610 (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++)

int main() {
  string s;
  cin >> s;
  rep(i, s.size() / 2) { cout << s.at(2 * i); }
  if (s.size() / 2 == 1) {
    cout << s.at(s.size());
  }
  cout << endl;
}

Fixed submission:

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

int main() {
  string s;
  cin >> s;
  rep(i, s.size() / 2) { cout << s.at(2 * i); }
  if (s.size() % 2 == 1) {
    cout << s.at(s.size() - 1);
  }
  cout << endl;
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string>

int main() {
  std::string s;
  std::cin >> s;
  int n = s.size();
  for (int i = 0; i != n; i += 2)
    std::cout << s[i];
  std::cout << std::endl;
  return 0;
}

Fixed submission:
#include <iostream>
#include <string>

int main() {
  std::string s;
  std::cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i += 2)
    std::cout << s[i];
  std::cout << std::endl;
  return 0;
}
Problem p03610 (C++)

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    cout << s.at(i * 2);
  }
}


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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0) {
      cout << s.at(i);
    }
  }
}
Problem p03610 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <string.h>
using namespace std;
int main() {
  bool css = true;
  char s[1001];
  int i;
  cin >> s;
  for (i = 0; i < strlen(s); i++) {
    if (css)
      cout << s[i];
    css = !css;
  }
  return 0;
}


Fixed submission:
#include <iostream>
#include <string.h>
using namespace std;
int main() {
  bool css = true;
  char s[100001];
  int i;
  cin >> s;
  for (i = 0; i < strlen(s); i++) {
    if (css)
      cout << s[i];
    css = !css;
  }
  return 0;
}
Problem p03610 (C++)

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); s += 2) {
    cout << s[i];
  }
}

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i += 2) {
    cout << s[i];
  }
}
Problem p03611 (C++)

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

int main() {
  ll n;
  cin >> n;
  vector<ll> a(100100, 0);
  rep(i, n) {
    ll tmp;
    cin >> tmp;
    a[tmp - 1]++, a[tmp]++, a[tmp + 1]++;
  }
  cout << *max_element(a.begin(), a.end()) << endl;
}


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

int main() {
  ll n;
  cin >> n;
  vector<ll> a(100100, 0);
  rep(i, n) {
    ll tmp;
    cin >> tmp;
    if (tmp)
      a[tmp - 1]++;
    a[tmp]++, a[tmp + 1]++;
  }
  cout << *max_element(a.begin(), a.end()) << endl;
}
Problem p03611 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

# いもす法 imos法

imos = [0] * (10**5 + 1)

for i in range(N):
    l, r, s = a[i] - 1, a[i] + 1, 1
    l += 1
    r += 1
    # print(l, r)
    imos[l] += s
    imos[r + 1] -= s

for i in range(N + 1):
    imos[i + 1] = imos[i] + imos[i + 1]

# print(imos[: max(a) + 3])

print(max(imos[: max(a) + 3]))


Fixed submission:
N = int(input())
a = list(map(int, input().split()))

imos = [0] * (10**5 + 10)

for i in range(N):
    l, r, s = a[i] - 1, a[i] + 1, 1
    l += 1
    r += 1
    # print(l, r)
    imos[l] += s
    imos[r + 1] -= s

for i in range(N + 1):
    imos[i + 1] = imos[i] + imos[i + 1]

# print(imos[: max(a) + 3])

print(max(imos[: max(a) + 3]))
Problem p03611 (C++)

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

int main() {

  int n;
  cin >> n;
  vector<int> a(100100, 0);
  for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    a[num - 1] += 1;
  }
  int mx = 0;
  for (int i = 1; i < 100010; ++i) {
    if (mx < a[i - 1] + a[i] + a[i + 1])
      mx = a[i - 1] + a[i] + a[i + 1];
  }
  cout << mx << endl;
  return 0;
}

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

int main() {

  int n;
  cin >> n;
  vector<int> a(100100, 0);
  for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    a[num] += 1;
  }
  int mx = 0;
  for (int i = 1; i < 100010; ++i) {
    if (mx < a[i - 1] + a[i] + a[i + 1])
      mx = a[i - 1] + a[i] + a[i + 1];
  }
  cout << mx << endl;
  return 0;
}
Problem p03611 (C++)

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

int main() {

  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }

  vector<int> cosuu(100010);
  for (int i = 0; i < N; i++) {
    cosuu.at(vec.at(i))++;
  }

  int ans = 1;
  for (int i = 0; i < 10000; i++) {
    if (i == 0 && cosuu.at(i) + cosuu.at(i + 1) >= ans) {
      ans = cosuu.at(i) + cosuu.at(i + 1);
    } else if (0 < i < 9999 &&
               cosuu.at(i - 1) + cosuu.at(i) + cosuu.at(i + 1) >= ans) {
      ans = cosuu.at(i - 1) + cosuu.at(i) + cosuu.at(i + 1);
    } else if (i == 9999 && cosuu.at(i - 1) + cosuu.at(i) >= ans) {
      ans = cosuu.at(i - 1) + cosuu.at(i);
    }
  }

  cout << ans << endl;
}

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

int main() {

  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }

  vector<int> cosuu(100010);
  for (int i = 0; i < N; i++) {
    cosuu.at(vec.at(i))++;
  }

  int ans = 1;
  for (int i = 0; i < 100000; i++) {
    if (i == 0) {
      if (cosuu.at(i) + cosuu.at(i + 1) >= ans)
        ans = cosuu.at(i) + cosuu.at(i + 1);
    } else if (0 < i < 99999) {
      if (cosuu.at(i - 1) + cosuu.at(i) + cosuu.at(i + 1) >= ans) {
        ans = cosuu.at(i - 1) + cosuu.at(i) + cosuu.at(i + 1);
      }
    } else if (i == 99999) {
      if (cosuu.at(i - 1) + cosuu.at(i) >= ans) {
        ans = cosuu.at(i - 1) + cosuu.at(i);
      }
    }
  }

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

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

int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> a(100005);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x - 1]++;
  }
  for (int i = 0; i < a.size(); i++) {
    ans = max(ans, a[i - 1] + a[i] + a[i + 1]);
  }
  cout << ans;
}

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

int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> a(100005);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  for (int i = 0; i < a.size(); i++) {
    ans = max(ans, a[i - 1] + a[i] + a[i + 1]);
  }
  cout << ans;
}
Problem p03611 (C++)

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

int main(void) {

  long long n, i;

  long long a;

  long long *b;

  long long m = 0;

  scanf("%lld", &n);

  b = (long long *)malloc(sizeof(long long) * (4 * n));

  for (i = 0; i <= 3 * n; i = i + 1) {

    b[i] = 0;
  }

  for (i = 0; i < n; i = i + 1) {

    scanf("%lld", &a);

    b[a] += 1;

    b[a + 1] += 1;

    if (a > 0)
      b[a - 1] += 1;
  }

  for (i = 0; i <= 3 * n; i = i + 1) {

    if (b[i] > m)
      m = b[i];
  }

  if (n == 1) {

    printf("1\n");

    return 0;
  }

  printf("%lld\n", m);

  free(b);

  return 0;
}

Fixed submission:
#include <stdio.h>
#include <stdlib.h>

int main(void) {

  long long n, i;

  long long a;

  long long *b;

  long long m = 0;

  scanf("%lld", &n);

  b = (long long *)malloc(sizeof(long long) * (300030));

  for (i = 0; i <= 3 * n; i = i + 1) {

    b[i] = 0;
  }

  for (i = 0; i < n; i = i + 1) {

    scanf("%lld", &a);

    b[a] += 1;

    b[a + 1] += 1;

    if (a > 0)
      b[a - 1] += 1;
  }

  for (i = 0; i <= 3 * n; i = i + 1) {

    if (b[i] > m)
      m = b[i];
  }

  if (n == 1) {

    printf("1\n");

    return 0;
  }

  printf("%lld\n", m);

  free(b);

  return 0;
}
Problem p03611 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main(void) {
  ll n;
  cin >> n;
  ll a[n];
  ll backet[1000000] = {0};
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    backet[a[i]]++;
    backet[a[i] + 1]++;
    backet[a[i] - 1]++;
  }

  ll ans = 0;

  for (ll i = 0; i < 1000000; i++) {
    if (backet[i] > ans)
      ans = backet[i];
  }

  cout << ans << endl;
}


Fixed submission:
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main(void) {
  ll n;
  cin >> n;
  ll a[n];
  ll backet[1000000] = {0};
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    backet[a[i]]++;
    backet[a[i] + 1]++;
    if (a[i] >= 1) {
      backet[a[i] - 1]++;
    }
  }

  ll ans = 0;

  for (ll i = 0; i < 1000000; i++) {
    if (backet[i] > ans)
      ans = backet[i];
  }

  cout << ans << endl;
}