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

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int par[112345], rnk[112345];
int n, k, l, p[112345], q[112345], r[112345], s[112345], a[112345], b[112345];

void init() {
  REP(i, n) {
    par[i] = i;
    rnk[i] = 0;
  }
}

int find(int x) {
  if (par[x] == x)
    return x;
  else
    return par[x] = find(par[x]);
}

void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y)
    return;

  if (rnk[x] < rnk[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rnk[x] == rnk[y])
      rnk[x]++;
  }
}

int main() {
  cin >> n >> k >> l;
  map<P, int> mp;
  init();
  REP(i, k) {
    cin >> p[i] >> q[i];
    unite(p[i] - 1, q[i] - 1);
  }
  REP(i, n) { a[i] = find(i); }

  init();

  REP(i, l) {
    cin >> r[i] >> s[i];
    unite(r[i] - 1, s[i] - 1);
  }
  REP(i, n) {
    b[i] = find(i);

    mp[make_pair(a[i], b[i])]++;
  }

  /*
  REP(i, n)
  {
      cout << a[i] << (i == n - 1 ? "\n" : " ");
  }

  REP(i, n)
  {
      cout << b[i] << (i == n - 1 ? "\n" : " ");
  }
  */

  REP(i, n) { cout << mp[make_pair(a[i], b[i])] << (i == n - 1 ? "\n" : " "); }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int par[212345], rnk[212345];
int n, k, l, p[112345], q[112345], r[112345], s[112345], a[212345], b[212345];

void init() {
  REP(i, n) {
    par[i] = i;
    rnk[i] = 0;
  }
}

int find(int x) {
  if (par[x] == x)
    return x;
  else
    return par[x] = find(par[x]);
}

void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y)
    return;

  if (rnk[x] < rnk[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rnk[x] == rnk[y])
      rnk[x]++;
  }
}

int main() {
  cin >> n >> k >> l;
  map<P, int> mp;
  init();
  REP(i, k) {
    cin >> p[i] >> q[i];
    unite(p[i] - 1, q[i] - 1);
  }
  REP(i, n) { a[i] = find(i); }

  init();

  REP(i, l) {
    cin >> r[i] >> s[i];
    unite(r[i] - 1, s[i] - 1);
  }
  REP(i, n) {
    b[i] = find(i);

    mp[make_pair(a[i], b[i])]++;
  }

  /*
  REP(i, n)
  {
      cout << a[i] << (i == n - 1 ? "\n" : " ");
  }

  REP(i, n)
  {
      cout << b[i] << (i == n - 1 ? "\n" : " ");
  }
  */

  REP(i, n) { cout << mp[make_pair(a[i], b[i])] << (i == n - 1 ? "\n" : " "); }

  return 0;
}
Problem p03858 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long
#define N 100005
using namespace std;
int head[N], ver[N * 4], nxt[N * 4], tot;
void add(int a, int b) {
  tot++;
  nxt[tot] = head[a];
  head[a] = tot;
  ver[tot] = b;
  tot++;
  nxt[tot] = head[b];
  head[b] = tot;
  ver[tot] = a;
  return;
}
int n, a, b, x, y;
struct node {
  int x, y, id;
  friend bool operator<(const node &aa, const node &bb) {
    if (aa.x != bb.x)
      return aa.x < bb.x;
    return aa.y < bb.y;
  }
} p[N];
int v[N], ad[N], du[N];
long long ans;
void calc(int dx, int dy) {
  sort(p + 1, p + n + 1);
  memset(ad, 0, sizeof(ad));
  for (int i = 1; i <= n; i++) {
    int l =
        lower_bound(p + 1, p + n + 1, (node){p[i].x - dx, p[i].y - dy, -1}) - p;
    int r =
        upper_bound(p + 1, p + n + 1, (node){p[i].x - dx, p[i].y + dy, -1}) - p;

    if (l >= r)
      continue;

    du[p[i].id] += r - l;
    add(p[i].id, p[l].id);
    ad[l]++;
    ad[r - 1]--;
  }
  for (int i = 1; i <= n; i++) {
    ad[i] += ad[i - 1];
    if (ad[i] == 0)
      continue;
    add(p[i].id, p[i + 1].id);
  }
}

void dfs(int x) {
  v[x] = 1;
  ans += du[x];
  for (int i = head[x]; i; i = nxt[i]) {
    if (!v[ver[i]])
      dfs(ver[i]);
  }
}
int main() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &x, &y), p[i] = {x - y, x + y, i};
  int d = max(abs(p[a].x - p[b].x), abs(p[a].y - p[b].y));
  calc(d, d);
  for (int i = 1; i <= n; i++)
    swap(p[i].x, p[i].y);
  calc(d, d - 1);
  dfs(a);
  printf("%lld\n", ans);
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define N 200005
using namespace std;
int head[N], ver[N * 4], nxt[N * 4], tot;
void add(int a, int b) {
  tot++;
  nxt[tot] = head[a];
  head[a] = tot;
  ver[tot] = b;
  tot++;
  nxt[tot] = head[b];
  head[b] = tot;
  ver[tot] = a;
  return;
}
int n, a, b, x, y;
struct node {
  int x, y, id;
  friend bool operator<(const node &aa, const node &bb) {
    if (aa.x != bb.x)
      return aa.x < bb.x;
    return aa.y < bb.y;
  }
} p[N];
int v[N], ad[N], du[N];
long long ans;
void calc(int dx, int dy) {
  sort(p + 1, p + n + 1);
  memset(ad, 0, sizeof(ad));
  for (int i = 1; i <= n; i++) {
    int l =
        lower_bound(p + 1, p + n + 1, (node){p[i].x - dx, p[i].y - dy, -1}) - p;
    int r =
        upper_bound(p + 1, p + n + 1, (node){p[i].x - dx, p[i].y + dy, -1}) - p;

    if (l >= r)
      continue;

    du[p[i].id] += r - l;
    add(p[i].id, p[l].id);
    ad[l]++;
    ad[r - 1]--;
  }
  for (int i = 1; i <= n; i++) {
    ad[i] += ad[i - 1];
    if (ad[i] == 0)
      continue;
    add(p[i].id, p[i + 1].id);
  }
}

