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

Buggy submission (status: Runtime Error):
// ~/Remember,remember the 6th of March
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <ctype.h>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const ll MOD = 100000000;
const int N = 2e6 + 10;
void fast() { std::ios_base::sync_with_stdio(0); }
int main() {
  /*#ifndef ONLINE_JUDGE
          freopen("input.txt", "r", stdin);
          //freopen("output.txt","w",stdout);
  #endif*/
  ll n;
  cin >> n;
  vector<ll> arr(n);
  for (ll &i : arr)
    cin >> i;
  ll v = *min_element(arr.begin(), arr.end());
  cout << (n + v - 1) / v + 4;
  return 0;
}

Fixed submission:
// ~/Remember,remember the 6th of March
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <ctype.h>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const ll MOD = 100000000;
const int N = 2e6 + 10;
void fast() { std::ios_base::sync_with_stdio(0); }
int main() {
  /*#ifndef ONLINE_JUDGE
          freopen("input.txt", "r", stdin);
          //freopen("output.txt","w",stdout);
  #endif*/
  ll n;
  cin >> n;
  vector<ll> arr(5);
  for (ll &i : arr)
    cin >> i;
  ll v = *min_element(arr.begin(), arr.end());
  cout << (n + v - 1) / v + 4;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  int x = 0;
  if (n % min(a, min(b, min(c, min(d, e)))) != 0) {
    x = 1;
  }
  cout << n / min(a, min(b, min(c, min(d, e)))) + 5 - 1 + x << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  int x = 0;
  if (n % min(a, min(b, min(c, min(d, e)))) != 0) {
    x = 1;
  }
  cout << n / min(a, min(b, min(c, min(d, e)))) + 5 - 1 + x << endl;
  return 0;
}
Problem p03077 (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() {
  long n, ans = 4;
  cin >> n;
  vector<int> temp(5);
  rep(i, 5) cin >> temp.at(i);
  sort(temp.begin(), temp.end());
  ans += (n + temp.at(0) - 1) / temp.at(0);
  cout << ans << endl;
}

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

int main() {
  long n, ans = 4;
  cin >> n;
  vector<long> temp(5);
  rep(i, 5) cin >> temp.at(i);
  sort(temp.begin(), temp.end());
  ans += (n + temp.at(0) - 1) / temp.at(0);
  cout << ans << endl;
}
Problem p03077 (C++)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = 1e9 + 7;

int main() {
  ll N;
  cin >> N;
  ll m;
  for (int i = 0; i < 5; i++) {
    ll tmp;
    cin >> tmp;
    chmin(m, tmp);
  }

  ll ans = 4LL + (N / m) + (N % m != 0);
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = 1e9 + 7;

int main() {
  ll N;
  cin >> N;
  ll m = 1e18;
  for (int i = 0; i < 5; i++) {
    ll tmp;
    cin >> tmp;
    chmin(m, tmp);
  }

  ll ans = 4LL + (N / m) + (N % m != 0);
  cout << ans << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define repi(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
int main() {
  int n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  ll x = min({a, b, c, d, e});
  cout << (ll)(n + x - 1) / x + 4 << endl;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define repi(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  ll x = min({a, b, c, d, e});
  cout << (ll)(n + x - 1) / x + 4 << endl;
}
Problem p03077 (C++)

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

using namespace std;

typedef long long ll;

int main() {
  int n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;

  ll mi = min({a, b, c, d, e});

  if (n % mi == 0)
    cout << n / mi + 4;
  else
    cout << n / mi + 5;
}


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

using namespace std;

typedef long long ll;

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;

  ll mi = min({a, b, c, d, e});

  if (n % mi == 0)
    cout << n / mi + 4;
  else
    cout << n / mi + 5;
}
Problem p03077 (C++)

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

int main(void) {

  int N, A, B, C, D, E;
  cin >> N;
  int tmp, mini = 100000;
  for (int i = 0; i < 5; ++i) {
    cin >> tmp;
    mini = min(tmp, mini);
  }
  cout << ceil(N / mini) + 5 << endl;

  return 0;
}

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

int main(void) {

  long N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  long mini = min({A, B, C, D, E});
  cout << ((N - 1) / mini) + 5 << endl;

  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define MOD 1000000007;

int main() {
  long long n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  long long n1 = n, n2 = 0, n3 = 0, n4 = 0, n5 = 0, n6 = 0, t = 0;
  while (n6 < n) {
    n6 += min(n5, e);
    if (n5 <= e)
      n5 = 0;
    else
      n5 -= e;
    n5 += min(n4, d);
    if (n4 <= d)
      n4 = 0;
    else
      n4 -= d;
    n4 += min(n3, c);
    if (n3 <= c)
      n3 = 0;
    else
      n3 -= c;
    n3 += min(n2, b);
    if (n2 <= b)
      n2 = 0;
    else
      n2 -= b;
    n2 += min(n1, a);
    if (n1 <= a)
      n1 = 0;
    else
      n1 -= a;
    t++;
  }
  cout << t << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define MOD 1000000007;

int main() {
  long long n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  long long neck = min(min(min(min(a, b), c), d), e);
  cout << (n + neck - 1) / neck + 4 << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
int main() {
  ll n, sum = 0;
  cin >> n;
  int a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  ll mn = *min_element(a, a + 5);
  ll val = n / mn;
  ll mod = n % mn;
  if (mod > 0)
    val++;
  cout << 4 + val << '\n';
}


Fixed submission:
#include <bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
int main() {
  ll n, sum = 0;
  cin >> n;
  ll a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  ll mn = *min_element(a, a + 5);
  ll val = n / mn;
  ll mod = n % mn;
  if (mod > 0)
    val++;
  cout << 4 + val << '\n';
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n;
  cin >> n;
  auto v = vector<int>(istream_iterator<int>(cin), istream_iterator<int>());

  auto _min = *std::min_element(v.begin(), v.end());
  unsigned long long minits = ceil((double)n / (double)_min) + 4;
  cout << minits;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n;
  cin >> n;
  auto v = vector<unsigned long long>(istream_iterator<unsigned long long>(cin),
                                      istream_iterator<unsigned long long>());

  auto _min = *std::min_element(v.begin(), v.end());
  unsigned long long minits = ceil((double)n / (double)_min) + 4;
  cout << minits;
}
Problem p03077 (C++)

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

int main() {
  long long a, N;
  cin >> N;
  // すべてを配列vecに入れる
  vector<int> vec(5);
  for (int i = 0; i < 5; i++) {
    cin >> vec.at(i);
  }
  // vecの中で一番小さい要素を選ぶ
  for (int i = 0; i < 5; i++) {
    if (i == 0)
      a = vec.at(0);
    else if (a > vec.at(i))
      a = vec.at(i);
    else {
    }
  }

  cout << 5 + N / a << endl;
}

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

int main() {
  long long N, A, B, C, D, E, p;
  cin >> N >> A >> B >> C >> D >> E;
  p = min({A, B, C, D, E});
  cout << 5 + (N - 1) / p << endl;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
template <class T, class C> void chmax(T &a, C b) { a > b ?: a = b; }
template <class T, class C> void chmin(T &a, C b) { a < b ?: a = b; }
int main(int argc, char *argv[]) {
  long long n;
  int padding = 0;
  vint a(5);
  cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  if (n % *min_element(ALL(a)) != 0)
    padding = 1;
  cout << n / *min_element(ALL(a)) + 4 + padding << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
template <class T, class C> void chmax(T &a, C b) { a > b ?: a = b; }
template <class T, class C> void chmin(T &a, C b) { a < b ?: a = b; }
int main(int argc, char *argv[]) {
  long long n;
  int padding = 0;
  vector<long> a(5);
  cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  if (n % *min_element(ALL(a)) != 0)
    padding = 1;
  cout << n / *min_element(ALL(a)) + 4 + padding << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,tune=native")

#include <bits/stdc++.h>
#include <x86intrin.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  long long cnt[6] = {N, 0, 0, 0, 0, 0}, time = 0;
  while (cnt[5] < N) {
    if (cnt[4] <= E) {
      cnt[5] += cnt[4];
      cnt[4] = 0;
    } else {
      cnt[5] += E;
      cnt[4] -= E;
    }
    if (cnt[3] <= D) {
      cnt[4] += cnt[3];
      cnt[3] = 0;
    } else {
      cnt[4] += D;
      cnt[3] -= D;
    }
    if (cnt[2] <= C) {
      cnt[3] += cnt[2];
      cnt[2] = 0;
    } else {
      cnt[3] += C;
      cnt[2] -= C;
    }
    if (cnt[1] <= B) {
      cnt[2] += cnt[1];
      cnt[1] = 0;
    } else {
      cnt[2] += B;
      cnt[1] -= B;
    }
    if (cnt[0] <= A) {
      cnt[1] += cnt[0];
      cnt[0] = 0;
    } else {
      cnt[1] += A;
      cnt[0] -= A;
    }
    time++;
  }
  cout << time;
  return 0;
}

Fixed submission:
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,tune=native")

#include <bits/stdc++.h>
#include <x86intrin.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long N, A[5];
  cin >> N >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
  sort(A, A + 5);
  cout << (long long)ceil((double)N / (double)A[0]) + 4;
  return 0;
}
Problem p03077 (C++)

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

using namespace std;

#define ll long long
int main() {
  while (1) {
    ll n;
    cin >> n;
    ll a[6];
    for (int i = 0; i < 5; i++) {
      cin >> a[i];
    }
    sort(a, a + 5);
    if (a[0] >= n)
      cout << "5" << endl;
    else {
      ll ans;
      if (n % a[0])
        ans = n / a[0] + 5;
      else
        ans = n / a[0] + 4;
      cout << ans << endl;
    }
  }
  return 0;
}


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

using namespace std;

#define ll long long
int main() {
  ll n;
  cin >> n;
  ll a[6];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  sort(a, a + 5);
  if (a[0] >= n)
    cout << "5" << endl;
  else {
    ll ans;
    if (n % a[0])
      ans = n / a[0] + 5;
    else
      ans = n / a[0] + 4;
    cout << ans << endl;
  }
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef long l;
typedef pair<int, int> P;
const ll INF = 100000000000000001;
const double PI = 3.141592653589;

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

  vector<int> a(6, 0);
  a[0] = n;
  ll time = 0;
  while (a[5] != n) {
    for (int i = 4; 0 <= i; i--) {
      if (a[i] == 0)
        continue;
      if (a[i] < t[i]) {
        a[i + 1] += a[i];
        a[i] = 0;
      } else {
        a[i + 1] += t[i];
        a[i] -= t[i];
      }
    }
    // rep(i,6){
    //   cout<<a[i]<<(i==5?"\n":" ");
    // }
    time++;
  }
  cout << time << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef long l;
typedef pair<int, int> P;
const ll INF = 100000000000000001;
const double PI = 3.141592653589;

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  ll mm = min({a, b, c, d, e});
  if (n % mm == 0)
    cout << n / mm + 4 << endl;
  else
    cout << n / mm + 5 << endl;

  return 0;
}
Problem p03077 (C++)

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

int main() {
  ll n, i, c, bn;
  cin >> n;
  for (i = 0; i < 5; ++i) {
    cin >> c;
    bn = min(bn, c);
  }
  if (n % bn == 0)
    cout << n / bn + 4 << endl;
  else
    cout << n / bn + 5 << endl;
  return 0;
}

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

int main() {
  ll n, i, c, bn = 1e15 + 1;
  cin >> n;
  for (i = 0; i < 5; ++i) {
    cin >> c;
    bn = min(bn, c);
  }
  if (n % bn == 0)
    cout << n / bn + 4 << endl;
  else
    cout << n / bn + 5 << endl;
  return 0;
}
Problem p03077 (C++)

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

int main() {
  int N, A, B, C, D, E, X;
  cin >> N >> A >> B >> C >> D >> E;
  X = min(A, min(B, min(C, min(D, E))));
  if (N % X != 0) {
    cout << N / X + 5 << endl;
  } else {
    cout << N / X + 4 << endl;
  }
}

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

int main() {
  long long N, A, B, C, D, E, X;
  cin >> N >> A >> B >> C >> D >> E;
  X = min(A, min(B, min(C, min(D, E))));
  if (N % X != 0) {
    cout << N / X + 5 << endl;
  } else {
    cout << N / X + 4 << endl;
  }
}
Problem p03077 (C++)

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

void solveA() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;

  if (e - a > k) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
}
void solveB() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

  int min = 9;
  int minad = 0;

  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 < min && a[i] % 10 != 0) {
      min = a[i] % 10;
      minad = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == minad || a[i] % 10 == 0) {
      ans += a[i];
    } else {
      ans = ans + 10 - a[i] % 10 + a[i];
    }
  }

  cout << ans << endl;
}
void solveC() {
  long long n;
  vector<long long> a{5};
  cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

  sort(a.begin(), a.end());

  cout << (n + a[0] - 1) / a[0] + 4 << endl;
}

void solveD() {}

int main() { solveC(); }


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

void solveA() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;

  if (e - a > k) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
}
void solveB() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

  int min = 9;
  int minad = 0;

  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 < min && a[i] % 10 != 0) {
      min = a[i] % 10;
      minad = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == minad || a[i] % 10 == 0) {
      ans += a[i];
    } else {
      ans = ans + 10 - a[i] % 10 + a[i];
    }
  }

  cout << ans << endl;
}
void solveC() {
  long long n;
  vector<long long> a(5);
  cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

  sort(a.begin(), a.end());

  cout << (n + a[0] - 1) / a[0] + 4 << endl;
}

