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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define rrep(i, n) RREP(i, n - 1, 0)
#define all(v) v.begin(), v.end()
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  vector<ll> S(N), T(N), X(N);
  set<pair<ll, pair<int, ll>>> se;
  rep(i, N) {
    cin >> S[i] >> T[i] >> X[i];
    se.emplace(S[i] - X[i], make_pair(1, X[i]));
    se.emplace(T[i] - X[i], make_pair(-1, X[i]));
  }
  vector<pair<ll, int>> D(Q);
  rep(i, Q) {
    cin >> D[i].first;
    D[i].second = i;
  }
  sort(all(D));
  vector<ll> ans(Q, longinf);
  auto itr = se.begin();
  set<ll> se2;
  se2.insert(longinf);
  int cur = 0;
  while (true) {
    while (itr != se.end() && itr->first <= D[cur].first) {
      if (itr->second.first == 1) {
        se2.insert(itr->second.second);
      } else {
        se2.erase(itr->second.second);
      }
      itr++;
    }
    if (itr == se.end())
      break;
    ans[D[cur].second] = *se2.begin();
    cur++;
  }
  rep(i, Q) cout << (ans[i] == longinf ? -1 : ans[i]) << "\n";
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define rrep(i, n) RREP(i, n - 1, 0)
#define all(v) v.begin(), v.end()
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  vector<ll> S(N), T(N), X(N);
  set<pair<ll, pair<int, ll>>> se;
  rep(i, N) {
    cin >> S[i] >> T[i] >> X[i];
    se.emplace(S[i] - X[i], make_pair(1, X[i]));
    se.emplace(T[i] - X[i], make_pair(-1, X[i]));
  }
  vector<pair<ll, int>> D(Q);
  rep(i, Q) {
    cin >> D[i].first;
    D[i].second = i;
  }
  sort(all(D));
  vector<ll> ans(Q, longinf);
  auto itr = se.begin();
  set<ll> se2;
  se2.insert(longinf);
  int cur = 0;
  while (true) {
    if (cur == Q)
      break;
    while (itr != se.end() && itr->first <= D[cur].first) {
      if (itr->second.first == 1) {
        se2.insert(itr->second.second);
      } else {
        se2.erase(itr->second.second);
      }
      itr++;
    }
    if (itr == se.end())
      break;
    ans[D[cur].second] = *se2.begin();
    cur++;
  }
  rep(i, Q) cout << (ans[i] == longinf ? -1 : ans[i]) << "\n";
  return 0;
}
Problem p03033 (C++)

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

const int MAXN = 200;
const int INF = 1e9;

int main() {
  set<int> event_set;
  int d[MAXN];
  vector<pair<int, int>> stoppers;
  int N, Q;
  cin >> N >> Q;

  for (int i = 0; i < N; i++) {
    int S, T, X;
    cin >> S >> T >> X;
    stoppers.push_back(make_pair(S - X, X));
    stoppers.push_back(make_pair(T - X, -X));
  }

  for (int i = 0; i < Q; i++) {
    int D;
    cin >> D;
    d[i] = D;
  }

  sort(d, d + Q);
  sort(stoppers.begin(), stoppers.end());
  stoppers.push_back(make_pair(INF, INF));

  int ite = 0;

  for (int i = 0; i < Q; i++) {
    int T = d[i];
    while (T >= stoppers[ite].first) {
      if (stoppers[ite].second > 0)
        event_set.insert(stoppers[ite].second);
      else
        event_set.erase(-stoppers[ite].second);
      ite++;
    }
    if (event_set.size() == 0)
      cout << -1 << endl;
    else
      cout << *event_set.begin() << endl;
  }

  return 0;
}

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

const int MAXN = 200000;
const int INF = 1e9;

int main() {
  set<int> event_set;
  int d[MAXN];
  vector<pair<int, int>> stoppers;
  int N, Q;
  cin >> N >> Q;

  for (int i = 0; i < N; i++) {
    int S, T, X;
    cin >> S >> T >> X;
    stoppers.push_back(make_pair(S - X, X));
    stoppers.push_back(make_pair(T - X, -X));
  }

  for (int i = 0; i < Q; i++) {
    int D;
    cin >> D;
    d[i] = D;
  }

  sort(d, d + Q);
  sort(stoppers.begin(), stoppers.end());
  stoppers.push_back(make_pair(INF, INF));

  int ite = 0;

  for (int i = 0; i < Q; i++) {
    int T = d[i];
    while (T >= stoppers[ite].first) {
      if (stoppers[ite].second > 0)
        event_set.insert(stoppers[ite].second);
      else
        event_set.erase(-stoppers[ite].second);
      ite++;
    }
    if (event_set.size() == 0)
      cout << -1 << endl;
    else
      cout << *event_set.begin() << endl;
  }

  return 0;
}
Problem p03033 (C++)

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

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

struct info {
  ll left, right, time;
};

bool comp(const info &a, const info &b) { return a.time <= b.time; }

int main() {
  int n, q;
  cin >> n >> q;
  ll s, t, x;
  vector<info> vec(n);
  rep(i, n) {
    cin >> s >> t >> x;
    vec[i] = {x - t + 1, x - s, x};
  }
  sort(vec.begin(), vec.end(), comp);
  vector<ll> ans(q, -1);
  map<ll, int> mp;
  set<ll> Set;
  ll d;
  rep(i, q) {
    cin >> d;
    d = -d;
    mp[d] = i;
    Set.insert(d);
  }
  rep(i, n) {
    while (Set.size() > 0) {
      auto itr1 = Set.lower_bound(vec[i].left);
      if (itr1 != Set.end() && (*itr1) <= vec[i].right) {
        ans[mp[(*itr1)]] = vec[i].time;
        Set.erase((*itr1));
      } else
        break;
    }
  }
  rep(i, q) printf("%lld\n", ans[i]);
  return 0;
}


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

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