void dfs(int x) {
  v[x] = 1;
  ans += du[x];
  for (int i = head[x]; i; i = nxt[i]) {
    if (!v[ver[i]])
      dfs(ver[i]);
  }
}
int main() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &x, &y), p[i] = {x - y, x + y, i};
  int d = max(abs(p[a].x - p[b].x), abs(p[a].y - p[b].y));
  calc(d, d);
  for (int i = 1; i <= n; i++)
    swap(p[i].x, p[i].y);
  calc(d, d - 1);
  dfs(a);
  printf("%lld\n", ans);
  return 0;
}
Problem p03859 (C++)

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

using namespace std;

const int maxn = 3005, mo = int(1e9) + 7;

string s;
int a[maxn], m, far[maxn], f[maxn][maxn], co[maxn], n, ans;

int dfs(int l, int r, int c) {
  if (l == n + 1)
    return 1;
  if (r < far[l])
    c += co[far[l]] - co[r], r = far[l];
  if (~f[l][c])
    return f[l][c];
  int ans = 0;
  if (c)
    ans = (ans + dfs(l + 1, r, c - 1)) % mo;
  if (r - l + 1 - c)
    ans = (ans + dfs(l + 1, r, c)) % mo;
  return ans;
}

int main() {
  cin >> n >> m;
  cin >> s;
  for (int i = 1; i <= n; i++)
    a[i] = s[i - 1] - '0', co[i] = co[i - 1] + a[i];
  for (int i = 1, l, r; i <= m; i++)
    cin >> l >> r, far[l] = max(far[l], r);
  for (int i = 1; i <= n; i++)
    far[i] = max(far[i], far[i - 1]), far[i] = max(far[i], i);
  memset(f, 255, sizeof f);
  cout << dfs(1, 0, 0) << endl;
  return 0;
}


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

using namespace std;

const int maxn = 3005, mo = int(1e9) + 7;

string s;
int a[maxn], m, far[maxn], f[maxn][maxn], co[maxn], n, ans;

int dfs(int l, int r, int c) {
  if (l == n + 1)
    return 1;
  if (r < far[l])
    c += co[far[l]] - co[r], r = far[l];
  if (~f[l][c])
    return f[l][c];
  int ans = 0;
  if (c)
    ans = (ans + dfs(l + 1, r, c - 1)) % mo;
  if (r - l + 1 - c)
    ans = (ans + dfs(l + 1, r, c)) % mo;
  return f[l][c] = ans;
}

int main() {
  cin >> n >> m;
  cin >> s;
  for (int i = 1; i <= n; i++)
    a[i] = s[i - 1] - '0', co[i] = co[i - 1] + a[i];
  for (int i = 1, l, r; i <= m; i++)
    cin >> l >> r, far[l] = max(far[l], r);
  for (int i = 1; i <= n; i++)
    far[i] = max(far[i], far[i - 1]), far[i] = max(far[i], i);
  memset(f, 255, sizeof f);
  cout << dfs(1, 0, 0) << endl;
  return 0;
}
Problem p03859 (C++)

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

using namespace std;

typedef long long LL;
#define N 2005

const LL mod = 1000000007;
LL ans, n, m, C[N][N], f[N], g[N], a[N];
char s[N];

void upd(LL &x, LL y) { x = (x + y) % mod; }

int main() {
  scanf("%lld%lld%s", &n, &m, s + 1);
  for (LL i = 0; i <= n; ++i) {
    C[i][0] = 1;
    for (LL j = 1; j <= i; ++j)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  }
  for (LL i = 1; i <= n; ++i)
    a[i] = s[i] - '0';
  f[0] = 1;
  ans = 1;
  LL l = 1, r = 0;
  for (LL i = 1; i <= m; ++i) {
    LL x, y;
    scanf("%lld%lld", &x, &y);
    if (y <= r)
      continue;
    if (x > r) {
      LL sum = 0;
      for (LL j = 0; j <= r - l + 1; ++j) {
        upd(sum, f[j] * C[r - l + 1][j]);
      }
      ans = ans * sum % mod;
      memset(f, 0, sizeof f);
      f[0] = 1;
      l = x;
      r = x - 1;
    }
    LL tmp = 0;
    for (LL j = r + 1; j <= y; ++j) {
      tmp += a[j];
    }
    LL len = x - l;
    memset(g, 0, sizeof g);
    for (LL j = 0; j <= n; ++j) {
      for (LL k = 0; k <= len && k <= j; ++k) {
        if (j - k <= r - l + 1 - len)
          upd(g[j - k + tmp], f[j] * C[len][k]);
      }
    }
    memcpy(f, g, sizeof f);
    l = x;
    r = y;
  }
  LL sum = 0;
  for (LL j = 0; j <= r - l + 1; ++j) {
    upd(sum, f[j] * C[r - l + 1][j]);
  }
  ans = ans * sum % mod;
  printf("%lld\n", ans);

  return 0;
}


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

