alexjercan/bugnet huggingface dataset:
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>
using namespace std;

int main() {
  int d, type = 26;
  vector<int> c;
  vector<vector<int>> s;
  vector<int> t;
  vector<int> v;
  vector<int> last;

  cin >> d;

  for (int i = 0; i < type; i++) {
    int tmp;
    cin >> tmp;
    c.push_back(tmp);
  }

  for (int i = 0; i < d; i++) {
    vector<int> vtmp;
    for (int j = 0; j < type; j++) {
      int tmp;
      cin >> tmp;
      vtmp.push_back(tmp);
    }
    s.push_back(vtmp);
  }

  for (int i = 0; i < d; i++) {
    int tmp;
    cin >> tmp;
    t.push_back(tmp);
  }

  // cout << d << endl;
  // for (int i = 0; i < type; i++) {
  //   cout << c[i] << " ";
  // }
  // cout << endl;

  // for (int j = 0; j < d; j++) {
  //   for (int i = 0; i < type; i++) {
  //     cout << s[j][i] << " ";
  //   }
  //   cout << endl;
  // }

  // for (int i = 0; i < d; i++) {
  //   cout << t[i] << " ";
  // }
  // cout << endl;

  for (int i = 0; i < type; i++) {
    last.push_back(-1);
  }

  for (int day = 0; day < d; day++) {
    last[t[day] - 1] = day;
    int desat = 0;
    for (int j = 0; j < type; j++) {
      desat += c[j] * (day - last[j]);
    }
    // cout << "desat " << desat << endl;
    if (day == 0) {
      v.push_back(s[day][t[day] - 1] - desat);
    } else {
      v.push_back(v[day - 1] + s[day][t[day] - 1] - desat);
    }
    cout << v[day] << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;

int main() {
  int d, type = 26;
  vector<int> c;
  vector<vector<int>> s;
  vector<int> t;
  vector<int> v;
  vector<int> last;

  cin >> d;

  c.push_back(0);
  for (int i = 0; i < type; i++) {
    int tmp;
    cin >> tmp;
    c.push_back(tmp);
  }

  vector<int> vtmp;
  for (int j = 0; j < type; j++) {
    vtmp.push_back(0);
  }
  s.push_back(vtmp);

  for (int i = 0; i < d; i++) {
    vector<int> vtmp;
    vtmp.push_back(0);
    for (int j = 0; j < type; j++) {
      int tmp;
      cin >> tmp;
      vtmp.push_back(tmp);
    }
    s.push_back(vtmp);
  }

  t.push_back(0);
  for (int i = 0; i < type; i++) {
    int tmp;
    cin >> tmp;
    t.push_back(tmp);
  }

  // cout << d << endl;
  // for (int i = 1; i <= type; i++) {
  //   cout << c[i] << " ";
  // }
  // cout << endl;

  // for (int j = 1; j <= d; j++) {
  //   for (int i = 1; i <= type; i++) {
  //     cout << s[j][i] << " ";
  //   }
  //   cout << endl;
  // }

  // for (int i = 1; i <= d; i++) {
  //   cout << t[i] << " ";
  // }
  // cout << endl;

  for (int i = 0; i <= type; i++) {
    last.push_back(0);
  }

  v.push_back(0);
  for (int day = 1; day <= d; day++) {
    last[t[day]] = day;
    int desat = 0;
    for (int j = 1; j <= type; j++) {
      desat += c[j] * (day - last[j]);
    }
    v.push_back(v[day - 1] + s[day][t[day]] - desat);
    cout << v[day] << endl;
  }
  return 0;
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
// #define _GLIBCXX_DEBUG

signed main() {
  int D;
  cin >> D;
  vector<int> c(26);
  rep(i, 26) cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  rep(i, D) rep(j, 26) cin >> s[i][j];
  vector<int> t(D);
  rep(i, D) {
    cin >> t[i];
    t[i]--;
  }

  int score = 0;
  vector<int> lt(26, -1);
  rep(i, D) {
    score += s[i][t[i]];
    lt[t[i]] = i;
    rep(j, 26) score -= c[j] * (i - lt[j]);
    cout << score << endl;
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
// #define _GLIBCXX_DEBUG

signed main() {
  int D;
  cin >> D;
  vector<int> c(26);
  rep(i, 26) cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  rep(i, D) rep(j, 26) cin >> s[i][j];
  vector<int> t(26);
  rep(i, D) {
    cin >> t[i];
    t[i]--;
  }

  int score = 0;
  vector<int> lt(26, -1);
  rep(i, D) {
    score += s[i][t[i]];
    lt[t[i]] = i;
    rep(j, 26) score -= c[j] * (i - lt[j]);
    cout << score << endl;
  }
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18 + 99);
static const int INF = 1e9 + 99;

ll c[30], s[370][30];
ll score[30], last_day[30];
int t[370];

ll calc(int day, int contest) {
  score[contest] += s[day][contest];
  last_day[contest] = day;

  rep(i, 1, 27) score[i] -= c[i] * (day - last_day[i]);

  ll sum = 0;
  rep(i, 1, 27) sum += score[i];
  return sum;
}

int main(void) {
  int d;
  cin >> d;
  rep(i, 1, 27) cin >> c[i];
  rep(i, 1, d + 1) rep(j, 1, 27) cin >> s[i][j];

  rep(i, 0, d) cin >> t[i];

  rep(i, 0, d) { printf("%lld\\n", calc(i + 1, t[i])); }

  return 0;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18 + 99);
static const int INF = 1e9 + 99;

ll c[30], s[370][30];
ll score[30], last_day[30];
int t[5];

ll calc(int day, int contest) {
  score[contest] += s[day][contest];
  last_day[contest] = day;

  rep(i, 1, 27) score[i] -= c[i] * (day - last_day[i]);

  ll sum = 0;
  rep(i, 1, 27) sum += score[i];
  return sum;
}

int main(void) {
  int d;
  cin >> d;
  rep(i, 1, 27) cin >> c[i];
  rep(i, 1, d + 1) rep(j, 1, 27) cin >> s[i][j];

  rep(i, 0, d) cin >> t[i];

  rep(i, 0, d) { printf("%lld\\n", calc(i + 1, t[i])); }

  return 0;
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

// #include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <vector>

/*
#include <boost/multiprecision/cpp_dec_float.hpp>
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i, s, e) for ((i) = (s); (i) < (e); (i)++)
#define RREP(i, s, e) for ((i) = ((s)-1); (i) >= (e); (i)--)
#define FOR(i, n) for ((i) = (0); (i) < (n); (i)++)
#define RFOR(i, n) for ((i) = ((n)-1); (i) >= (0); (i)--)
#define MOD 1000000007

int D;
int c[32];
int s[512][32];
int ans[512];

void inp() {
  cin >> D;
  for (int i = 1; i <= 26; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= D; i++) {
    for (int j = 1; j <= 26; j++) {
      cin >> s[i][j];
    }
  }
}

void ans_inp() {
  for (int i = 1; i <= D; i++) {
    cin >> ans[i];
  }
}

void man_disp() {
  int l[32] = {0};
  int man = 0;
  for (int i = 1; i <= D; i++) {
    int n = ans[i];
    l[n] = i;
    man += s[i][n];
    for (int j = 1; j <= 26; j++) {
      man -= c[j] * (i - l[j]);
    }
    cout << man << endl;
  }
}

signed main() {
  inp();
  ans_inp();
  man_disp();
  return 0;
}


Error: 0

Fixed submission:

// #include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <vector>

/*
#include <boost/multiprecision/cpp_dec_float.hpp>
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i, s, e) for ((i) = (s); (i) < (e); (i)++)
#define RREP(i, s, e) for ((i) = ((s)-1); (i) >= (e); (i)--)
#define FOR(i, n) for ((i) = (0); (i) < (n); (i)++)
#define RFOR(i, n) for ((i) = ((n)-1); (i) >= (0); (i)--)
#define MOD 1000000007

int D;
int c[32];
int s[512][32];
int ans[512];

void inp() {
  cin >> D;
  for (int i = 1; i <= 26; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= D; i++) {
    for (int j = 1; j <= 26; j++) {
      cin >> s[i][j];
    }
  }
}

void ans_inp() {
  for (int i = 1; i <= D; i++) {
    cin >> ans[i];
  }
}

int man_disp() {
  int l[32] = {0};
  int man = 0;
  for (int i = 1; i <= D; i++) {
    int n = ans[i];
    l[n] = i;
    man += s[i][n];
    for (int j = 1; j <= 26; j++) {
      man -= c[j] * (i - l[j]);
    }
    cout << man << endl;
  }
}

signed main() {
  inp();
  ans_inp();
  man_disp();
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
struct fastio {
  fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
  }
} _io;
template <class T, class U> bool chmax(T &a, const U &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U> bool chmin(T &a, const U &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

constexpr size_t D = 365;
constexpr size_t type = 26;
constexpr int INF = (1 << 30);

array<int, type> c, last;
array<array<int, type>, D> s;
array<int, D> contest;

void input() {
  int buff;
  cin >> buff;
  for (int i = 0; i < type; i++) {
    cin >> c[i];
    last[i] = 0;
  }
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < type; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = 0; i < D; i++) {
    cin >> contest[i];
    contest[i]--;
  }
}

int score(int day, int idx) {
  int ans = s[day][idx];
  for (int i = 0; i < type; i++) {
    ans -= c[i] * (day + 1 - last[i]);
  }
  return ans;
}

int main() {
  input();
  int ans = 0;
  for (int i = 0; i < D; i++) {
    const int &id = contest[i];
    last[id] = i + 1;
    ans += score(i, id);
    cout << ans << '\\n';
  }

  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
struct fastio {
  fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
  }
} _io;
template <class T, class U> bool chmax(T &a, const U &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U> bool chmin(T &a, const U &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

constexpr size_t D = 5;
constexpr size_t type = 26;
constexpr int INF = (1 << 30);

array<int, type> c, last;
array<array<int, type>, D> s;
array<int, D> contest;

void input() {
  int buff;
  cin >> buff;
  for (int i = 0; i < type; i++) {
    cin >> c[i];
    last[i] = 0;
  }
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < type; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = 0; i < D; i++) {
    cin >> contest[i];
    contest[i]--;
  }
}

int score(int day, int idx) {
  int ans = s[day][idx];
  for (int i = 0; i < type; i++) {
    ans -= c[i] * (day + 1 - last[i]);
  }
  return ans;
}

int main() {
  input();
  int ans = 0;
  for (int i = 0; i < D; i++) {
    const int &id = contest[i];
    last[id] = i + 1;
    ans += score(i, id);
    cout << ans << '\\n';
  }

  return 0;
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define N (1000000000 + 7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<ll, ll> P;

ll A(ll x) {
  if (x >= 0)
    return x;
  else
    return -x;
}

ll gcd(ll a, ll b) {
  if (b > a) {
    ll tmp = b;
    b = a;
    a = tmp;
  }
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}

ll c[27];
ll s[400][27];
ll last[27];
ll score[27];

int main(void) {
  int D;
  cin >> D;
  for (int i = 1; i <= 26; i++)
    cin >> c[i];
  for (int i = 1; i <= D; i++) {
    for (int j = 1; j <= 26; j++) {
      cin >> s[i][j];
    }
  }
  for (ll d = 1; d <= D; d++) {
    ll t;
    cin >> t;
    last[t] = d;
    score[t] += s[d][t];
    ll ans = 0;
    for (ll j = 1; j <= 26; j++) {
      score[j] -= c[j] * (d - last[j]);
      ans += score[j];
    }
    cout << ans << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define N (1000000000 + 7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<ll, ll> P;

ll A(ll x) {
  if (x >= 0)
    return x;
  else
    return -x;
}

ll gcd(ll a, ll b) {
  if (b > a) {
    ll tmp = b;
    b = a;
    a = tmp;
  }
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}

ll c[27];
ll s[27][27];
ll last[27];
ll score[27];

int main(void) {
  int D;
  cin >> D;
  for (int i = 1; i <= 26; i++)
    cin >> c[i];
  for (int i = 1; i <= D; i++) {
    for (int j = 1; j <= 26; j++) {
      cin >> s[i][j];
    }
  }
  for (ll d = 1; d <= D; d++) {
    ll t;
    cin >> t;
    last[t] = d;
    score[t] += s[d][t];
    ll ans = 0;
    for (ll j = 1; j <= 26; j++) {
      score[j] -= c[j] * (d - last[j]);
      ans += score[j];
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(), (v).end())
typedef int64_t lint;
// lint mod = 998244353;
// lint mod = 1000000007;
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

void app() {
  int d;
  cin >> d;

  int n = 26;
  vector<int> c(n);
  rep(j, n) { cin >> c[j]; }
  vector<vector<int>> s(d, vector<int>(n));
  rep(i, d) rep(j, n) cin >> s[i][j];

  vector<int> t(d);
  rep(i, d) {
    cin >> t[i];
    t[i]--;
  }

  lint score = 0;
  vector<int> lastd(n, -1);
  rep(i, d) {
    int j = t[i];
    lastd[j] = i;
    score += s[i][j];
    rep(j, n) score -= c[j] * (i - lastd[j]);
    cout << score << endl;
  }
}

int main() {
  app();
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(), (v).end())
typedef int64_t lint;
// lint mod = 998244353;
// lint mod = 1000000007;
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

void app() {
  int d;
  cin >> d;

  int n = 26;
  vector<int> c(n);
  rep(j, n) { cin >> c[j]; }
  vector<vector<int>> s(d, vector<int>(n));
  rep(i, d) rep(j, n) cin >> s[i][j];

  vector<int> t(n);
  rep(i, d) {
    cin >> t[i];
    t[i]--;
  }

  lint score = 0;
  vector<int> lastd(n, -1);
  rep(i, d) {
    int j = t[i];
    lastd[j] = i;
    score += s[i][j];
    rep(j, n) score -= c[j] * (i - lastd[j]);
    cout << score << endl;
  }
}

int main() {
  app();
  return 0;
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9 + 7)
#define INF (1LL << 62) // 1LL<<63でオーバーフロー

int main(int argc, char *argv[]) {
  int d;
  cin >> d; // d=365

  const int contest = 26;
  vector<int> c(contest);
  for (auto &x : c)
    cin >> x;

  vector<vector<int>> s(d, vector<int>(contest, 0));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < contest; j++)
      cin >> s.at(i).at(j);
  }

  vector<int> t(d);
  for (auto &x : t)
    cin >> x;

  vector<int> last(contest + 1, 0), satisfaction(d + 1);
  satisfaction.at(0) = 0;
  for (int i = 1; i < d + 1; i++) {
    int dissatis = 0;
    int act = t.at(i - 1);
    last.at(act) = i;
    for (int j = 0; j < contest; j++) {
      dissatis += c.at(j) * (i - last.at(j + 1));
    }
    satisfaction.at(i) =
        satisfaction.at(i - 1) + s.at(i - 1).at(act - 1) - dissatis;

    cout << satisfaction.at(i) << endl;
  }

  return 0;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9 + 7)
#define INF (1LL << 62) // 1LL<<63でオーバーフロー

int main(int argc, char *argv[]) {
  int d;
  cin >> d; // d=365

  const int contest = 26;
  vector<int> c(contest);
  for (auto &x : c)
    cin >> x;

  vector<vector<int>> s(d, vector<int>(contest, 0));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < contest; j++)
      cin >> s.at(i).at(j);
  }

  vector<int> t(contest);
  for (auto &x : t)
    cin >> x;

  vector<int> last(contest + 1, 0), satisfaction(d + 1);
  satisfaction.at(0) = 0;
  for (int i = 1; i < d + 1; i++) {
    int dissatis = 0;
    int act = t.at(i - 1);
    last.at(act) = i;
    for (int j = 0; j < contest; j++) {
      dissatis += c.at(j) * (i - last.at(j + 1));
    }
    satisfaction.at(i) =
        satisfaction.at(i - 1) + s.at(i - 1).at(act - 1) - dissatis;

    cout << satisfaction.at(i) << endl;
  }

  return 0;
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main() {
  cout << fixed << setprecision(10);
  ll D;
  cin >> D;
  vector<ll> c(26);
  rep(i, 26) cin >> c[i];
  vector<vector<ll>> s(D, vector<ll>(26));
  rep(i, D) {
    rep(j, 26) { cin >> s[i][j]; }
  }
  vector<int> t(D);
  vector<int> lastday(26);
  rep(i, 26) lastday[i] = -1;
  rep(i, D) {
    cin >> t[i];
    t[i]--;
  }
  ll satisfy = 0;
  rep(i, D) {
    ll dissatisfy = 0;
    satisfy += s[i][t[i]];
    lastday[t[i]] = i;
    rep(j, 26) { dissatisfy += c[j] * (i - lastday[j]); }
    satisfy -= dissatisfy;
    cout << satisfy << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main() {
  cout << fixed << setprecision(10);
  ll D;
  cin >> D;
  vector<ll> c(26);
  rep(i, 26) cin >> c[i];
  vector<vector<ll>> s(D, vector<ll>(26));
  rep(i, D) {
    rep(j, 26) { cin >> s[i][j]; }
  }
  vector<int> t(26);
  vector<int> lastday(26);
  rep(i, 26) lastday[i] = -1;
  rep(i, 26) {
    cin >> t[i];
    t[i]--;
  }
  ll satisfy = 0;
  rep(i, D) {
    ll dissatisfy = 0;
    satisfy += s[i][t[i]];
    lastday[t[i]] = i;
    rep(j, 26) { dissatisfy += c[j] * (i - lastday[j]); }
    satisfy -= dissatisfy;
    cout << satisfy << endl;
  }
  return 0;
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
typedef long long ll;

int N = 26;
int D;
ll c[26];
ll s[366][36];
int t[366];

void input() {
  cin >> D;
  for (int i = 0; i < N; i++)
    cin >> c[i];
  for (int i = 1; i <= D; i++) {
    for (int j = 0; j < N; j++)
      cin >> s[i][j];
  }
  for (int i = 1; i <= D; i++) {
    cin >> t[i];
    t[i]--;
  }
}

ll calc_score() {
  vector<int> last(N);
  ll S = 0;
  for (int d = 1; d <= D; d++) {
    last[t[d]] = d;
    for (int i = 0; i < N; i++) {
      S -= c[i] * (d - last[i]);
    }
    S += s[d][t[d]];
    cout << S << endl;
  }
  return max(1000000 + S, (ll)0);
}

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

Error: 0

Fixed submission:

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
typedef long long ll;

int N = 26;
int D;
ll c[26];
ll s[366][36];
int t[366];

void input() {
  cin >> D;
  for (int i = 0; i < N; i++)
    cin >> c[i];
  for (int i = 1; i <= D; i++) {
    for (int j = 0; j < N; j++)
      cin >> s[i][j];
  }
  for (int i = 1; i <= D; i++)
    cin >> t[i];
}

void output() {
  for (int i = 1; i <= D; i++)
    cout << t[i] + 1 << endl;
}

int calc_score() {
  vector<int> last(N);
  ll S = 0;
  for (int d = 1; d <= D; d++) {
    last[t[d] - 1] = d;
    for (int i = 0; i < N; i++) {
      S -= c[i] * (d - last[i]);
    }
    S += s[d][t[d] - 1];
    cout << S << endl;
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(10) << fixed;
  input();
  calc_score();
}
Problem p02619 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int D;
  cin >> D;
  vector<int> c(26);
  for (int i = 0; i < 26; i++)
    cin >> c.at(i);
  vector<vector<int>> s(D, vector<int>(26));
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s.at(i).at(j);
    }
  }

  int ns = 0;
  vector<int> last(26, 0);
  for (int i = 0; i < D; i++) {
    int t;
    cin >> t;
    ns += s.at(i).at(t - 1);
    last.at(t - 1) = i + 1;

    for (int j = 0; j < 26; j++) {
      ns -= c.at(j) * (i + 1 - last.at(j));
    }
    cout << ns << endl;
  }
}

Error: WA

Fixed submission:

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

int main() {
  int D;
  cin >> D;
  vector<int> c(26);
  for (int i = 0; i < 26; i++)
    cin >> c.at(i);
  vector<vector<int>> s(D, vector<int>(26));
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s.at(i).at(j);
    }
  }

  int ns = 0;
  vector<int> last(26, 0);
  for (int i = 0; i < D; i++) {
    int t;
    cin >> t;
    ns += s.at(i).at(t - 1) - c.at(i);
    //        last.at(t-1) = i + 1;
    //        for (int j = 0; j < 26; j++) {
    //            ns -= c.at(i) * (i + 1 - last.at(j));
    //        }
    cout << ns << endl;
  }
}