struct info {
  ll left, right, time;
};

bool comp(const info &a, const info &b) { return a.time < b.time; }

int main() {
  int n, q;
  cin >> n >> q;
  ll s, t, x;
  vector<info> vec(n);
  rep(i, n) {
    cin >> s >> t >> x;
    vec[i] = {x - t + 1, x - s, x};
  }
  sort(vec.begin(), vec.end(), comp);
  vector<ll> ans(q, -1);
  map<ll, int> mp;
  set<ll> Set;
  ll d;
  rep(i, q) {
    cin >> d;
    d = -d;
    mp[d] = i;
    Set.insert(d);
  }
  rep(i, n) {
    while (Set.size() > 0) {
      auto itr1 = Set.lower_bound(vec[i].left);
      if (itr1 != Set.end() && (*itr1) <= vec[i].right) {
        ans[mp[(*itr1)]] = vec[i].time;
        Set.erase((*itr1));
      } else
        break;
    }
  }
  rep(i, q) printf("%lld\n", ans[i]);
  return 0;
}
Problem p03033 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
const int InF = 0x3f3f3f3f, maxn = 2e5 + 2;
struct node {
  int t, x, d;
  inline bool operator<(const node &x) const { return t < x.t; }
} event[maxn];
int n, m;
int len;
multiset<int> msi;
int main() {
  cin >> n >> m;
  int i;
  for (i = 1; i <= n; i++) {
    int s, t, x;
    cin >> s >> t >> x;
    event[++len].t = s - x;
    event[len].x = x;
    event[len].d = 1;
    event[++len].t = t - x;
    event[len].x = x;
    event[len].d = 0;
  }
  sort(event + 1, event + len + 1);
  int k = 1, d, w;
  for (i = 1; i <= m; i++) {
    cin >> w;
    while (k <= len) {
      if (event[k].t <= w) {
        if (event[k].d)
          msi.insert(event[k].x);
        else
          msi.erase(msi.find(event[k].x));
        k++;
      } else
        break;
    }
    int ans = -1;
    if (msi.size() != 0)
      ans = *msi.begin();
    cout << ans << endl;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
const int InF = 0x3f3f3f3f, maxn = 2e6 + 2;
struct node {
  int t, x, d;
  inline bool operator<(const node &x) const { return t < x.t; }
} event[maxn];
int n, m;
int len;
multiset<int> msi;
int main() {
  cin >> n >> m;
  int i;
  for (i = 1; i <= n; i++) {
    int s, t, x;
    cin >> s >> t >> x;
    event[++len].t = s - x;
    event[len].x = x;
    event[len].d = 1;
    event[++len].t = t - x;
    event[len].x = x;
    event[len].d = 0;
  }
  sort(event + 1, event + len + 1);
  int k = 1, d, w;
  for (i = 1; i <= m; i++) {
    cin >> w;
    while (k <= len) {
      if (event[k].t <= w) {
        if (event[k].d)
          msi.insert(event[k].x);
        else
          msi.erase(msi.find(event[k].x));
        k++;
      } else
        break;
    }
    int ans = -1;
    if (msi.size() != 0)
      ans = *msi.begin();
    cout << ans << endl;
  }
  return 0;
}
Problem p03033 (C++)

Buggy submission (status: Time Limit Exceeded):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tiii;
const ll mod = 1e9 + 7;
const int inf = 1 << 30;

int ng[200010];

int main() {
  int n, q;
  cin >> n >> q;
  priority_queue<tiii, vector<tiii>, greater<tiii>> que;
  rep(i, n) {
    int s, t, x;
    cin >> s >> t >> x;
    que.push(tiii(x, s - x, t - x));
  }
  set<int> st;
  rep(i, q) {
    int a;
    cin >> a;
    st.insert(a);
  }
  vector<pii> ans(0);
  while (st.size() && que.size()) {
    int a, b, x;
    tie(x, a, b) = que.top();
    if (st.lower_bound(a) == st.end()) {
      que.pop();
    } else if (*st.lower_bound(a) < b) {
      ans.push_back(pii(*st.lower_bound(a), x));
      st.erase(*st.lower_bound(a));
    } else
      que.pop();
  }
  for (auto c : st) {
    ans.push_back(pii(c, -1));
  }
  sort(all(ans));
  rep(i, ans.size()) { cout << ans[i].second << endl; }
}

Fixed submission:
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tiii;
const ll mod = 1e9 + 7;
const int inf = 1 << 30;

int ng[200010];

int main() {
  int n, q;
  cin >> n >> q;
  priority_queue<tiii, vector<tiii>, greater<tiii>> que;
  rep(i, n) {
    int s, t, x;
    cin >> s >> t >> x;
    que.push(tiii(x, s - x, t - x));
  }
  set<int> st;
  rep(i, q) {
    int a;
    cin >> a;
    st.insert(a);
  }
  vector<pii> ans(0);
  while (st.size() && que.size()) {
    int a, b, x;
    tie(x, a, b) = que.top();
    if (st.lower_bound(a) == st.end()) {
      que.pop();
    } else if (*st.lower_bound(a) < b) {
      ans.push_back(pii(*st.lower_bound(a), x));
      st.erase(*st.lower_bound(a));
    } else
      que.pop();
  }
  for (auto c : st) {
    ans.push_back(pii(c, -1));
  }
  sort(all(ans));
  rep(i, ans.size()) { cout << ans[i].second << endl; }
}
Problem p03033 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod = 1e9 + 7;

int main() {

  int n, q;
  cin >> n >> q;

  vector<tuple<ll, ll, ll>> vt(n);
  set<P> sq;
  for (int i = 0; i < n; ++i) {
    ll s, t, x;
    cin >> s >> t >> x;
    vt[i] = make_tuple(x, s - x, t - x);
  }
  sort(vt.begin(), vt.end());

  for (int i = 0; i < q; ++i) {
    int d;
    cin >> d;
    sq.insert(make_pair(d, i));
  }

  int c = 0;
  vector<ll> ret(q, -1);
  for (int i = 0; i < n; ++i) {
    auto itrs =
        lower_bound(sq.begin(), sq.end(), make_pair(get<1>(vt[i]), -mod));
    auto itrt =
        lower_bound(sq.begin(), sq.end(), make_pair(get<2>(vt[i]), -mod));
    while (itrs != itrt) {
      ret[itrs->second] = get<0>(vt[i]);
      sq.erase(itrs++);
    }
  }

  for (int i = 0; i < q; ++i) {
    cout << ret[i] << endl;
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod = 1e9 + 7;

int main() {

  int n, q;
  cin >> n >> q;

  vector<tuple<ll, ll, ll>> vt(n);
  set<P> sq;
  for (int i = 0; i < n; ++i) {
    ll s, t, x;
    cin >> s >> t >> x;
    vt[i] = make_tuple(x, s - x, t - x);
  }
  sort(vt.begin(), vt.end());

  for (int i = 0; i < q; ++i) {
    int d;
    cin >> d;
    sq.insert(make_pair(d, i));
  }

  int c = 0;
  vector<ll> ret(q, -1);
  for (int i = 0; i < n; ++i) {
    auto itrs = sq.lower_bound(make_pair(get<1>(vt[i]), -mod));
    auto itrt = sq.lower_bound(make_pair(get<2>(vt[i]), -mod));
    while (itrs != itrt) {
      ret[itrs->second] = get<0>(vt[i]);
      sq.erase(itrs++);
    }
  }

  for (int i = 0; i < q; ++i) {
    cout << ret[i] << endl;
  }

  return 0;
}
Problem p03034 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()

const ll mod = 1e9 + 7;
const ll INF = 1e9;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll f(int x, vector<ll> s) {
  ll ret = 0;
  int n = s.size();
  ll ma = 0;

  for (int k = 1; k <= (n - 1) / x; k++) {
    if ((n - 1) % x == 0 && n - 1 - (k - 1) * x <= (k - 1) * x)
      break;
    ret += s[n - 1 - (k - 1) * x] + s[(k - 1) * x];
    ma = max(ret, ma);
  }
  return ma;
}

int main() {
  int n;
  cin >> n;
  vector<ll> s(n);
  rep(i, n) cin >> s[i];
  ll ans = 0;
  for (int x = 1; x < n; x++) {
    ans = max(ans, f(x, s));
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()

const ll mod = 1e9 + 7;
const ll INF = 1e9;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll f(int x, vector<ll> s) {
  ll ret = 0;
  int n = s.size();
  ll ma = 0;

  for (int k = 1; k <= (n - 1) / x; k++) {
    if ((n - 1) % x == 0 && n - 1 - (k - 1) * x <= (k - 1) * x)
      break;
    ret += s[n - 1 - (k - 1) * x] + s[(k - 1) * x];
    ma = max(ret, ma);
  }
  return ma;
}

int main() {
  int n;
  cin >> n;
  vector<ll> s(n);
  rep(i, n) cin >> s[i];
  ll ans = 0;
  for (int x = 1; x < n; x++) {

    ll ret = 0;
    // ll ma = 0;

    for (int k = 1; k <= (n - 1) / x; k++) {
      if ((n - 1) % x == 0 && n - 1 - (k - 1) * x <= (k - 1) * x)
        break;
      ret += s[n - 1 - (k - 1) * x] + s[(k - 1) * x];
      ans = max(ret, ans);
    }
    // ans = max(ans,f(x,s));
  }
  cout << ans << endl;
  return 0;
}
Problem p03034 (C++)

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

int main() {
  using namespace std;
  unsigned long N;
  cin >> N;
  vector<long> s(N);
  for (auto &i : s)
    cin >> i;
  long ans{0};
  for (unsigned long i = 1; i < N; ++i) {
    long tmp{0};
    for (unsigned long j = 0, k = N - 1; k > 0 && (k % i != 0 || j < k);
         j += i, k -= i)
      ans = max(ans, tmp += s[j] + s[k]);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  using namespace std;
  unsigned long N;
  cin >> N;
  vector<long> s(N);
  for (auto &i : s)
    cin >> i;
  long ans{0};
  for (unsigned long i = 1; i < N; ++i) {
    long tmp{0};
    for (unsigned long j = 0, k = N - 1; k > i && (k % i != 0 || j < k);
         j += i, k -= i)
      ans = max(ans, tmp += s[j] + s[k]);
  }
  cout << ans << endl;
  return 0;
}
Problem p03034 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
#define int long long
#define ll long long
#define eps DBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX / 10
#define P pair<int, int>
#define prique priority_queue
using namespace std;
int n, s[100010];
map<P, int> dp;
signed main() {
  cin >> n;
  rep(i, n) cin >> s[i];
  rep(i, n) {       // 2i+1回でゴール
    REP(j, n - 1) { // a-b=j
      if (n - 1 <= i * j + j)
        continue;
      if ((n - 1 - i * j) % j == 0 && (n - 1 - i * j) / j * 2 <= 2 * i)
        continue;
      // 2i回目の後いるのはi*j番
      if (i)
        dp[make_pair(i, j)] =
            dp[make_pair(i - 1, j)] + s[n - 1 - i * j] + s[i * j];
      else
        dp[make_pair(i, j)] = s[n - 1 - i * j] + s[i * j];
    }
  }
  int ans = 0;
  for (pair<P, int> p : dp) {
    ans = max(ans, p.second);
  }
  cout << ans << endl;
}

Fixed submission:
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
#define int long long
#define ll long long
#define eps DBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX / 10
#define P pair<int, int>
#define prique priority_queue
using namespace std;
int n, s[100010];
map<P, int> dp;
signed main() {
  cin >> n;
  rep(i, n) cin >> s[i];
  rep(i, n) {       // 2i+1回でゴール
    REP(j, n - 1) { // a-b=j
      if (n - 1 <= i * j + j)
        break;
      if ((n - 1 - i * j) % j == 0 && (n - 1 - i * j) / j * 2 <= 2 * i)
        continue;
      // 2i回目の後いるのはi*j番
      if (i)
        dp[make_pair(i, j)] =
            dp[make_pair(i - 1, j)] + s[n - 1 - i * j] + s[i * j];
      else
        dp[make_pair(i, j)] = s[n - 1 - i * j] + s[i * j];
    }
  }
  int ans = 0;
  for (pair<P, int> p : dp) {
    ans = max(ans, p.second);
  }
  cout << ans << endl;
}
Problem p03034 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using i64 = int64_t;
i64 n;
vector<i64> s;
int main() {
  cin >> n;
  s.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  i64 ans = 0;
  for (int c = 1; c < n; ++c) {
    vector<bool> vis(n);
    i64 scr = 0;
    for (int i = 0; i < n; i += c) {
      int j = n - i - 1;
      i64 a = j, b = a - c;
      if (b <= 0)
        break;
      if (vis[i])
        break;
      vis[i] = true;
      if (vis[j])
        break;
      vis[j] = true;
      scr += s[i] + s[j];
      if (scr == 35) {
        cerr << c << endl;
        for (int i = 0; i < n; ++i) {
          cerr << (vis[i] ? '*' : '.');
        }
        cerr << endl;
      }
      ans = max(ans, scr);
    }
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using i64 = int64_t;
i64 n;
vector<i64> s;
int main() {
  cin >> n;
  s.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  i64 ans = 0;
  for (int c = 1; c < n; ++c) {
    vector<bool> vis(n);
    i64 scr = 0;
    for (int i = 0; i < n; i += c) {
      int j = n - i - 1;
      i64 a = j, b = a - c;
      if (b <= 0)
        break;
      if (vis[i])
        break;
      vis[i] = true;
      if (vis[j])
        break;
      vis[j] = true;
      scr += s[i] + s[j];

      ans = max(ans, scr);
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p03034 (C++)

Buggy submission (status: Time Limit Exceeded):
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, j, k) for (int(i) = (j); (i) < (int)(k); ++(i))
#define rep(i, j) FOR(i, 0, j)
#define each(x, y) for (auto &(x) : (y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << (x) << endl
#define smax(x, y) (x) = max((x), (y))
#define smin(x, y) (x) = min((x), (y))
#define MEM(x, y) memset((x), (y), sizeof(x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void solve() {
  int N;
  cin >> N;
  vll s(N);
  rep(i, N) cin >> s[i];

  ll ans = LLONG_MIN;
  unordered_set<int> T;
  for (int i = 1; i <= N - 1; ++i) { // A-B
    T.clear();
    ll sum = 0;
    for (int j = 0; i * j < N - 1; ++j) { // j turns
      int A = N - 1 - i * j;
      int B = A - i;
      if (B <= 0)
        break;
      if (T.count(i * j))
        break;
      T.insert(i * j);
      sum += s[i * j];
      if (T.count(N - 1 - i * j))
        break;
      T.insert(N - 1 - i * j);
      sum += s[N - 1 - i * j];
      smax(ans, sum);
    }
  }
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  solve();
  return 0;
}

Fixed submission:
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, j, k) for (int(i) = (j); (i) < (int)(k); ++(i))
#define rep(i, j) FOR(i, 0, j)
#define each(x, y) for (auto &(x) : (y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << (x) << endl
#define smax(x, y) (x) = max((x), (y))
#define smin(x, y) (x) = min((x), (y))
#define MEM(x, y) memset((x), (y), sizeof(x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void solve() {
  int N;
  cin >> N;
  vll s(N);
  rep(i, N) cin >> s[i];

  ll ans = LLONG_MIN;
  set<int> T;
  for (int i = 1; i <= N - 1; ++i) { // A-B
    T.clear();
    ll sum = 0;
    for (int j = 0; i * j < N - 1; ++j) { // j turns
      int A = N - 1 - i * j;
      int B = A - i;
      if (B <= 0)
        break;
      if (T.count(i * j))
        break;
      T.insert(i * j);
      sum += s[i * j];
      if (T.count(N - 1 - i * j))
        break;
      T.insert(N - 1 - i * j);
      sum += s[N - 1 - i * j];
      smax(ans, sum);
    }
  }
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  solve();
  return 0;
}
Problem p03035 (C++)

Buggy submission (status: Time Limit Exceeded):
// written by NewbieChd
#include <cctype>
#include <cstdio>
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  register int f = 0;
  char c;
  while (!isdigit(c = getChar())) {
  }
  do
    f = f * 10 + (c ^ 48);
  while (isdigit(c = getChar()));
  return f;
}

const int maxN = 100003;

int main() {
#ifndef ONLINE_JUDGE
  freopen("a.in", "r", stdin);
  // freopen("a.out", "w", stdout);
#endif
  int a = read(), b = read();
  if (a <= 5)
    printf("0\n");
  else {
    if (a < 13)
      b >>= 1;
    printf("%d\n", b);
  }
  return 0;
}


Fixed submission:
// written by NewbieChd
#include <cctype>
#include <cstdio>
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  register int f = 0;
  char c;
  while (!isdigit(c = getChar())) {
  }
  do
    f = f * 10 + (c ^ 48);
  while (isdigit(c = getChar()));
  return f;
}

const int maxN = 100003;

int main() {
  int a = read(), b = read();
  if (a <= 5)
    printf("0\n");
  else {
    if (a < 13)
      b >>= 1;
    printf("%d\n", b);
  }
  return 0;
}
Problem p03035 (C++)

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

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i, n) for (int i = 0; i < n; i++)
#define rev(i, n) for (int i = n; i >= 0; i--)
#define rep_a(i, a, n) for (int i = a; i < n; i++)
#define tr(ds, it) for (auto it = ds.begin(); it != ds.end(); it++)
#define rtr(ds, it) for (auto it = ds.rbegin(); it != ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue<int> pq;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;

const ll mod = 1000000007;
ll po(ll x, ll n) {
  ll ans = 1;
  while (n > 0) {
    if (n & 1)
      ans = (ans * x) % mod;
    x = (x * x) % mod;
    n /= 2;
  }
  return ans;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int T = 1;
  // cin >> T;
  while (T--) {
    ll a, b;
    cin >> a >> b;
    if (a >= 13)
      cout << b << el;
    else if (a > 5)
      cout << b / 2 << el;
    else
      cout << 0 << el;
  }

  return 0;
}

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

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i, n) for (int i = 0; i < n; i++)
#define rev(i, n) for (int i = n; i >= 0; i--)
#define rep_a(i, a, n) for (int i = a; i < n; i++)
#define tr(ds, it) for (auto it = ds.begin(); it != ds.end(); it++)
#define rtr(ds, it) for (auto it = ds.rbegin(); it != ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue<int> pq;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;

const ll mod = 1000000007;
ll po(ll x, ll n) {
  ll ans = 1;
  while (n > 0) {
    if (n & 1)
      ans = (ans * x) % mod;
    x = (x * x) % mod;
    n /= 2;
  }
  return ans;
}

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

  int T = 1;
  // cin >> T;
  while (T--) {
    ll a, b;
    cin >> a >> b;
    if (a >= 13)
      cout << b << el;
    else if (a > 5)
      cout << b / 2 << el;
    else
      cout << 0 << el;
  }

  return 0;
}
Problem p03035 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX = 100005;
const long long mod = 1.0e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  ll a, b;
  cin >> a >> b;
  if (a >= 13)
    cout << b << endl;
  else if (a < 13 && a > 5)
    cout << b / 2 << endl;
  else
    cout << "0" << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX = 100005;
const long long mod = 1.0e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll a, b;
  cin >> a >> b;
  if (a >= 13)
    cout << b << endl;
  else if (a < 13 && a > 5)
    cout << b / 2 << endl;
  else
    cout << "0" << endl;
  return 0;
}
Problem p03035 (Python)

Buggy submission (status: Runtime Error):
def main():
    a, b = map(int, input())
    if a >= 13:
        print(b)
    elif 6 <= a <= 12:
        print(b // 2)
    else:
        print(0)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    a, b = map(int, input().split())
    if a >= 13:
        print(b)
    elif 6 <= a <= 12:
        print(b // 2)
    else:
        print(0)


if __name__ == "__main__":
    main()
Problem p03035 (Python)

Buggy submission (status: Runtime Error):
A, B = map(int, input())

if A >= 13:
    print(B)
elif A >= 6:
    print(B // 2)
else:
    print(0)


Fixed submission:
A, B = map(int, input().split())

if A >= 13:
    print(B)
elif A >= 6:
    print(B // 2)
else:
    print(0)
Problem p03035 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio()                                                               \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define loop(i, a, b) for (ll i = a; i < b; i++)
#define loope(i, a, b) for (ll i = a; i <= b; i++)
#define test()                                                                 \
  ull t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define puu pair<ull, ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vull vector<ull>
#define nl cout << endl
#define sp cout << " "
#define MOD 1000000007
#define all(x) x.begin(), x.end()
vector<int> cache(100005);
int fact(int k) {
  if (k < 2)
    return 1;
  if (cache[k] != 0)
    return cache[k];
  return cache[k] = k * fact(k - 1) % MOD;
}
int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  fastio();
  int a, b;
  cin >> a >> b;
  if (a >= 13)
    cout << b;
  else if (a < 13 && a >= 6)
    cout << b / 2;
  else
    cout << 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio()                                                               \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define loop(i, a, b) for (ll i = a; i < b; i++)
#define loope(i, a, b) for (ll i = a; i <= b; i++)
#define test()                                                                 \
  ull t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define puu pair<ull, ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vull vector<ull>
#define nl cout << endl
#define sp cout << " "
#define MOD 1000000007
#define all(x) x.begin(), x.end()
vector<int> cache(100005);
int fact(int k) {
  if (k < 2)
    return 1;
  if (cache[k] != 0)
    return cache[k];
  return cache[k] = k * fact(k - 1) % MOD;
}
int main() {
  // #ifndef ONLINE_JUDGE
  //       freopen("input.txt", "r", stdin);
  //       freopen("output.txt", "w", stdout);
  //   #endif
  //   fastio();
  int a, b;
  cin >> a >> b;
  if (a >= 13)
    cout << b;
  else if (a < 13 && a >= 6)
    cout << b / 2;
  else
    cout << 0;
}
Problem p03035 (C++)

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

int main(int argc, char **argv) {
  int age = atoi(argv[1]);
  int price = atoi(argv[2]);

  if (age >= 13) {
    printf("%d\n", price);
    return 0;
  }
  if (age >= 6) {
    printf("%d\n", price / 2);
    return 0;
  }
  printf("%d\n", 0);
  return 0;
}


Fixed submission:
#include <cstdio>
#include <cstdlib>

int main() {
  int age, price;
  scanf("%d %d", &age, &price);

  if (age >= 13) {
    printf("%d\n", price);
    return 0;
  }
  if (age >= 6) {
    printf("%d\n", price / 2);
    return 0;
  }
  printf("%d\n", 0);
  return 0;
}
Problem p03035 (C++)

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

int main() {
  int A, B;
  cin >> A;
  cin >> B;
  if (A >= 13) {
    cout << B << endl;
    ;
  } else if (A >= 6) {
    cout << (int)(B / 2) << endl;
    ;
  } else {
    cout << 0 << endl;
    ;
  }
  return 1;
}

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

int main() {
  int A, B;
  cin >> A;
  cin >> B;
  if (A >= 13) {
    cout << B << endl;
    ;
  } else if (A >= 6) {
    cout << (int)(B / 2) << endl;
    ;
  } else {
    cout << 0 << endl;
    ;
  }
  return 0;
}
Problem p03036 (C++)

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

int main() {
  int r, D, x;
  cin >> r >> D >> x;
  int i = 0; // カウンタ変数
  while (i < 10) {
    x = r * x - D;
    cout << x << endl;
  }
}

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

int main() {
  int r, D, x;
  cin >> r >> D >> x;
  int i = 0; // カウンタ変数
  while (i < 10) {
    x = r * x - D;
    cout << x << endl;
    i++;
  }
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, D, x;
  cin >> r >> D >> x;
  vector<int> X(11);
  X.at(0) = x;
  for (int i = 0; i < 11; i++) {
    X.at(i + 1) = r * X.at(i) - D;
  }
  for (int i = 1; i < 11; i++) {
    cout << X.at(i) << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, D, x;
  cin >> r >> D >> x;
  vector<int> X(11);
  X.at(0) = x;
  for (int i = 0; i < 10; i++) {
    X.at(i + 1) = r * X.at(i) - D;
  }
  for (int i = 1; i < 11; i++) {
    cout << X.at(i) << endl;
  }
}
Problem p03036 (C++)

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

int main() {
  int r, D, x[11];
  cin >> r >> D >> x[0];

  for (int i = 1; i < 11; i) {
    x[i] = r * x[i - 1] - D;
    cout << x[i] << endl;
  }
  return 0;
}


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

int main() {
  int r, D, x[11];
  cin >> r >> D >> x[0];

  for (int i = 1; i < 11; i++) {
    x[i] = r * x[i - 1] - D;
    cout << x[i] << endl;
  }
  return 0;
}
Problem p03036 (C++)

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

int main() {
  int r, d;
  vector<int> x(10);
  cin >> r >> d >> x[0];
  for (int i; i < 10; i++) {
    x[i + 1] = r * x[i] - d;
    cout << x[i + 1] << endl;
  }
}

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

int main() {
  int r, d;
  vector<int> x(11);
  cin >> r >> d >> x[0];
  for (int i; i < 10; i++) {
    x[i + 1] = r * x[i] - d;
    cout << x[i + 1] << endl;
  }
}
Problem p03036 (C++)

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

int main() {

  int r;
  int D;
  int x;
  int count = 0;

  cin >> r >> D >> x;

  while (count < 10) {
    x = x * r - D;
    cout << x << endl;
  }
}


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

int main() {

  int r;
  int D;
  int x;
  int count = 0;

  cin >> r >> D >> x;

  while (count < 10) {
    x = x * r - D;
    cout << x << endl;
    ++count;
  }
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec(11);
  int r, D;
  cin >> r >> D >> vec.at(0);

  for (int i = 0; i < vec.size(); i++) {

    vec.at(i + 1) = vec.at(i) * r - D;

    cout << vec.at(i + 1) << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec(11);
  int r, D;
  cin >> r >> D >> vec.at(0);

  for (int i = 0; i < vec.size() - 1; i++) {

    vec.at(i + 1) = vec.at(i) * r - D;

    cout << vec.at(i + 1) << endl;
  }
}
Problem p03036 (C++)

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

int main() {
  int r, D, x0;
  cin >> r >> D >> x0;

  vector<int> x(10, 0);
  x[0] = x0;

  for (int i = 0; i < 10 + 1; ++i) {
    x[i + 1] = r * x[i] - D;
  }

  for (int i = 1; i < 10 + 1; ++i) {
    cout << x[i] << endl;
  }
}


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

int main() {
  int r, D, x0;
  cin >> r >> D >> x0;

  vector<int> x(11, 0);
  x[0] = x0;

  for (int i = 0; i < 10 + 1; ++i) {
    x[i + 1] = r * x[i] - D;
  }

  for (int i = 1; i < 10 + 1; ++i) {
    cout << x[i] << endl;
  }
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, d;
  vector<int> x(10);
  cin >> r >> d >> x[0];
  for (int i = 1; i < 11; i++) {
    x[i] = r * x[i - 1] - d;
    cout << x[i] << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long r, d;
  vector<long long> x(10);
  cin >> r >> d >> x[0];
  for (int i = 1; i < 11; i++) {
    x[i] = r * x[i - 1] - d;
    cout << x[i] << endl;
  }
}
Problem p03036 (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++)

typedef long long ll;

int main() {
  int r, d;
  vector<int> xi(10);
  cin >> r >> d >> xi[0];

  for (int i = 1; i < 11; i++) {
    xi[i] = r * xi[i - 1] - d;
    cout << xi[i] << endl;
  }

  return 0;
}


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

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

typedef long long ll;

int main() {
  int r, d;
  vector<ll> xi(10);
  cin >> r >> d >> xi[0];

  for (int i = 1; i < 11; i++) {
    xi[i] = r * xi[i - 1] - d;
    cout << xi[i] << endl;
  }

  return 0;
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int r, d, X;
  int arr[10];
  cin >> r >> d >> X;
  arr[0] = X;
  for (int i = 0; i < 10; i++) {
    arr[i + 1] = (r * arr[i]) - d;
  }

  for (int i = 0; i < 10; i++) {
    cout << arr[i + 1] << endl;
  }
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int r, d, X;
  int arr[11];
  cin >> r >> d >> X;
  arr[0] = X;
  for (int i = 0; i < 10; i++) {
    arr[i + 1] = (r * arr[i]) - d;
  }

  for (int i = 0; i < 10; i++) {
    cout << arr[i + 1] << endl;
  }
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include "iostream"

using namespace std;

int main() {
  int r, d, x;
  cin >> r >> d >> x;
  int xx[11] = {0};
  xx[0] = x;
  for (int i = 0; i < 11; i++) {
    xx[i + 1] = r * xx[i] - d;
    cout << xx[i] << endl;
  }
}

Fixed submission:
#include "iostream"

using namespace std;

int main() {
  int r, d, x;
  cin >> r >> d >> x;
  int xx[11] = {0};
  xx[0] = x;
  for (int i = 1; i < 11; i++) {
    xx[i] = r * xx[i - 1] - d;
    cout << xx[i] << endl;
  }
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int r, d, x[11];
  cin >> r >> d >> x[0];
  for (int i = 0; i < 11; i++) {
    x[i + 1] = r * x[i] - d;
    cout << x[i + 1] << endl;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int r, d, x[11];
  cin >> r >> d >> x[0];
  for (int i = 0; i < 10; i++) {
    x[i + 1] = r * x[i] - d;
    cout << x[i + 1] << endl;
  }
  return 0;
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long int
#define N 100010
using namespace std;
int main() {
  int r, d, x;
  cin >> r >> d >> x;
  vector<int> n(10, 0);
  n[0] = x;
  for (int i = 1; i <= 10; i++) {
    n[i] = r * n[i - 1] - d;
    cout << n[i] << endl;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define ll long long int
#define N 100010
using namespace std;
int main() {
  int r, d, x;
  cin >> r >> d >> x;
  vector<ll> n(10);
  n[0] = x;
  for (int i = 1; i <= 10; i++) {
    n[i] = r * n[i - 1] - d;
    cout << n[i] << endl;
  }
  return 0;
}
Problem p03036 (C++)

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

void solve(ll r, ll D, ll x) {
  vector<ll> X(11, 0);
  X[0] = x;
  for (int i = 0; i < X.size(); ++i) {
    X[i + 1] = r * X[i] - D;
  }
  for (int i = 1; i < X.size(); ++i)
    cout << X[i] << endl;
}

int main() {
  ll r, D, x;
  cin >> r >> D >> x;
  solve(r, D, x);
  return 0;
}


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

void solve(ll r, ll D, ll x) {
  vector<ll> X(11, 0);
  X[0] = x;
  for (int i = 0; i < X.size() - 1; ++i) {
    X[i + 1] = r * X[i] - D;
  }
  for (int i = 1; i < X.size(); ++i)
    cout << X[i] << endl;
}

int main() {
  ll r, D, x;
  cin >> r >> D >> x;
  solve(r, D, x);
  return 0;
}
Problem p03036 (C++)

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

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  int ans[b + 1];
  ans[0] = c;
  for (int i = 0; i < 10; i++) {
    ans[i + 1] = a * ans[i] - b;
    cout << ans[i + 1] << endl;
  }
  return 0;
}

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

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  int ans[11];
  ans[0] = c;
  for (int i = 0; i < 10; i++) {
    ans[i + 1] = a * ans[i] - b;
    cout << ans[i + 1] << endl;
  }
  return 0;
}
Problem p03036 (C++)

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

#define ll long long
#define vi vector<int>
#define vc vector<char>
#define vt vector<string>
#define si set<int>
#define sc set<char>
#define st set<string>
#define pii pair<int, int>
#define fi first
#define se second

using namespace std;
int main() {
  int r, d, x;
  cin >> r >> d >> x;
  int a[10];
  a[0] = x;
  for (int i = 0; i < 10; i++)
    a[i + 1] = a[i] * r - d;
  for (int i = 1; i <= 10; i++)
    cout << a[i] << endl;
  return 0;
}


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

#define ll long long
#define vi vector<int>
#define vc vector<char>
#define vt vector<string>
#define si set<int>
#define sc set<char>
#define st set<string>
#define pii pair<int, int>
#define fi first
#define se second

using namespace std;
int main() {
  int r, d, x;
  cin >> r >> d >> x;
  int a[11];
  a[0] = x;
  for (int i = 0; i < 10; i++)
    a[i + 1] = a[i] * r - d;
  for (int i = 1; i <= 10; i++)
    cout << a[i] << endl;
  return 0;
}
Problem p03036 (C++)

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

int main() {
  long long int r, d, x[10];
  std::cin >> r >> d >> x[0];
  for (int i = 1; i <= 10; ++i) {
    x[i] = x[i - 1] * r - d;
    std::cout << x[i] << std::endl;
  }
}

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

int main() {
  long long r, d, x[11];
  std::cin >> r >> d >> x[0];
  for (int i = 1; i <= 10; ++i) {
    x[i] = x[i - 1] * r - d;
    std::cout << x[i] << std::endl;
  }
}
Problem p03036 (C++)

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

int main() {
  int r, d, x;
  cin >> r >> d >> x;
  vector<int> xx(10, x);
  for (int i = 0; i < 10; i++) {
    xx[i + 1] = r * xx[i] - d;
    cout << xx[i + 1] << endl;
  }
}

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

int main() {
  int r, d, x;
  cin >> r >> d >> x;
  vector<int> xx(11, x);
  for (int i = 0; i < 10; i++) {
    xx[i + 1] = r * xx[i] - d;
    cout << xx[i + 1] << endl;
  }
}
Problem p03036 (C++)

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

int main() {
  int r, D, x2000;
  cin >> r >> D >> x2000;
  vector<int> vec(10);
  vec[0] = x2000;
  for (int i = 0; i < 10; i++) {
    vec[i + 1] = vec[i] * r - D;
    cout << vec[i + 1] << endl;
    ;
  }
}


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

int main() {
  int r, D, x2000;
  cin >> r >> D >> x2000;
  vector<int> vec(12);
  vec[0] = x2000;
  for (int i = 0; i < 10; i++) {
    vec[i + 1] = vec[i] * r - D;
    cout << vec[i + 1] << endl;
    ;
  }
}
Problem p03036 (C++)

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30

int main() {
  int r, d, x;
  cin >> r >> d >> x;

  V<ll> ans(11);
  ans[0] = x;
  for (int i = 0; i <= 10; i++) {
    ans[i + 1] = ans[i] * r - d;
  }
  for (int i = 1; i <= 10; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30

int main() {
  int r, d, x;
  cin >> r >> d >> x;

  V<ll> ans(11);
  ans[0] = x;
  for (int i = 0; i < 10; i++) {
    ans[i + 1] = ans[i] * r - d;
  }
  for (int i = 1; i <= 10; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, D;
  cin >> r >> D;
  vector<int> X;
  cin >> X.at(0);
  for (int i = 0; i < 10; i++) {
    X.at(i + 1) = r * X.at(i) - D;
    cout << X.at(i + 1) << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, D;
  cin >> r >> D;
  vector<int> X(11);
  cin >> X.at(0);
  for (int i = 0; i < 10; i++) {
    X.at(i + 1) = r * X.at(i) - D;
    cout << X.at(i + 1) << endl;
  }
  return 0;
}
Problem p03036 (C++)

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

int main() {
  int r, D, x0;
  cin >> r >> D >> x0;

  vector<int> x(11);
  x.at(0) = x0;

  for (int i = 0; i <= 10; i++) {
    x.at(i + 1) = r * x.at(i) - D;
    cout << x.at(i + 1) << endl;
  }
}

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

int main() {
  int r, D, x0;
  cin >> r >> D >> x0;

  vector<int> x(11);
  x.at(0) = x0;

  for (int i = 0; i < 10; i++) {
    x.at(i + 1) = r * x.at(i) - D;
    cout << x.at(i + 1) << endl;
  }
}
Problem p03036 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
#define lli long long int
#include <algorithm>
#include <vector>
int main() {
  lli r, d, x, i;
  cin >> r >> d >> x;
  vector<int> v(10);
  v[0] = x;
  // cout<<x<<"\n";
  for (i = 1; i <= 10; i++) {
    v[i] = (r * v[i - 1]) - d;
    cout << v[i] << "\n";
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
#define lli long long int
#include <algorithm>
#include <vector>
int main() {
  lli r, d, x, i;
  cin >> r >> d >> x;
  vector<int> v(11);
  v[0] = x;
  // cout<<x<<"\n";
  for (i = 1; i <= 10; i++) {
    v[i] = (r * v[i - 1]) - d;
    cout << v[i] << "\n";
  }
  return 0;
}