using namespace std;

typedef long long LL;
#define N 3005

const LL mod = 1000000007;
LL ans, n, m, C[N][N], f[N], g[N], a[N];
char s[N];

void upd(LL &x, LL y) { x = (x + y) % mod; }

int main() {
  scanf("%lld%lld%s", &n, &m, s + 1);
  for (LL i = 0; i <= n; ++i) {
    C[i][0] = 1;
    for (LL j = 1; j <= i; ++j)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  }
  for (LL i = 1; i <= n; ++i)
    a[i] = s[i] - '0';
  f[0] = 1;
  ans = 1;
  LL l = 1, r = 0;
  for (LL i = 1; i <= m; ++i) {
    LL x, y;
    scanf("%lld%lld", &x, &y);
    if (y <= r)
      continue;
    if (x > r) {
      LL sum = 0;
      for (LL j = 0; j <= r - l + 1; ++j) {
        upd(sum, f[j] * C[r - l + 1][j]);
      }
      ans = ans * sum % mod;
      memset(f, 0, sizeof f);
      f[0] = 1;
      l = x;
      r = x - 1;
    }
    LL tmp = 0;
    for (LL j = r + 1; j <= y; ++j) {
      tmp += a[j];
    }
    LL len = x - l;
    memset(g, 0, sizeof g);
    for (LL j = 0; j <= n; ++j) {
      for (LL k = 0; k <= len && k <= j; ++k) {
        if (j - k <= r - l + 1 - len)
          upd(g[j - k + tmp], f[j] * C[len][k]);
      }
    }
    memcpy(f, g, sizeof f);
    l = x;
    r = y;
  }
  LL sum = 0;
  for (LL j = 0; j <= r - l + 1; ++j) {
    upd(sum, f[j] * C[r - l + 1][j]);
  }
  ans = ans * sum % mod;
  printf("%lld\n", ans);

  return 0;
}
Problem p03859 (C++)

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

const int Mod = 1e9 + 7, N = 1e3 + 10;

int n, m, dp[N][N], summ[N];
char s[N];

void Init() {
  scanf("%d%d", &n, &m);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i)
    summ[i] = summ[i - 1] + (s[i] == '0');
}

void Solve() {
  int nowr = 0, l, r, cnt = 0;
  scanf("%d%d", &l, &r);
  ++cnt;
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    int sum = 0;
    while (i + 1 == l && cnt <= m) {
      if (r > nowr)
        sum += summ[r] - summ[nowr], nowr = r;
      if (cnt < m) {
        scanf("%d%d", &l, &r);
        ++cnt;
      } else
        break;
    }
    if (nowr > i) {
      for (int j = 0; j <= nowr - i; ++j) {
        if (j + sum)
          dp[i + 1][j + sum - 1] = (dp[i + 1][j + sum - 1] + dp[i][j]) % Mod;
        if (nowr - i - j - sum)
          dp[i + 1][j + sum] = (dp[i + 1][j + sum] + dp[i][j]) % Mod;
      }
    } else
      dp[i + 1][0] = dp[i][0], nowr = i + 1;
  }
  printf("%d\n", dp[n][0]);
}

int main() {
  Init();
  Solve();
  return 0;
}

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

const int Mod = 1e9 + 7, N = 3e3 + 10;

int n, m, dp[N][N], summ[N];
char s[N];

void Init() {
  scanf("%d%d", &n, &m);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i)
    summ[i] = summ[i - 1] + (s[i] == '0');
}

void Solve() {
  int nowr = 0, l, r, cnt = 0;
  scanf("%d%d", &l, &r);
  ++cnt;
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    int sum = 0;
    while (i + 1 == l && cnt <= m) {
      if (r > nowr)
        sum += summ[r] - summ[nowr], nowr = r;
      if (cnt < m) {
        scanf("%d%d", &l, &r);
        ++cnt;
      } else
        break;
    }
    if (nowr > i) {
      for (int j = 0; j <= nowr - i; ++j) {
        if (j + sum)
          dp[i + 1][j + sum - 1] = (dp[i + 1][j + sum - 1] + dp[i][j]) % Mod;
        if (nowr - i - j - sum)
          dp[i + 1][j + sum] = (dp[i + 1][j + sum] + dp[i][j]) % Mod;
      }
    } else
      dp[i + 1][0] = dp[i][0], nowr = i + 1;
  }
  printf("%d\n", dp[n][0]);
}

int main() {
  Init();
  Solve();
  return 0;
}
Problem p03859 (C++)

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

using namespace std;
const int MOD = 1e9 + 7;

void act(int &a, int b) {
  a += b;
  if (a >= MOD)
    a -= MOD;
}