void solveD() {}

int main() { solveC(); }
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long
using namespace std;
int main() {
  ll N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  vector<ll> vec = {N, 0, 0, 0, 0, 0};
  vector<ll> key = {A, B, C, D, E};
  ll t = 0;
  while (vec[5] != N) {
    for (ll i = 4; i > -1; i--) {
      vec[i + 1] += min(vec[i], key[i]);
      vec[i] -= min(vec[i], key[i]);
    }
    // rep(i,6) cout <<vec[i]<<endl;
    t++;
  }
  cout << t << endl;
}


Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long
using namespace std;
int main() {
  ll N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  vector<ll> vec = {N, 0, 0, 0, 0, 0};
  vector<ll> key = {A, B, C, D, E};
  B = min(A, B);
  C = min(B, C);
  D = min(C, D);
  E = min(D, E);
  ll k;
  if (N % E == 0)
    k = N / E;
  else
    k = N / E + 1;
  cout << 4 + k << endl;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = {1, 0, -1, 0}, dx[4] = {0, 1, 0, -1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, trans[5];
  cin >> n;
  rep(i, 5) { cin >> trans[i]; }
  ll num[6] = {n, 0, 0, 0, 0, 0};
  ll cnt = 0;
  while (num[5] != n) {
    for (int i = 4; i >= 0; i--) {
      if (num[i] > 0) {
        ll tmp = num[i];
        num[i] -= tmp > trans[i] ? trans[i] : tmp;
        num[i + 1] += tmp > trans[i] ? trans[i] : tmp;
        if (num[i] < 0) {
          num[i] = 0;
        }
      }
    }
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = {1, 0, -1, 0}, dx[4] = {0, 1, 0, -1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  cout << (n - 1) / min({a, b, c, d, e}) + 5 << endl;
  return 0;
}
Problem p03077 (C++)

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

int main() {
  long n;
  cin >> n;
  vector<int> h(5);
  for (int i = 0; i < 5; i++) {
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  if (h.at(0) >= n) {
    cout << 5 << endl;
  } else {
    cout << (n + h.at(0) - 1) / h.at(0) + 4 << endl;
  }
}

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

int main() {
  long n;
  cin >> n;
  vector<long> h(5);
  for (long i = 0; i < 5; i++) {
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  if (h.at(0) >= n) {
    cout << 5 << endl;
  } else {
    cout << (n + h.at(0) - 1) / h.at(0) + 4 << endl;
  }
}
Problem p03077 (C++)

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

int main() {
  int n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  cout << max({(n - 1) / a, (n - 1) / b, (n - 1) / c, (n - 1) / d,
               (n - 1) / e}) +
              5
       << endl;
  return 0;
}


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

int main() {
  long long n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  cout << max({(n - 1) / a, (n - 1) / b, (n - 1) / c, (n - 1) / d,
               (n - 1) / e}) +
              5
       << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long int> c_v(6, 0);
  long long int N, A, B, C, D, E, cnt = 0;
  cin >> N >> A >> B >> C >> D >> E;
  c_v[0] = N;

  while (c_v[5] < N) {
    cnt++;
    if (c_v[4] > 0) {
      if (c_v[4] >= E) {
        c_v[5] += E;
        c_v[4] -= E;
      } else {
        c_v[5] += c_v[4];
        c_v[4] -= c_v[4];
      }
    }

    if (c_v[3] > 0) {
      if (c_v[3] >= D) {
        c_v[4] += D;
        c_v[3] -= D;
      } else {
        c_v[4] += c_v[3];
        c_v[3] -= c_v[3];
      }
    }

    if (c_v[2] > 0) {
      if (c_v[2] >= C) {
        c_v[3] += C;
        c_v[2] -= C;
      } else {
        c_v[3] += c_v[2];
        c_v[2] -= c_v[2];
      }
    }

    if (c_v[1] > 0) {
      if (c_v[1] >= B) {
        c_v[2] += B;
        c_v[1] -= B;
      } else {
        c_v[2] += c_v[1];
        c_v[1] -= c_v[1];
      }
    }
    if (c_v[0] > 0) {
      if (c_v[0] >= A) {
        c_v[1] += A;
        c_v[0] -= A;
      } else {
        c_v[1] += c_v[0];
        c_v[0] -= c_v[0];
      }
    }

    // puts("");
  }
  cout << cnt << endl;
  // char S[1000000] = {0};
  // vector<int> s_v, s_01v, s_10v;
  // cin >> S;
  // //cout << strlen(S) << endl;
  // for (int i = 0; i < strlen(S); i++) {
  //   s_v.push_back(S[i] - '0');
  //   switch(i%2) {
  //   case 0:
  //     s_01v.push_back(0);
  //     s_10v.push_back(1);
  //     break;
  //   case 1:
  //     s_01v.push_back(1);
  //     s_10v.push_back(0);
  //     break;
  //   }
  // }
  // long long int cnt_01 = 0, cnt_10 = 0;

  // for (int i = 0; i < strlen(S); i++) {
  //   if (s_01v[i] != s_v[i]) cnt_01++;
  //   if (s_10v[i] != s_v[i]) cnt_10++;
  // }
  // if (cnt_01 > cnt_10) {
  //   cout << cnt_10 << endl;
  // }
  // else {
  //   cout << cnt_01 << endl;
  // }
  // for (int i = 0; i < strlen(S); i++) {
  //   printf("%d ", s_v[i]);
  // }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long int> c_v(6, 0);
  long long int N, A, B, C, D, E, cnt = 0;
  cin >> N >> A >> B >> C >> D >> E;
  long long int a = N % min({A, B, C, D, E});
  if (a == 0) {
    cnt = (N / min({A, B, C, D, E})) + 4;
  } else {
    cnt = (N / min({A, B, C, D, E})) + 5;
  }
  cout << cnt << endl;
  // char S[1000000] = {0};
  // vector<int> s_v, s_01v, s_10v;
  // cin >> S;
  // //cout << strlen(S) << endl;
  // for (int i = 0; i < strlen(S); i++) {
  //   s_v.push_back(S[i] - '0');
  //   switch(i%2) {
  //   case 0:
  //     s_01v.push_back(0);
  //     s_10v.push_back(1);
  //     break;
  //   case 1:
  //     s_01v.push_back(1);
  //     s_10v.push_back(0);
  //     break;
  //   }
  // }
  // long long int cnt_01 = 0, cnt_10 = 0;

  // for (int i = 0; i < strlen(S); i++) {
  //   if (s_01v[i] != s_v[i]) cnt_01++;
  //   if (s_10v[i] != s_v[i]) cnt_10++;
  // }
  // if (cnt_01 > cnt_10) {
  //   cout << cnt_10 << endl;
  // }
  // else {
  //   cout << cnt_01 << endl;
  // }
  // for (int i = 0; i < strlen(S); i++) {
  //   printf("%d ", s_v[i]);
  // }
  return 0;
}
Problem p03077 (C++)

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

// macro
#define rep(i, n) for (i = 0; i < n; i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main() {
  ll n;
  cin >> n;
  vector<int> mov(5);
  int i;
  rep(i, 5) cin >> mov[i];
  sort(all(mov));
  ll ans;
  ans = (n + mov[0] - 1) / mov[0] + 4;
  cout << ans << endl;
}


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

// macro
#define rep(i, n) for (i = 0; i < n; i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main() {
  ll n;
  cin >> n;
  vector<ll> mov(5);
  int i;
  rep(i, 5) cin >> mov[i];
  sort(all(mov));
  ll ans;
  ans = (n + mov[0] - 1) / mov[0] + 4;
  cout << ans << endl;
}
Problem p03077 (C++)

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

#define mod 1000000007

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

using namespace std;
typedef long long ll;

int main(void) {

  int N, a[5];

  cin >> N;

  rep(i, 5) cin >> a[i];

  sort(a, a + 5);

  ll ans = ceil((N - 1) / a[0]) + 5;

  cout << ans;

  return 0;
}

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

#define mod 1000000007

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

using namespace std;
typedef long long ll;

int main(void) {

  ll N, a[5];

  cin >> N;

  rep(i, 5) cin >> a[i];

  sort(a, a + 5);

  ll ans = ceil((N - 1) / a[0]) + 5;

  cout << ans;

  return 0;
}
Problem p03077 (C++)

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

int main(void) {
  ll n, a, b, c, d, e, ans = 5;
  cin >> n >> a >> b >> c >> d >> e;
  ans += n /
         max({(n - 1) / a, (n - 1) / b, (n - 1) / c, (n - 1) / d, (n - 1) / e});
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int main(void) {
  ll n, a, b, c, d, e, ans = 5;
  cin >> n >> a >> b >> c >> d >> e;
  ans += max({(n - 1) / a, (n - 1) / b, (n - 1) / c, (n - 1) / d, (n - 1) / e});
  cout << ans << endl;
  return 0;
}
Problem p03077 (C++)

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

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;

  map<ll, ll> city_people = {{1, n}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}};
  vector<ll> sub = {0, a, b, c, d, e};
  int t = 0;
  while (true) {
    for (int i = 5; 1 <= i; i--) {
      if (city_people[i]) {
        city_people[i + 1] +=
            (0 <= city_people[i] - sub[i]) ? sub[i] : city_people[i];
        city_people[i] = max(0LL, city_people[i] - sub[i]);
      }
    }
    t++;
    if (city_people[6] == n)
      break;
  }
  cout << t << endl;
}


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

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;

  ll minv = min({a, b, c, d, e});
  cout << (n + minv - 1) / minv + 4 << endl;
}
Problem p03077 (C++)

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

signed main(void) {
  vector<int> a(5);
  long long n, ans;

  cin >> n;
  rep(i, 5) cin >> a[i];
  sort(a.begin(), a.end());
  ans = (n / a[0] + 1) + 4;
  if (n % a[0] == 0)
    ans--;
  cout << ans << endl;
  return 0;
}


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

signed main(void) {
  vector<long long> a(5);
  long long n, ans;

  cin >> n;
  rep(i, 5) cin >> a[i];
  sort(a.begin(), a.end());
  ans = (n / a[0] + 1) + 4;
  if (n % a[0] == 0)
    ans--;
  cout << ans << endl;
  return 0;
}
Problem p03077 (Python)

Buggy submission (status: Runtime Error):
print(-(-(int(input())) // min([int(input() for i in range(5))])) + 4)


Fixed submission:
print(-(-int(input()) // min([int(input()) for i in range(5)])) + 4)
Problem p03077 (Python)

Buggy submission (status: Runtime Error):
from math import ceil


def main(N, A, B, C, D, E):
    loads = [A, B, C, D, E]
    min_val = min(loads)
    min_index = loads.index(min_val)

    res = min_index + ceil(N / min_val) + (5 - (min_index + 1))

    return res


if __name__ == "__main__":
    N = input()
    A = input()
    B = input()
    C = input()
    D = input()
    E = input()
    print(main(N, A, B, C, D, E))


Fixed submission:
from math import ceil


def main(N, A, B, C, D, E):
    loads = [A, B, C, D, E]
    min_val = min(loads)
    min_index = loads.index(min_val)

    res = min_index + ceil(N / min_val) + (5 - (min_index + 1))

    return res


if __name__ == "__main__":
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())
    print(main(N, A, B, C, D, E))
Problem p03077 (C++)

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

int main() {
  long long n;
  vector<int> a(5);
  cin >> n;
  long long min;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  min = *min_element(a.begin(), a.end());
  cout << 4 + (n + min - 1) / min << endl;
  return 0;
}

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

int main() {
  long long n;
  vector<long long> a(5);
  cin >> n;
  long long min;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  min = *min_element(a.begin(), a.end());
  cout << 4 + (n + min - 1) / min << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
/*
 * cpp_filepath
 */

// C++ 14
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring> // memset
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++)
template <class T> ostream &operator<<(ostream &out, vector<T> const &v) {
  for (auto &&a : v)
    out << a << " ";
  out << endl;
  return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() {
  solve();
  return 0;
}

void solve() {
  ll n;
  cin >> n;
  vector<ll> A(5);
  loop(i, 0, n) cin >> A[i];
  sort(A.begin(), A.end());
  ll m = (n / A[0]) + (n % A[0] != 0);
  cout << m + 4 << endl;
}


Fixed submission:
/*
 * cpp_filepath
 */

// C++ 14
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring> // memset
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++)
template <class T> ostream &operator<<(ostream &out, vector<T> const &v) {
  for (auto &&a : v)
    out << a << " ";
  out << endl;
  return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() {
  solve();
  return 0;
}

void solve() {
  ll n;
  cin >> n;
  vector<ll> A(5);
  loop(i, 0, 5) cin >> A[i];
  sort(A.begin(), A.end());
  ll m = (n / A[0]) + (n % A[0] != 0);
  cout << m + 4 << endl;
}
Problem p03077 (C++)

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

using namespace std;

int a[10], ppl, ans, cnt[10];

int main() {
  cin >> ppl >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
  a[0] = ppl;
  cnt[0] = 1;
  for (int i = 1; i <= 5; i++) {
    if (a[i] >= a[i - 1]) {
      cnt[i] = cnt[i - 1];
      a[i] = a[i - 1];
    } else
      cnt[i] = (ppl % a[i] == 0 ? (ppl / a[i]) : (ppl / a[i] + 1));
    ans = max(ans, cnt[i] + i - 1);
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

long long a[10], ppl, ans, cnt[10];

int main() {
  cin >> ppl >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
  a[0] = ppl;
  cnt[0] = 1;
  for (int i = 1; i <= 5; i++) {
    if (a[i] >= a[i - 1]) {
      cnt[i] = cnt[i - 1];
      a[i] = a[i - 1];
    } else
      cnt[i] = (ppl % a[i] == 0 ? (ppl / a[i]) : (ppl / a[i] + 1));
    ans = max(ans, cnt[i] + i - 1);
  }
  cout << ans << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
#define pb(X) push_back(X)
#define x first
#define y second
#define INIT                                                                   \
  std::ios::sync_with_stdio(false);                                            \
  std::cin.tie(0);
using namespace std;

typedef pair<int, int> pii;

long long n, a, b, c, d, e, ans;

int main() {
  INIT cin >> n;
  vector<long long> A(5);
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  long long Min = *min_element(A.begin(), A.end());
  ans = (Min + n - 1) / Min + 4;
  cout << ans;
  return 0;
}

Fixed submission:
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
#define pb(X) push_back(X)
#define x first
#define y second
#define INIT                                                                   \
  std::ios::sync_with_stdio(false);                                            \
  std::cin.tie(0);
using namespace std;

typedef pair<int, int> pii;

long long n, a, b, c, d, e, ans;

int main() {
  INIT cin >> n;
  vector<long long> A(5);
  for (int i = 0; i < 5; ++i) {
    cin >> A[i];
  }
  long long Min = *min_element(A.begin(), A.end());
  ans = (Min + n - 1) / Min + 4;
  cout << ans;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
int MAX = 5;
int main() {
  ll N;

  cin >> N;
  int A[MAX];

  REP(i, MAX) { cin >> A[i]; }

  sort(A, A + 5);
  ll ans = N / A[0] + 4;
  if (N % A[0] != 0)
    ++ans;

  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
int MAX = 5;
int main() {
  ll N;

  cin >> N;
  ll A[MAX];

  REP(i, MAX) { cin >> A[i]; }

  sort(A, A + 5);
  ll ans = N / A[0] + 4;
  if (N % A[0] != 0)
    ++ans;

  cout << ans << endl;
  return 0;
}
Problem p03077 (C++)

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

int main() {
  long long N;
  long long p[5];
  cin >> N >> p[0] >> p[1] >> p[2] >> p[3] >> p[4];
  long long T[6];
  for (int i = 0; i < 6; i++) {
    T[i] = 0;
  }
  long long cnt = 0;
  T[0] = N;
  while (!(T[5] == N)) {
    cout << cnt << " " << T[0] << T[1] << T[2] << T[3] << T[4];
    cnt++;
    for (int i = 0; i < 5; i++) {
      if (T[i] >= p[i]) {
        T[i] = T[i] - p[i];
        T[i + 1] = T[i + 1] + p[i];
      } else {
        T[i] = 0;
        T[i + 1] = T[i + 1] + T[i];
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


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

int main() {
  double N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  double bottle = min(min(min(min(A, B), C), D), E);
  // cout<<N<<" "<<bottle<<endl;
  cout << setprecision(18) << ceil(N / bottle) + 4 << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const long long mod = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()

int main(void) {
  ll n;
  cin >> n;
  ll a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  ll ans = 0;
  vector<ll> v = {n, 0, 0, 0, 0, 0};
  for (; v[5] != n;) {
    v[5] += min(v[4], e);
    v[4] -= min(v[4], e);
    v[4] += min(v[3], d);
    v[3] -= min(v[3], d);
    v[3] += min(v[2], c);
    v[2] -= min(v[2], c);
    v[2] += min(v[1], b);
    v[1] -= min(v[1], b);
    v[1] += min(v[0], a);
    v[0] -= min(v[0], a);
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const long long mod = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()

int main(void) {
  ll N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  cout << max({(N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D,
               (N - 1) / E}) +
              5
       << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
int main() {
  long long A, B, C, D, E, N;
  std::cin >> N >> A >> B >> C >> D >> E;

  long long M[6] = {A, B, C, D, E, 0};
  long long T[6] = {N, 0, 0, 0, 0, 0};

  long long time = 0;
  while (true) {
    if (T[5] == N)
      break;
    time++;

    for (int i = 4; i >= 0; i--) {
      if (T[i] == 0)
        continue;
      long long m = std::min(T[i], M[i]);
      T[i] -= m;
      T[i + 1] += m;
    }
  }

  std::cout << time << std::endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
int main() {
  long long A, B, C, D, E, N;
  std::cin >> N >> A >> B >> C >> D >> E;

  long long ans = std::max({(N + A - 1) / A, (N + B - 1) / B, (N + C - 1) / C,
                            (N + D - 1) / D, (N + E - 1) / E});
  std::cout << (ans + 4) << std::endl;

  return 0;
}
Problem p03077 (C++)

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

int main() {
  long long N, A, B, C, D, E, F;
  cin >> N >> A >> B >> C >> E >> F;
  long long shrt = min({A, B, C, D, E, F});
  long long ans = (N + shrt - 1) / shrt + 4;
  cout << ans << endl;
}

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

int main() {
  long long N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  long long shrt = min({A, B, C, D, E});
  long long ans = (N + shrt - 1) / shrt + 4;
  cout << ans << endl;
}
Problem p03077 (C++)

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

int main() {
  int64_t N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;

  int64_t F = min(A, min(B, min(C, min(D, min(E, F)))));

  if (N % F == 0) {
    cout << N / F + 4 << endl;
  } else {
    cout << N / F + 5 << endl;
  }
  return 0;
}


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

int main() {
  int64_t N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;

  int64_t F = min(A, min(B, min(C, min(D, E))));

  if (N % F == 0) {
    cout << N / F + 4 << endl;
  } else {
    cout << N / F + 5 << endl;
  }
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define MOD (long long)1000000007
using namespace std;

int main(void) {
  vector<int> a(6, 0);
  long long n, ans = 0, rem = 0;
  cin >> n;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    ans = max(ans, (n + a[i] - 1) / a[i] + 4);
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
#define MOD (long long)1000000007
using namespace std;

int main(void) {
  vector<long long> a(5);
  long long n, ans = 0;
  cin >> n;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    ans = max(ans, (n + a[i] - 1) / a[i] + 4);
  }
  cout << ans << endl;
  return 0;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long int ll;
typedef unsigned long long ull;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
typedef pair<ll, ll> P;

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  vector<ll> box(6);
  rep(i, 6) box[i] = 0;
  box[0] = n;
  ll cnt = 0;

  while (true) {
    if (box[5] == n)
      break;

    if (box[4] >= 0) {
      // cnt++;
      box[5] += min(e, box[4]);
      box[4] -= min(e, box[4]);
    }

    if (box[3] >= 0) {
      // cnt++;
      box[4] += min(d, box[3]);
      box[3] -= min(d, box[3]);
    }
    if (box[2] >= 0) {
      // cnt++;
      box[3] += min(c, box[2]);
      box[2] -= min(c, box[2]);
    }
    if (box[1] > 0) {
      // cnt++;
      box[2] += min(b, box[1]);
      box[1] -= min(b, box[1]);
    }
    if (box[0] > 0) {
      // cnt++;
      box[1] += min(a, box[0]);
      box[0] -= min(a, box[0]);
    }
    cnt++;
    // rep(i,6)cout<<box[i]<<" ";
    // cout << endl;
  }
  cout << cnt << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long int ll;
typedef unsigned long long ull;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
typedef pair<ll, ll> P;

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  vector<ll> box(6);
  rep(i, 6) box[i] = 0;
  box[0] = n;
  ll cnt = 0;

  cout << (ll)ceil((double)n / min({a, b, c, d, e})) + 4 << endl;
  return 0;
}
Problem p03077 (C++)

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

int main() {
  ll n;
  cin >> n;
  vector<ll> a(5), b(6, 0);
  for (int i = 0; i < 5; i++)
    cin >> a.at(i);
  b.at(0) = n;
  ll t = 0;
  while (b.at(5) != n) {
    for (int i = 4; i >= 0; i--) {
      b.at(i + 1) += min(b.at(i), a.at(i));
      b.at(i) -= min(b.at(i), a.at(i));
    }
    t++;
  }
  cout << t << endl;
}

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

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  ll ans = ceil((double)n / min({a, b, c, d, e})) + 4;
  cout << ans << endl;
}
Problem p03077 (C++)

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

long long N, A, B, C, D, E;
int main() {
  cin >> N >> A >> B >> C >> D >> E;
  long long m = min({A, B, C, D, E});
  long long ans = (N / (m - 1)) + 4;
  cout << ans << endl;
}


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

long long N, A, B, C, D, E;
int main() {
  cin >> N >> A >> B >> C >> D >> E;
  long long m = min({A, B, C, D, E});
  long long ans;
  if (N % m == 0) {
    ans = N / m + 4;
  } else {
    ans = N / m + 5;
  }
  cout << ans << endl;
}
Problem p03077 (C++)

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

using namespace std;

int main() {
  vector<int> a(5);
  long long min;
  long long time;
  long long n;
  cin >> n;
  for (int i = 0; i < a.size(); i++) {
    cin >> a[i];
    if (i == 0) {
      min = a[i];
    } else {
      if (min > a[i]) {
        min = a[i];
      }
    }
  }
  time = (n + (min - 1)) / min + 4;
  cout << time << endl;
}

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

using namespace std;

int main() {
  vector<long long> a(5);
  long long min;
  long long time;
  long long n;
  cin >> n;
  for (int i = 0; i < a.size(); i++) {
    cin >> a[i];
    if (i == 0) {
      min = a[i];
    } else {
      if (min > a[i]) {
        min = a[i];
      }
    }
  }
  time = (n + (min - 1)) / min + 4;
  cout << time << endl;
}
Problem p03077 (C++)

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

signed main() {
  int n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  int MIN = min({a, b, c, d, e});
  cout << 5 + (n - 1) / MIN;
}


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

signed main() {
  int n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  int MIN = min({a, b, c, d, e});
  cout << 5 + (n - 1) / MIN;
}
Problem p03077 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;

int main(void) {
  ll N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  vector<ll> moves = {-1, A, B, C, D, E};
  vector<ll> nums(6, 0);
  nums[0] = N;

  // for (auto v : nums) { cout << v << " "; } cout << endl;
  int time = 0;
  while (true) {
    vector<int> indices;
    // cout << "time " << time << endl;
    for (int i = 5; i >= 1; i--) {
      int mv = min(moves[i], nums[i - 1]);
      // cout << "\t" << i << " " << mv << endl;
      nums[i] += mv;
      nums[i - 1] -= mv;
    }

    // for (auto v : nums) { cout << v << " "; } cout << endl;
    // for (int i = 0; i < 5; i++) { nums[i] = nums2[i]; }
    if (nums[5] == N) {
      break;
    }
    time++;
    // if (time == 15) break;
  }
  cout << (time + 1) << endl;
}


Fixed submission:
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;

int main(void) {
  ll N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  vector<ll> v = {A, B, C, D, E};
  sort(v.begin(), v.end());
  ll ans = ceil((double)N / (double)v[0]) + 4LL;
  cout << ans << endl;
}