int main() {
  int n, m;
  cin >> n >> m;

  string s;
  cin >> s;
  vector<int> ones(n), zero(n);
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1')
      ones[i] = 1;
    else
      zero[i] = 1;
    if (i > 0) {
      ones[i] += ones[i - 1];
      zero[i] += zero[i - 1];
    }
  }

  vector<int> best(n);
  for (int i = 0; i < n; ++i)
    best[i] = i;

  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    --l;
    --r;
    best[l] = max(best[l], r);
  }
  for (int i = 0; i + 1 < n; ++i) {
    best[i + 1] = max(best[i + 1], best[i]);
  }
  vector<vector<int>> dp(n + 1, vector<int>(n + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      int at = i + j;
      bool can_zero = zero[best[at]] > i;
      bool can_ones = ones[best[at]] > j;
      if (can_zero)
        act(dp[i + 1][j], dp[i][j]);
      if (can_ones)
        act(dp[i][j + 1], dp[i][j]);
    }
  }

  int ans = 0;
  for (int i = 0, j = n; i <= n; ++i, --j)
    act(ans, dp[i][j]);
  cout << ans << endl;

  return 0;
}


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

using namespace std;
const int MOD = 1e9 + 7;

void act(int &a, int b) {
  a += b;
  if (a >= MOD)
    a -= MOD;
}

int main() {
  int n, m;
  cin >> n >> m;

  string s;
  cin >> s;
  vector<int> ones(n), zero(n);
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1')
      ones[i] = 1;
    else
      zero[i] = 1;
    if (i > 0) {
      ones[i] += ones[i - 1];
      zero[i] += zero[i - 1];
    }
  }

  vector<int> best(n);
  for (int i = 0; i < n; ++i)
    best[i] = i;

  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    --l;
    --r;
    best[l] = max(best[l], r);
  }
  for (int i = 0; i + 1 < n; ++i) {
    best[i + 1] = max(best[i + 1], best[i]);
  }
  vector<vector<int>> dp(n + 1, vector<int>(n + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; i + j <= n; ++j) {
      int at = i + j;
      bool can_zero = zero[best[at]] > i;
      bool can_ones = ones[best[at]] > j;
      if (can_zero)
        act(dp[i + 1][j], dp[i][j]);
      if (can_ones)
        act(dp[i][j + 1], dp[i][j]);
    }
  }

  int ans = 0;
  for (int i = 0, j = n; i <= n; ++i, --j)
    act(ans, dp[i][j]);
  cout << ans << endl;

  return 0;
}
Problem p03859 (C++)

Buggy submission (status: Time Limit Exceeded):
#include "bits/stdc++.h"
using namespace std;
const int N = 3e3 + 3;
const int mod = 1e9 + 7;
int n, m;
char str[N];
int sum[N];
int arr[N];
int a, b;
int dp[N][N];
int solve(int l, int r, int cnt) {
  if (cnt > r - l + 1) {
    return 0;
  }
  if (l > n) {
    return 1;
  }
  if (arr[l] > r) {
    cnt += sum[arr[l]] - sum[r];
    r = arr[l];
  }
  if (dp[l][cnt] != -1) {
    return dp[l][cnt];
  }
  int res = 0;
  if (cnt) {
    res += solve(l + 1, r, cnt - 1);
  }
  res += solve(l + 1, r, cnt);
  if (res >= mod) {
    res -= mod;
  }
  if (dp[l][cnt] != -1) {
    return dp[l][cnt];
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &m);
  scanf("%s", str + 1);
  sum[0] = 0;
  for (int i = 1; i <= n; ++i) {
    sum[i] = sum[i - 1] + str[i] - '0';
  }
  for (int i = 1; i <= n; ++i) {
    arr[i] = i;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", &a, &b);
    arr[a] = max(arr[a], b);
  }
  memset(dp, -1, sizeof(dp));
  printf("%d\n", solve(1, 0, 0));
}

Fixed submission:
#include "bits/stdc++.h"
using namespace std;
const int N = 3e3 + 3;
const int mod = 1e9 + 7;
int n, m;
char str[N];
int sum[N];
int arr[N];
int a, b;
int dp[N][N];
int solve(int l, int r, int cnt) {
  if (cnt > r - l + 1) {
    return 0;
  }
  if (l > n) {
    return 1;
  }
  if (arr[l] > r) {
    cnt += sum[arr[l]] - sum[r];
    r = arr[l];
  }
  if (dp[l][cnt] != -1) {
    return dp[l][cnt];
  }
  int res = 0;
  if (cnt) {
    res += solve(l + 1, r, cnt - 1);
  }
  res += solve(l + 1, r, cnt);
  if (res >= mod) {
    res -= mod;
  }
  return dp[l][cnt] = res;
}
int main() {
  scanf("%d %d", &n, &m);
  scanf("%s", str + 1);
  sum[0] = 0;
  for (int i = 1; i <= n; ++i) {
    sum[i] = sum[i - 1] + str[i] - '0';
  }
  for (int i = 1; i <= n; ++i) {
    arr[i] = i;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", &a, &b);
    arr[a] = max(arr[a], b);
  }
  memset(dp, -1, sizeof(dp));
  printf("%d\n", solve(1, 0, 0));
}
Problem p03859 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <cstring>
#define N 3005
using namespace std;
const int mod = 1e9 + 7;
int n, m;
char t[N];
int s[N], val[N], dp[2][N];
int main() {
  // freopen("in.txt","r",stdin);
  scanf("%d%d%s", &n, &m, t + 1);
  for (int i = 1; i <= n; i++)
    s[i] = t[i] - '0' + s[i - 1];
  int cnt = 0;
  for (int i = 1, ml, mr; i <= m; i++)
    scanf("%d%d", &ml, &mr), val[ml] = max(val[ml], mr);
  for (int i = 1; i <= n; i++)
    val[i] = max(max(i, val[i]), val[i - 1]);
  int now = 0;
  dp[now][0] = 1;
  for (int i = 1; i <= n; i++, now ^= 1) {
    memset(dp[now ^ 1], 0, sizeof(dp[0]));
    for (int j = s[val[i]] - (val[i] - i); j <= s[val[i]]; j++)
      dp[now ^ 1][j] = (dp[now][j] + (j == 0 ? 0 : dp[now][j - 1])) % mod;
  }
  cout << dp[now][s[n]] << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <cstring>
#define N 3005
using namespace std;
const int mod = 1e9 + 7;
int n, m;
char t[N];
int s[N], val[N], dp[2][N];
int main() {
  // freopen("in.txt","r",stdin);
  scanf("%d%d%s", &n, &m, t + 1);
  for (int i = 1; i <= n; i++)
    s[i] = t[i] - '0' + s[i - 1];
  int cnt = 0;
  for (int i = 1, ml, mr; i <= m; i++)
    scanf("%d%d", &ml, &mr), val[ml] = max(val[ml], mr);
  for (int i = 1; i <= n; i++)
    val[i] = max(max(i, val[i]), val[i - 1]);
  int now = 0;
  dp[now][0] = 1;
  for (int i = 1; i <= n; i++, now ^= 1) {
    memset(dp[now ^ 1], 0, sizeof(dp[0]));
    for (int j = max(0, s[val[i]] - (val[i] - i)); j <= s[val[i]]; j++)
      dp[now ^ 1][j] = (dp[now][j] + (j == 0 ? 0 : dp[now][j - 1])) % mod;
  }
  cout << dp[now][s[n]] << endl;
  return 0;
}
Problem p03860 (C++)

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

int main() {
  string N;
  cin >> N;
  cout << "A" << N.at(8) << "C" << endl;
}


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

int main() {
  string s, N;
  cin >> s >> N;
  cout << "A" << N.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
  string s;
  cin >> s;
  cout << 'A' << s.at(8) << 'C';

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
  string s;
  cin >> s;
  cin >> s;
  cout << 'A' << s.at(0) << 'C';

  return 0;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stdio.h>
#include <string>
#include <typeinfo>
using namespace std;

int main() {
  char a[2];
  cin >> a >> a;
  cout << "A" << a[0] << "C";
}


Fixed submission:
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stdio.h>
#include <string>
#include <typeinfo>
using namespace std;

int main() {
  char a[99];
  cin >> a >> a;
  cout << "A" << a[0] << "C";
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main(void) {
  char contest[101];
  char ans[1];

  int i;

  scanf("%[^\n\r]", contest);

  for (i = 1; contest[i - 1] != ' '; i++) {
  }

  ans[0] = contest[i];
  printf("A%cC\n", ans[0]);
  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  char contest[201];
  char ans[1];

  int i;

  scanf("%[^\n\r]", contest);

  for (i = 1; contest[i - 1] != ' '; i++) {
  }

  ans[0] = contest[i];
  printf("A%cC\n", ans[0]);
  return 0;
}
Problem p03860 (C++)

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

int main() {
  string S;
  cin >> S;
  cout << "A" << S.at(7) << "C" << endl;
}

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

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  cout << "A" << B.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  cout << "A" << s.at(8) << "C";
}

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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << "A" << s2.at(0) << "C";
}
Problem p03860 (C++)

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

int main() {
  string name;
  cin >> name;
  cout << 'A' + name.at(8) + 'C';
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(0) << c.at(0);
}
Problem p03860 (Python)

Buggy submission (status: Runtime Error):
""" AtCoder """

A, s, C = map(int, input().split())

print("A" + s[0] + "C")


Fixed submission:
""" AtCoder """

A, s, C = input().split()

print("A" + s[0] + "C")
Problem p03860 (Python)

Buggy submission (status: Runtime Error):
a, s, c = map(int, input().split())
print(a[0] + s[0] + c[0])


Fixed submission:
a, s, c = map(str, input().split())
print(a[0] + s[0] + c[0])
Problem p03860 (Python)

Buggy submission (status: Runtime Error):
S = input().split()
print("A" + S[8] + "C")


Fixed submission:
S = input()
print("A" + S[8] + "C")
Problem p03860 (Python)

Buggy submission (status: Runtime Error):
a, b, c = str(input().split())
print(a[0], b[0], c[0])


Fixed submission:
[print(i[0], end="") for i in input().split()]
print()
Problem p03860 (Python)

Buggy submission (status: Runtime Error):
if sorted([int(_) for _ in input().split()]) == [5, 5, 7]:
    print("YES")
else:
    print("NO")


Fixed submission:
print("A" + input().split()[1][0] + "C")
Problem p03860 (Python)

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

if len(A) % 2 == 0:
    A = A + [0]
# print('A', A)

ans = 0
for i in range(1, N, 2):
    total = A[i - 1] + A[i]
    diff = total - x
    if diff <= 0:
        continue
    v1 = min(A[i], diff)
    v2 = diff - v1
    A[i] -= v1
    A[i - 1] -= v2
    ans += v1 + v2
    # print('A', A)
print(ans)


Fixed submission:
S = input().split()
ans = f"A{S[1][0]}C"
print(ans)
Problem p03860 (Python)

Buggy submission (status: Runtime Error):
a, b, c = map(int, input().split())
print(a[0] + b[0] + c[0])


Fixed submission:
a, b, c = map(str, input().split())
print(a[0] + b[0] + c[0])
Problem p03860 (Python)

Buggy submission (status: Runtime Error):
print("A{}C".format(input().split()[1][1]))


Fixed submission:
print("A{}C".format(input().split()[1][0]))
Problem p03860 (C++)

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

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

  cout << ans << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(0) << c.at(0) << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main(void) {
  char a[100], b[100], c[100];
  scanf("%s %s %s", a, b, c);
  printf("A%sC", b[0]);
}


Fixed submission:
#include <stdio.h>
int main(void) {
  char a[100], b[100], c[100];
  scanf("%s %s %s", a, b, c);
  printf("A%cC", b[0]);
}
Problem p03860 (C++)

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

using namespace std;

typedef long long ll;

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

  char a[7];
  for (int i = 0; i < 9; i++) {
    cin >> a[i];
  }

  cout << "A" << a[7] << "C" << endl;
}

Fixed submission:
#include <iostream>

using namespace std;

typedef long long ll;

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

  char a[150];
  for (int i = 0; i < 9; i++) {
    cin >> a[i];
  }

  cout << "A" << a[7] << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  cout << "A" << s.at(8) << "C";
}

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

int main() {
  string s;
  getline(cin, s);
  cout << "A" << s.at(8) << "C";
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  cout << "A" << S.at(7) << "C" << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(0) << c.at(0) << endl;
}
Problem p03860 (C++)

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

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

  cout << "A" << s.at(8) << "C" << endl;
}


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

int main() {
  string s;
  getline(cin, s);

  cout << "A" << s.at(8) << "C" << endl;
}
Problem p03860 (C++)

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

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

  cout << 'A' << s.at(8) << 'C' << endl;
}


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

int main() {
  string s;
  getline(cin, s);

  cout << 'A' << s.at(8) << 'C' << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  char A = s.at(7);
  cout << "A" << A << "C" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  cin >> s;
  char A = s.at(0);
  cout << "A" << A << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  cout << A.at(1) << B.at(1) << C.at(1) << endl;
}

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

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  cout << A.at(0) << B.at(0) << C.at(0) << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  cout << 'A' << s.at(8) << 'C' << endl;
}

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

int main() {
  string s1, s2;
  cin >> s1 >> s2;
  cout << 'A' << s2.at(0) << 'C' << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  cout << "A" << s.at(8) << "C" << endl;
}


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

int main() {
  string s;
  getline(cin, s);
  cout << "A" << s.at(8) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  int A, C;
  string s;
  cin >> A, s, C;
  cout << "A" << s.at(0) << "C" << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  string S;
  cin >> S;
  cout << "A" << S.at(8) << "B" << endl;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  string a, S, b;
  cin >> a >> S >> b;
  cout << "A" << S.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string at, s;
  cin >> at >> s;
  char c = s.at(8);
  cout << 'A' << c << 'C' << endl;
}


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

int main() {
  string s;
  getline(cin, s);
  char c = s.at(8);
  cout << 'A' << c << 'C' << endl;
}
Problem p03860 (C++)

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << 'A' << b.at(1) << 'C' << endl;
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << 'A' << b.at(0) << 'C' << endl;
}
Problem p03860 (C++)

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

int main() {
  string first, second, third;
  cin >> first >> second >> third;
  cout << first.at(0) << second.at(1) << third.at(2) << endl;
}

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

int main() {
  string first, second, third;
  cin >> first >> second >> third;
  cout << first.at(0) << second.at(0) << third.at(0) << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  char x = s.at(8);
  cout << "A" << x << "B" << endl;
}

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

int main() {
  string a, s, b;
  cin >> a >> s >> b;
  char x = s.at(0);
  cout << "A" << x << "C" << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string r, s, t;
  cin >> r >> s >> t;

  cout << "A" << s.at(1) << "C";
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string r, s, t;
  cin >> r >> s >> t;

  cout << "A" << s.at(0) << "C";
}
Problem p03860 (C++)

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

int main() {
  string A;
  cin >> A;
  cout << "A" << A.at(8) << "C" << endl;
}

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

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  cout << "A" << B.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string S;
  cin >> S;
  char x;
  x = S.at(8);
  cout << 'A' << x << 'C';
}


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

int main() {
  string S;
  getline(cin, S);
  char x;
  x = S.at(8);
  cout << 'A' << x << 'C';
}
Problem p03860 (C++)

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

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

  cout << "A" << s.at(8) << "C" << endl;
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}
Problem p03860 (C++)

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

int main() {
  string a;
  cin >> a;
  cout << 'A' << a.at(8) << 'C' << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(0) << c.at(0) << endl;
}
Problem p03860 (C++)

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;

  cout << a.at(1) + b.at(1) + c.at(1) << endl;

  return 0;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#define int long
using namespace std;

signed main() {
  string S;
  cin >> S;
  cout << "A" << S.at(7) << "C" << endl;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#define int long
using namespace std;

signed main() {
  string A, B, C;
  cin >> A >> B >> C;
  cout << "A" << B.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

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

  cout << 'A' + t.at(0) + 'C' << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}
Problem p03860 (C++)

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

int main() {
  string a, b, c, x, y, z;
  cin >> a, b, c;

  // ここにプログラムを追記
  x = a.at(0);
  y = b.at(0);
  z = c.at(0);
  cout << x + y + z << endl;
}


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

int main() {
  string a, b, c, x, y, z;
  cin >> a >> b >> c;

  // ここにプログラムを追記
  x = a.at(0);
  y = b.at(0);
  z = c.at(0);
  cout << x + y + z << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, x;
  cin >> a >> b >> x;
  long long int answer = (b - (b % x)) / x - (a - 1 - ((a - 1) % x)) / x;
  if (a == 0)
    answer++;
  cout << answer << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define mod 10000007
#define ff first
#define ss second
#define ll long long
#define int long long
#define pii pair<ll, ll>
#define vi vector<ll>
#define mii map<ll, ll>
#define pb push_back
#define mp make_pair
#define sp(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)                                                                   \
  ll x;                                                                        \
  cin >> x;                                                                    \
  while (x--)
#define endl '\n'
#define str string
#define all(v) v.begin(), v.end()
void kehsihba() {
  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
}
int32_t main() {
  kehsihba();
  str a, b, c;
  cin >> a >> b >> c;
  cout << "A" << b[0] << "C";
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define mod 10000007
#define ff first
#define ss second
#define ll long long
#define int long long
#define pii pair<ll, ll>
#define vi vector<ll>
#define mii map<ll, ll>
#define pb push_back
#define mp make_pair
#define sp(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)                                                                   \
  ll x;                                                                        \
  cin >> x;                                                                    \
  while (x--)
#define endl '\n'
#define str string
#define all(v) v.begin(), v.end()
void kehsihba() {
  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
}
int32_t main() {
  // kehsihba();
  str a, b, c;
  cin >> a >> b >> c;
  cout << "A" << b[0] << "C";
}
Problem p03860 (C++)

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

int main() {
  string a, b, c;
  getline(cin, a); // 変数sで入力を一行受け取る
  getline(cin, b);
  getline(cin, c); // 変数tで入力を一行受け取る

  cout << a.at(0) << b.at(0) << c.at(0) << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;

  cout << a.at(0) << b.at(0) << c.at(0) << endl;
}
Problem p03860 (C++)

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

int main(void) {
  char a[80] = "\0", b[80] = "\0";
  scanf("%s", a);
  scanf("%s", b);
  scanf("%s", a);
  printf("A%cC\n", b[0]);
  return 0;
}

Fixed submission:
#include <stdio.h>

int main(void) {
  char a[120] = "\0", b[120] = "\0";
  scanf("%s", a);
  scanf("%s", b);
  scanf("%s", a);
  printf("A%cC\n", b[0]);
  return 0;
}
Problem p03860 (C++)

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a << " " << b.at(1) << " " << c << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(0) << c.at(0) << endl;
}
Problem p03860 (C++)

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

int main() {
  string s1, s2, s3;

  cin >> s1 >> s2 >> s3;

  cout << s1.at(1) << s2.at(1) << s3.at(1) << endl;
}


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

int main() {
  string s1, s2, s3;

  cin >> s1 >> s2 >> s3;

  cout << s1.at(0) << s2.at(0) << s3.at(0) << endl;
}
Problem p03860 (C++)

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

int main(int argc, char *argv[]) {
  char str1[16], str2[16], str3[16];
  cin >> str1 >> str2 >> str3;

  cout << 'A' << str2[0] << 'C' << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;

int main(int argc, char *argv[]) {
  char str1[16], str2[128], str3[16];
  cin >> str1 >> str2 >> str3;

  cout << 'A' << str2[0] << 'C' << endl;

  return 0;
}
Problem p03860 (C++)

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

int main() {
  string S, T, U;
  cin >> S, T, U;
  cout << "A" << T.at(0) << "C" << endl;
}


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

int main() {
  string S, T, U;
  cin >> S >> T >> U;
  cout << "A" << T.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  cout << "A" << s.at(8) << "C" << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << "A" << b.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  cout << "A" << s.at(8) + "C" << endl;
}

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

int main() {
  string s;
  getline(cin, s);
  cout << 'A' << s.at(8) << 'C' << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  cout << 'A' + s.at(7) + 'C' << endl;
}


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

int main() {
  string a, s, c;
  cin >> a >> s >> c;
  cout << a.at(0) << s.at(0) << c.at(0) << endl;
}
Problem p03860 (C++)

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

int main() {
  string a, b;
  cin >> a >> b;
  cout << "A" << b.at(1) << "C" << endl;
}

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

int main() {
  string a, b;
  cin >> a >> b;
  cout << "A" << b.at(0) << "C" << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  cout << 'A' << s.at(8) << 'C' << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t, u;
  cin >> s >> t >> u;
  cout << "A" << t.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string a;
  cin >> a;
  cout << a.at(8) << endl;
}


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

int main() {
  string a;
  string b;
  string c;
  cin >> a >> b >> c;

  cout << "A" << b.at(0) << "C" << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  char c;
  c = s.at(7);
  cout << "A" << c << "C" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  char d;
  d = b.at(0);
  cout << "A" << d << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  char x = s.at(8);
  cout << "A" << x << "C" << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << "A" << b.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

using namespace std;

int main() {
  char s[101];
  scanf("%[^\n]", s);
  int len = strlen(s);
  int in;
  for (int i = 0; i < len; i++) {
    if (s[i] == ' ') {
      in = i;
      break;
    }
  }
  cout << "A" << s[in + 1] << "C";
  cout << endl;

  return 0;
}

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

using namespace std;

int main() {
  char s[301];
  scanf("%[^\n]", s);
  int len = strlen(s);
  int in;
  for (int i = 0; i < len; i++) {
    if (s[i] == ' ') {
      in = i;
      break;
    }
  }
  cout << "A" << s[in + 1] << "C";
  cout << endl;

  return 0;
}
Problem p03860 (C++)

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

int main() {
  string str;
  cin >> str;
  cout << str.at(0) << str.at(7) << str.at(str.size() - 6) << endl;
}

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

int main() {
  string a;
  for (int i = 0; i < 3; i++) {
    cin >> a;
    cout << a.at(0);
  }
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, x, c;
  cin >> a >> x >> c;
  string s = "";
  s += ('A' + s.at(0) + 'C');
  cout << s << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, x, c;
  cin >> a >> x >> c;
  string s = "A";
  s += x.at(0);
  s += 'C';
  cout << s << endl;

  return 0;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, B, H;
  cin >> S >> B >> H;
  char k = S.at(1);
  char j = B.at(1);
  char l = H.at(1);
  cout << k << j << l << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, B, H;
  cin >> S >> B >> H;
  char k = S.at(0);
  char j = B.at(0);
  char l = H.at(0);
  cout << k << j << l << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  string s;
  cin >> s;
  cout << "A" << s.at(8) << "C";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  string A, B, s;
  cin >> A >> s >> B;
  cout << "A" << s.at(0) << "C";
  return 0;
}
Problem p03860 (C++)

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

int main() {
  string a, s;
  cout << 'A' << s.at(0) << 'C' << endl;
}


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

int main() {
  string a, s;
  cin >> a >> s;
  cout << 'A' << s.at(0) << 'C' << endl;
}
Problem p03860 (C++)

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

int main() {
  string S, A, ans;
  cin >> S;
  A = S.at(8);
  ans = "A" + A + "C";
  cout << ans << endl;
}


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

int main() {
  string P, Q, R, A, ans;
  cin >> P >> Q >> R;
  A = Q.at(0);
  ans = "A" + A + "C";
  cout << ans << endl;
}
Problem p03860 (C++)

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

int main() {
  string contest;
  cin >> contest;
  cout << "A" << contest.at(8) << "C" << endl;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
int main() {
  char s[1];
  std::cin >> s >> s;
  std::cout << "A" << s[0] << "C";
}

Fixed submission:
#include <iostream>
int main() {
  char s[100];
  std::cin >> s >> s;
  std::cout << "A" << s[0] << "C";
}
Problem p03860 (C++)

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

int main() {
  string i, j, k;
  cin >> i, j, k;
  cout << i.at(0) << j.at(0) << k.at(0) << endl;
}

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

int main() {
  string i, j, k;
  cin >> i >> j >> k;
  cout << i[0] << j[0] << k[0];
}
Problem p03860 (C++)

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

int main() {
  long long int a, b, x;
  cin >> a >> b >> x;
  long long int count = 0;

  if (a % x == 0)
    cout << b / x - a / x + 1;
  else
    cout << b / x - a / x;
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0];
}
Problem p03860 (C++)

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

int main() {
  string a, s;
  cin >> a >> s;
  cout << "A" << s.at(8) << "C" << endl;
}

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

int main() {
  string a, s;
  cin >> a >> s;
  cout << "A" << s.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string c;
  cin >> c;
  cout << 'A' + c.at(8) + 'C' << endl;
}


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

int main() {
  string a;
  for (int i = 0; i < 3; i++) {
    string c;
    cin >> c;
    a += c.at(0);
  }
  cout << a << endl;
}
Problem p03860 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  cout << "A" << S.at(8) << "C" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string A, S, C;
  cin >> A >> S >> C;
  cout << "A" << S.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string S;
  cin >> S;
  cout << 'A' + S.at(8) + 'C' << endl;
}


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

int main() {
  string A, S, C;
  cin >> A >> S >> C;
  cout << "A" << S.at(0) << "C" << endl;
}
Problem p03860 (C++)

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

int main() {
  string s;
  cin >> s;
  // AtCoder (8)
  cout << 'A' + s.at(8) + 'C' << endl;
}

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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  cout << s1.at(0) << s2.at(0) << s3.at(0) << endl;
}