prithivMLmods/Coder-Stat huggingface dataset:
Problem p03076 (Python)

Buggy submission (status: Runtime Error):
orders = [int(input()) for _ in range(5)]

rest = []
time = 0
for order in orders:
    if order % 10 == 0:
        time += order
    else:
        rest.append(order)

rest_mods = list(map(lambda x: x % 10, rest))
min_mods_index = rest_mods.index(min(rest_mods))
for i in range(len(rest)):
    time += rest[i]
    if i != min_mods_index:
        time += 10 - rest[i] % 10
print(time)


Fixed submission:
orders = [int(input()) for _ in range(5)]

rest = []
time = 0
for order in orders:
    if order % 10 == 0:
        time += order
    else:
        rest.append(order)

rest_mods = list(map(lambda x: x % 10, rest))

if len(rest_mods) > 0:
    min_mods_index = rest_mods.index(min(rest_mods))
    for i in range(len(rest)):
        time += rest[i]
        if i != min_mods_index:
            time += 10 - rest[i] % 10
else:
    time += sum(rest)
print(time)
Problem p03076 (Python)

Buggy submission (status: Runtime Error):
def main() -> None:
    num = [int(input()) for _ in range(5)]
    ans = 0
    m = []
    for i in num:
        if i % 10:
            ans += i + 10 - i % 10
            m.append(10 - i % 10)
        else:
            ans += i
    print(ans - max(m))


if __name__ == "__main__":
    main()


Fixed submission:
def main() -> None:
    num = [int(input()) for _ in range(5)]
    ans = 0
    m = [0]
    for i in num:
        if i % 10:
            ans += i + 10 - i % 10
            m.append(10 - i % 10)
        else:
            ans += i
    print(ans - max(m))


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

Buggy submission (status: Runtime Error):
import math

ABCDE = [int(input()) for _ in range(5)]
print(
    sum([10 * math.ceil(_ / 10) for _ in ABCDE])
    + min([_ % 10 for _ in ABCDE if _ % 10])
    - 10
)


Fixed submission:
import math

ABCDE = [int(input()) for _ in range(5)]
print(
    sum([10 * math.ceil(_ / 10) for _ in ABCDE])
    + min([10] + [_ % 10 for _ in ABCDE if _ % 10])
    - 10
)
Problem p03076 (Python)

Buggy submission (status: Runtime Error):
import math

time_list = list()

for _ in range(5):
    time_list.append(int(input()))


def key_func(x):
    if x < 100:  # 2桁 or 1桁の場合
        if x % 10 == 0:
            return 10
        return x % 10  # ex: 19の場合は9を返す
    else:
        if x % 100 == 0:
            return 10
        return x % 100  # ex: 123の場合は3を返す


time_list.sort(key=key_func, reverse=True)

# print(time_list)

ans = sum
for i, time in enumerate(time_list):
    if i < len(time_list) - 1:
        ans += math.ceil(time / 10) * 10
    else:
        ans += time

print(ans)


Fixed submission:
import math

time_list = list()

for _ in range(5):
    time_list.append(int(input()))

# 全探索
ans = 1e6
for i in range(len(time_list)):
    tmp = 0
    for j in range(len(time_list)):
        if i == j:
            tmp += time_list[i]
            continue
        tmp += math.ceil(time_list[j] / 10) * 10
    ans = min(tmp, ans)

print(ans)
Problem p03076 (Python)

Buggy submission (status: Runtime Error):
cook = []
amari = []
t = 0
for i in range(5):
    cook.append(int(input()))

for i in range(5):
    if cook[i] % 10 != 0:
        t += cook[i] + (10 - cook[i] % 10)
    else:
        t += cook[i]

for i in range(5):
    if cook[i] % 10 != 0:
        amari.append(10 - cook[i] % 10)

print(t - max(amari))


Fixed submission:
cook = []
amari = [0]
t = 0
for i in range(5):
    cook.append(int(input()))

for i in range(5):
    if cook[i] % 10 != 0:
        t += cook[i] + (10 - cook[i] % 10)
    else:
        t += cook[i]

for i in range(5):
    if cook[i] % 10 != 0:
        amari.append(10 - cook[i] % 10)

print(t - max(amari))
Problem p03076 (Python)

Buggy submission (status: Runtime Error):
times = [int(input()) for i in range(5)]
cost = 0
p_times = [time % 10 for time in times]
if sum(p_times) == 0 and min(p_times) > 0:
    last_order = False
else:
    last_order = min([i for i in p_times if i > 0])
    last_order_idx = p_times.index(last_order)

if last_order:
    cost = times.pop(last_order_idx)

for time in times:
    if time % 10 == 0:
        cost += time
    else:
        cost += time + (10 - time % 10)

print(cost)


Fixed submission:
times = [int(input()) for i in range(5)]
cost = 0
p_times = [time % 10 for time in times]

if (sum([i % 10 for i in p_times]) == 0) & (min(times) > 0):
    last_order = False
else:
    last_order = min([i for i in p_times if i > 0])
    last_order_idx = p_times.index(last_order)

if last_order:
    cost = times.pop(last_order_idx)

for time in times:
    if time % 10 == 0:
        cost += time
    else:
        cost += time + (10 - time % 10)

print(cost)
Problem p03076 (C++)

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

int main() {
  std::vector<int> a(5);
  std::vector<int> uq;

  int sum = 0;
  for (int i = 0; i < 5; i++) {
    std::cin >> a[i];
    if (a[i] % 10) {
      uq.push_back(a[i] % 10);
      a[i] += (10 - a[i] % 10);
      sum += a[i];
    } else {
      sum += a[i];
    }
  }

  int minuq = *std::min_element(uq.begin(), uq.end());
  sum += (-10 + minuq);

  std::cout << sum << "\n";
}

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

int main() {
  std::vector<int> a(5);
  std::vector<int> uq;

  int sum = 0;
  for (int i = 0; i < 5; i++) {
    std::cin >> a[i];
    if (a[i] % 10) {
      uq.push_back(a[i] % 10);
      a[i] += (10 - a[i] % 10);
      sum += a[i];
    } else {
      sum += a[i];
    }
  }
  if (!uq.size()) {
    uq.push_back(10);
  }

  int minuq = *std::min_element(uq.begin(), uq.end());
  sum += (-10 + minuq);

  std::cout << sum << "\n";
}
Problem p03076 (C++)

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

int main() {
  vector<ll> n(5);
  ll num = 1000;
  ll id;
  rep(i, 5) {
    cin >> n.at(i);
    if (num > n.at(i) % 10 && n.at(i) % 10 != 0) {
      num = n.at(i) % 10;
      id = i;
    }
  }
  ll ans = 0;
  rep(i, 5) {
    if (i == id)
      continue;
    ans += 10 * (ceil((double)n.at(i) / 10.0));
  }
  ans += n.at(id);
  cout << ans << endl;

  return 0;
}


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

int main() {
  vector<ll> n(5);
  ll num = 10;
  ll id = 0;
  rep(i, 5) {
    cin >> n.at(i);
    if (num > n.at(i) % 10 && n.at(i) % 10 != 0) {
      num = n.at(i) % 10;
      id = i;
    }
  }
  ll ans = 0;
  rep(i, 5) {
    if (i == id)
      continue;
    ans += 10 * (ceil((double)n.at(i) / 10.0));
  }
  ans += n.at(id);
  cout << ans << endl;

  return 0;
}
Problem p03076 (C++)

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

using ll = long long;
using P = pair<int, int>;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  int ans = a + b + c + d + e;
  vector<int> amari;
  if (a % 10 != 0) {
    amari.push_back(10 - a % 10);
  }
  if (b % 10 != 0) {
    amari.push_back(10 - b % 10);
  }
  if (c % 10 != 0) {
    amari.push_back(10 - c % 10);
  }
  if (d % 10 != 0) {
    amari.push_back(10 - d % 10);
  }
  if (e % 10 != 0) {
    amari.push_back(10 - e % 10);
  }
  sort(amari.begin(), amari.end());
  for (int i = 0; i < amari.size() - 1; i++) {
    ans += amari[i];
  }

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


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

using ll = long long;
using P = pair<int, int>;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  int ans = a + b + c + d + e;
  vector<int> amari;
  if (a % 10 != 0) {
    amari.push_back(10 - a % 10);
  }
  if (b % 10 != 0) {
    amari.push_back(10 - b % 10);
  }
  if (c % 10 != 0) {
    amari.push_back(10 - c % 10);
  }
  if (d % 10 != 0) {
    amari.push_back(10 - d % 10);
  }
  if (e % 10 != 0) {
    amari.push_back(10 - e % 10);
  }
  if (amari.size() > 0) {
    sort(amari.begin(), amari.end());
    for (int i = 0; i < amari.size() - 1; i++) {
      ans += amari[i];
    }
  }

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

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

int main() {
  vector<int> a;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    sum += x;
    if (x % 10 != 0)
      a.push_back(10 - x % 10);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size() - 1; i++)
    sum += a.at(i);
  cout << sum << endl;
}

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

int main() {
  vector<int> a;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    sum += x;
    if (x % 10 != 0)
      a.push_back(10 - x % 10);
  }
  if (!a.empty()) {
    sort(a.begin(), a.end());
    for (int i = 0; i < a.size() - 1; i++)
      sum += a.at(i);
  }
  cout << sum << endl;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
bool option(int a, int b) { return a % 10 > b % 10; }
int main() {
  vector<int> a;
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    if (x % 10 == 0) {
      ans += x;
    } else {
      a.push_back(x);
    }
  }
  sort(a.begin(), a.end(), option);
  /*cout<<"ans = "<<ans<<endl;
  for(int x: a){
      cout<<x<<" ";
  }cout<<endl;*/
  for (int i = 0; i + 1 < a.size(); i++) {
    ans += (10 - a[i] % 10);
    ans += a[i];
  }
  cout << ans + a[a.size() - 1];
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
bool option(int a, int b) { return a % 10 > b % 10; }
int main() {
  vector<int> a;
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    if (x % 10 == 0) {
      ans += x;
    } else {
      a.push_back(x);
    }
  }
  sort(a.begin(), a.end(), option);
  /*cout<<"ans = "<<ans<<endl;
  for(int x: a){
      cout<<x<<" ";
  }cout<<endl;*/
  if (a.size() == 0) {
    cout << ans;
    return 0;
  }
  if (a.size() == 1) {
    cout << a[0] + ans;
    return 0;
  }
  for (int i = 0; i + 1 < a.size(); i++) {
    ans += (10 - a[i] % 10);
    ans += a[i];
  }
  cout << ans + a[a.size() - 1];
  return 0;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int setTime(int n) {
  if (n % 10 == 0)
    return n;
  else {
    int a = n / 10;
    return (a + 1) * 10;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> pre(0);
  vector<pair<int, int>> vec(0);
  int a, tim = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a;
    if (a % 10 == 0)
      tim += a;
    else
      vec.push_back(make_pair(a % 10, a));
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int n = vec.size();
  n = max(0, n - 1);
  for (int i = 0; i < n; i++) {
    tim += setTime(vec.at(i).second);
  }
  tim += vec.at(n).second;
  cout << tim << '\n';
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int setTime(int n) {
  if (n % 10 == 0)
    return n;
  else {
    int a = n / 10;
    return (a + 1) * 10;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> pre(0);
  vector<pair<int, int>> vec(0);
  int a, tim = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a;
    if (a % 10 == 0)
      tim += a;
    else
      vec.push_back(make_pair(a % 10, a));
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int n = vec.size();
  n = max(0, n - 1);
  for (int i = 0; i < n; i++) {
    tim += setTime(vec.at(i).second);
  }
  if (vec.size() != 0)
    tim += vec.at(n).second;
  cout << tim << '\n';
}
Problem p03076 (C++)

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

bool sort_by_second(pair<int, int> a, pair<int, int> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

int main() {
  vector<pair<int, int>> t;
  int sum = 0;
  rep(i, 5) {
    int a;
    cin >> a;
    int b = a % 10;
    if (b == 0)
      sum += a;
    else
      t.push_back(make_pair(a, b));
  }
  sort(t.begin(), t.end(), sort_by_second);
  sum += t[0].first;
  for (int i = 1; i < t.size(); i++)
    sum += t[i].first - t[i].second + 10;
  cout << sum << endl;
}


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

bool sort_by_second(pair<int, int> a, pair<int, int> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

int main() {
  vector<pair<int, int>> t;
  int sum = 0;
  rep(i, 5) {
    int a;
    cin >> a;
    int b = a % 10;
    if (b == 0)
      sum += a;
    else
      t.push_back(make_pair(a, b));
  }
  if (t.empty()) {
    cout << sum << endl;
    return 0;
  }
  sort(t.begin(), t.end(), sort_by_second);
  sum += t[0].first;
  for (int i = 1; i < t.size(); i++)
    sum += t[i].first - t[i].second + 10;
  cout << sum << endl;
}
Problem p03076 (C++)

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

int main() {
  vector<int> dishes(5);
  rep(i, 5) cin >> dishes.at(i);
  vector<int> notpit;
  rep(i, 5) {
    if (dishes.at(i) % 10 != 0) {
      notpit.push_back(10 - (dishes.at(i) % 10));
    }
  }
  sort(notpit.begin(), notpit.end());
  int time = 0;
  sort(dishes.begin(), dishes.end());
  rep(i, 5) time += dishes.at(i);
  rep(i, notpit.size() - 1) time += notpit.at(i);
  cout << time << endl;
}

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

int main() {
  vector<int> dishes(5);
  rep(i, 5) cin >> dishes.at(i);
  vector<int> notpit;
  rep(i, 5) {
    if (dishes.at(i) % 10 != 0) {
      notpit.push_back(10 - (dishes.at(i) % 10));
    }
  }
  sort(notpit.begin(), notpit.end());
  int time = 0;
  sort(dishes.begin(), dishes.end());
  rep(i, 5) time += dishes.at(i);
  if (notpit.size() > 0)
    rep(i, notpit.size() - 1) time += notpit.at(i);
  cout << time << endl;
}
Problem p03076 (C++)

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

int main() {
  int sum = 0;
  vector<int> a;
  for (int i = 0; i < 5; i++) {
    int t;
    cin >> t;
    if (t % 10 == 0)
      sum += t;
    else
      a.push_back(t);
  }

  int x;
  int y = 10;
  for (int i = 0; i < a.size(); i++) {
    int s = a[i] % 10;
    if (s < y)
      x = i, y = s;
  }
  sum += a[x];

  for (int i = 0; i < a.size(); i++) {
    if (i == x)
      continue;
    sum += a[i] + 10 - (a[i] % 10);
  }

  cout << sum << endl;
}

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

int main() {
  int sum = 0;
  vector<int> a;
  for (int i = 0; i < 5; i++) {
    int t;
    cin >> t;
    if (t % 10 == 0)
      sum += t;
    else
      a.push_back(t);
  }

  if (a.size() == 0) {
    cout << sum << endl;
    return 0;
  }

  int x;
  int y = 10;
  for (int i = 0; i < a.size(); i++) {
    int s = a[i] % 10;
    if (s < y)
      x = i, y = s;
  }
  sum += a[x];

  for (int i = 0; i < a.size(); i++) {
    if (i == x)
      continue;
    sum += a[i] + 10 - (a[i] % 10);
  }

  cout << sum << endl;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
bool compare(int a, int b) {
  if ((a % 10) > (b % 10))
    return true;
  return false;
}
int main() {
  vector<int> v;
  int ans = 0, a;
  for (int i = 0; i < 5; i++) {
    cin >> a;
    if (a % 10 != 0)
      v.push_back(a);
    else
      ans += a;
  }
  sort(v.begin(), v.end(), compare);
  for (int i = 0; i < v.size() - 1; i++) {
    int b = v[i] / 10;
    b++;
    ans += b * 10;
  }
  ans += v[v.size() - 1];
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
bool compare(int a, int b) {
  if ((a % 10) > (b % 10))
    return true;
  return false;
}
int main() {
  vector<int> v;
  int ans = 0, a;
  for (int i = 0; i < 5; i++) {
    cin >> a;
    if (a % 10 != 0)
      v.push_back(a);
    else
      ans += a;
  }
  if (v.size() == 0) {
    cout << ans;
    return 0;
  }
  sort(v.begin(), v.end(), compare);
  for (int i = 0; i < v.size() - 1; i++) {
    int b = v[i] / 10;
    b++;
    ans += b * 10;
  }
  ans += v[v.size() - 1];
  cout << ans << endl;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
int main() {
  IOS;
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> nums;
  nums.push_back(a);
  nums.push_back(b);
  nums.push_back(c);
  nums.push_back(d);
  nums.push_back(e);
  vector<int> vec;
  for (int i = 0; i < 5; i++) {
    if (10 - (nums[i] % 10) != 10) {
      vec.push_back(10 - (nums[i] % 10));
    }
  }
  sort(vec.begin(), vec.end());
  int count = 0;
  for (int i = 0; i < vec.size() - 1; i++) {
    count += vec[i];
  }
  int ans = a + b + c + d + e;
  cout << ans + count << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
int main() {
  IOS;
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> nums;
  nums.push_back(a);
  nums.push_back(b);
  nums.push_back(c);
  nums.push_back(d);
  nums.push_back(e);
  vector<int> vec = {0};
  for (int i = 0; i < 5; i++) {
    if (10 - (nums[i] % 10) != 10) {
      vec.push_back(10 - (nums[i] % 10));
    }
  }
  sort(vec.begin(), vec.end());
  int count = 0;
  for (int i = 0; i < vec.size() - 1; i++) {
    count += vec[i];
  }
  int ans = a + b + c + d + e;
  cout << ans + count << endl;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod = 1e9 + 7;

// vector書き出し
template <class T> void cout_vec(const vector<T> &vec1) {
  rep(i, len(vec1)) { cout << vec1[i] << ' '; }
  cout << '\n';
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5);
  vector<int> b;
  int ans = 0;
  rep(i, 5) {
    cin >> a[i];
    ans += a[i];
    if (a[i] % 10 != 0) {
      b.push_back(10 - a[i] % 10);
      ans += 10 - a[i] % 10;
    }
  }
  cout << ans - *max_element(begin(b), end(b)) << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod = 1e9 + 7;

// vector書き出し
template <class T> void cout_vec(const vector<T> &vec1) {
  rep(i, len(vec1)) { cout << vec1[i] << ' '; }
  cout << '\n';
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5);
  vector<int> b;
  int ans = 0;
  rep(i, 5) {
    cin >> a[i];
    ans += a[i];
    if (a[i] % 10 != 0) {
      b.push_back(10 - a[i] % 10);
      ans += 10 - a[i] % 10;
    }
  }
  if (!b.empty()) {
    cout << ans - *max_element(begin(b), end(b)) << endl;
  } else {
    cout << ans << endl;
  }
}
Problem p03076 (C++)

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library
//

bool comp(const int lh, const int rh) {
  int tmp_l = lh % 10;
  int tmp_r = rh % 10;
  return (lh % 10) > (rh % 10);
}

int main() {
#ifdef MYLOCAL
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  int ans = 0;
  vector<int> vec;
  for (int i = 0; i < 5; ++i) {
    int tmp;
    cin >> tmp;
    if (tmp % 10 == 0) {
      ans += tmp;
    } else {
      vec.push_back(tmp);
    }
  }
  sort(vec.begin(), vec.end(), comp);
  for (int i = 0; i < vec.size() - 1; ++i) {
    int tmp = vec[i] / 10;
    ans += (tmp + 1) * 10;
  }
  ans += vec[vec.size() - 1];

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


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library
//

bool comp(const int lh, const int rh) {
  int tmp_l = lh % 10;
  int tmp_r = rh % 10;
  return (lh % 10) > (rh % 10);
}

int main() {
#ifdef MYLOCAL
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  int ans = 0;
  vector<int> vec;
  for (int i = 0; i < 5; ++i) {
    int tmp;
    cin >> tmp;
    if (tmp % 10 == 0) {
      ans += tmp;
    } else {
      vec.push_back(tmp);
    }
  }
  sort(vec.begin(), vec.end(), comp);
  if (vec.empty()) {
    cout << ans << endl;
    return 0;
  }

  for (int i = 0; i < vec.size() - 1; ++i) {
    int tmp = vec[i] / 10;
    ans += (tmp + 1) * 10;
  }
  ans += vec[vec.size() - 1];

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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  vector<int> b;
  for (int i = 0; i < 5; i++) {
    int A;
    cin >> A;
    if (A % 10 != 0)
      b.push_back(A % 10);
    int temp = (A + 9) / 10;
    ans += temp * 10;
  }

  int sub = *min_element(b.begin(), b.end());
  ans -= (10 - sub);
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  vector<int> b;
  for (int i = 0; i < 5; i++) {
    int A;
    cin >> A;
    if (A % 10 != 0)
      b.push_back(A % 10);
    int temp = (A + 9) / 10;
    ans += temp * 10;
  }

  if (b.size() >= 1) {
    int sub = *min_element(b.begin(), b.end());
    ans -= (10 - sub);
  }
  cout << ans << endl;
}
Problem p03076 (C++)

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

int main() {
  vector<ll> a;
  ll sum = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    sum += x;
    if (x % 10 != 0)
      a.push_back(10 - x % 10);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size() - 1; i++)
    sum += a.at(i);
  cout << sum << endl;
}

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

int main() {
  vector<ll> a;
  ll sum = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    sum += x;
    if (x % 10 != 0)
      a.push_back(10 - x % 10);
  }

  if (!a.empty()) {
    sort(a.begin(), a.end());
    for (int i = 0; i < a.size() - 1; i++)
      sum += a.at(i);
  }
  cout << sum << endl;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> list(5);
  int t, j = 0, mw;
  for (int i = 0; i < 5; i++) {
    cin >> list.at(i);
    t = 10 - (list.at(i) % 10);
    if (j < t && t != 10) {
      j = t;
      mw = i;
    }
  }
  int ans = 0, x;
  for (int i = 0; i < 5; i++) {
    if (i != mw) {
      x = list.at(i);
      if (x % 10 != 0) {
        x = (x + 10) / 10 * 10;
      }
      ans += x;
    }
  }
  ans += list.at(mw);
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> list(5);
  int t, j = 0, mw = 0;
  for (int i = 0; i < 5; i++) {
    cin >> list.at(i);
    t = 10 - (list.at(i) % 10);
    if (j < t && t != 10) {
      j = t;
      mw = i;
    }
  }
  int ans = 0, x;
  for (int i = 0; i < 5; i++) {
    if (i != mw) {
      x = list.at(i);
      if (x % 10 != 0) {
        x = (x + 10) / 10 * 10;
      }
      ans += x;
    }
  }
  ans += list.at(mw);
  cout << ans << endl;
}
Problem p03076 (C++)

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

int main() {
  vector<pair<int, int>> T(5);
  int k, ans = 0;
  for (int i = 0; i < 5; i++) {
    cin >> k;
    T.at(i) = make_pair(k % 10, k);
  }
  sort(T.begin(), T.end());
  for (int i = 0; T.at(i).first == 0; i++) {
    ans += T.at(i).second;
  }
  for (int i = 4; i >= 0 && T.at(i).first != 0; i--) {
    ans += (T.at(i).second / 10 + 1) * 10;
  }
  k = 1;
  for (int i = 0; i < 5 && k; i++) {
    if (T.at(i).first != 0) {
      ans = ans - (T.at(i).second / 10 + 1) * 10 + T.at(i).second;
      k = 0;
    }
  }
  cout << ans << endl;
}

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

int main() {
  vector<pair<int, int>> T(5);
  int k, ans = 0;
  for (int i = 0; i < 5; i++) {
    cin >> k;
    T.at(i) = make_pair(k % 10, k);
  }
  sort(T.begin(), T.end());
  for (int i = 0; i < 5 && T.at(i).first == 0; i++) {
    ans += T.at(i).second;
  }
  for (int i = 4; i >= 0 && T.at(i).first != 0; i--) {
    ans += (T.at(i).second / 10 + 1) * 10;
  }
  k = 1;
  for (int i = 0; i < 5 && k; i++) {
    if (T.at(i).first != 0) {
      ans = ans - (T.at(i).second / 10 + 1) * 10 + T.at(i).second;
      k = 0;
    }
  }
  cout << ans << endl;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD = 1000000007;

int main() {
  int ans = 0;
  vector<int> S;
  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    if (a % 10 != 0) {
      S.push_back(a % 10);
      a += 10 - (a % 10);
    }
    ans += a;
    a %= 10;
  }
  sort(S.begin(), S.end());
  cout << ans - 10 + S.at(0);
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD = 1000000007;

int main() {
  int ans = 0;
  vector<int> S;
  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    if (a % 10 != 0) {
      S.push_back(a % 10);
      a += 10 - (a % 10);
    }
    ans += a;
    a %= 10;
  }
  if (S.size() != 0) {
    sort(S.begin(), S.end());
    cout << ans - 10 + S.at(0);
  } else
    cout << ans;
}
Problem p03076 (C++)

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

int main() {
  std::vector<int> n(5), m;
  int k;
  for (int i = 0; i < 5; i++) {
    std::cin >> n[i];
    if (n[i] % 10 != 0) {
      m.push_back(10 - n[i] % 10);
    }
  }

  std::cout << std::accumulate(n.begin(), n.end(), 0) +
                   std::accumulate(m.begin(), m.end(), 0) -
                   *(std::max_element(m.begin(), m.end()))
            << std::endl;
  return 0;
}

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

int main() {
  std::vector<int> n(5), m;
  int k;
  for (int i = 0; i < 5; i++) {
    std::cin >> n[i];
    if (n[i] % 10 != 0) {
      m.push_back(10 - n[i] % 10);
    }
  }

  if (m.size() == 0) {
    m.push_back(0);
  }

  std::cout << std::accumulate(n.begin(), n.end(), 0) +
                   std::accumulate(m.begin(), m.end(), 0) -
                   *(std::max_element(m.begin(), m.end()))
            << std::endl;
  return 0;
}
Problem p03076 (C++)

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

int main() {
  vector<int> vec(5);
  int a = 9;
  int idx;
  rep(i, 5) {
    cin >> vec[i];
    int tmp = vec[i] % 10;
    if (tmp == 0)
      tmp = 10;
    if (tmp <= a) {
      idx = i;
      a = tmp;
    }
  }
  int ans = 0;
  rep(i, 5) {
    if (i == idx)
      continue;
    ans += (vec[i] + 10 - 1) / 10 * 10;
  }
  ans += vec[idx];
  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;
using ll = long long;

int main() {
  vector<int> vec(5);
  int a = 9;
  int idx = 0;
  rep(i, 5) {
    cin >> vec[i];
    int tmp = vec[i] % 10;
    if (tmp == 0)
      tmp = 10;
    if (tmp <= a) {
      idx = i;
      a = tmp;
    }
  }
  int ans = 0;
  rep(i, 5) {
    if (i == idx)
      continue;
    ans += (vec[i] + 10 - 1) / 10 * 10;
  }
  ans += vec[idx];
  cout << ans << endl;
  return 0;
}
Problem p03076 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repe(i, n) for (int i = 0; i <= n; ++i)
#define repr(i, n) for (int i = n - 1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
using namespace std;
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;
}
template <class T> using V = vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007;
const ll MAX = 510000;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
// 二項係数計算
long long COM(int n, int k) {
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int a, b, c, d, e;
  vector<int> V(5);
  vector<int> A;
  int diff = 0;
  int total = 0;
  rep(i, 5) {
    cin >> V[i];
    if (V[i] % 10 != 0) {
      A.pb(10 - V[i] % 10);
    }
  }
  sort(all(A));
  rep(i, 5) { total += V[i]; }
  rep(j, A.size() - 1) { diff += A[j]; }
  cout << total + diff << "\n";
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repe(i, n) for (int i = 0; i <= n; ++i)
#define repr(i, n) for (int i = n - 1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
using namespace std;
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;
}
template <class T> using V = vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007;
const ll MAX = 510000;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
// 二項係数計算
long long COM(int n, int k) {
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int a, b, c, d, e;
  vector<int> V(5);
  vector<int> A;
  int diff = 0;
  int total = 0;
  rep(i, 5) {
    cin >> V[i];
    if (V[i] % 10 != 0) {
      A.pb(10 - V[i] % 10);
    }
  }
  sort(all(A));
  rep(i, 5) { total += V[i]; }
  if (A.size() > 0) {
    rep(j, A.size() - 1) { diff += A[j]; }
  }
  cout << total + diff << "\n";
}
Problem p03076 (C++)

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

int main() {
  vector<int> p;
  vector<P> q;
  rep(i, 5) {
    int c;
    cin >> c;
    if (c % 10 == 0)
      p.push_back(c);
    else
      q.push_back({c % 10, c});
  }
  sort(q.rbegin(), q.rend());

  int ans = 0;
  rep(i, p.size()) ans += p[i];
  rep(i, q.size() - 1) ans += 10 * ((q[i].second + 9) / 10);
  ans += q[q.size() - 1].second;

  cout << ans << endl;
}

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

int main() {
  vector<int> p;
  vector<P> q;
  rep(i, 5) {
    int c;
    cin >> c;
    if (c % 10 == 0)
      p.push_back(c);
    else
      q.push_back({c % 10, c});
  }
  sort(q.rbegin(), q.rend());

  int ans = 0;
  rep(i, p.size()) ans += p[i];
  rep(i, q.size() - 1) ans += 10 * ((q[i].second + 9) / 10);

  if (q.size() != 0)
    ans += q[q.size() - 1].second;

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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ITR(x, c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x, c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll, ll>
#define pi pair<int, int>

#define all(a) (a.begin()), (a.end())
#define rall(a) (a.rbegin()), (a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a[5];
  vll b;
  ll sum = 0;
  rep(i, 5) {
    cin >> a[i];
    sum += a[i];
    if (a[i] % 10 != 0) {
      sum += 10 - a[i] % 10;
      b.pb(10 - a[i] % 10);
    }
  }
  sort(rall(b));
  sum -= b[0];
  cout << sum << "\n";
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ITR(x, c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x, c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll, ll>
#define pi pair<int, int>

#define all(a) (a.begin()), (a.end())
#define rall(a) (a.rbegin()), (a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a[5];
  vll b;
  ll sum = 0;
  rep(i, 5) {
    cin >> a[i];
    sum += a[i];
    if (a[i] % 10 != 0) {
      sum += 10 - a[i] % 10;
      b.pb(10 - a[i] % 10);
    }
  }
  if (b.size()) {
    sort(rall(b));
    sum -= b[0];
  }
  cout << sum << "\n";
  return 0;
}
Problem p03076 (C++)

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

#define SYNC ios::sync_with_stdio(0);
#define F first
#define S second
#define endl '\n'

using namespace std;

using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 58;
const ll mod = 1000000007;

int main() {
  SYNC int n[5], k, ans = 0;
  int idx, maxi = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> n[i];
    // cout << "dif: " << abs(n[i]%10 - 10)%10 << endl;
    if (maxi < abs(n[i] % 10 - 10) % 10) {
      maxi = abs(n[i] % 10 - 10) % 10;
      idx = i;
    }
    ans += n[i] + abs(n[i] % 10 - 10) % 10;
    // cout << "ans: " << ans << endl;
  }
  // cout << idx << endl;
  ans -= abs(n[idx] % 10 - 10) % 10;
  cout << ans << endl;
  return 0;
}

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

#define SYNC ios::sync_with_stdio(0);
#define F first
#define S second
#define endl '\n'

using namespace std;

using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 58;
const ll mod = 1000000007;

int main() {
  SYNC int n[5], ans = 0;
  int idx = 0, maxi = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> n[i];
    // cout << "dif: " << abs(n[i]%10 - 10)%10 << endl;
    if (maxi < abs(n[i] % 10 - 10) % 10) {
      maxi = abs(n[i] % 10 - 10) % 10;
      idx = i;
    }
    ans += n[i] + abs(n[i] % 10 - 10) % 10;
    // cout << "ans: " << ans << endl;
  }
  // cout << idx << endl;
  ans -= abs(n[idx] % 10 - 10) % 10;
  cout << ans << endl;
  return 0;
}
Problem p03076 (C++)

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

int main() {

  vector<int> tim(5);
  int minwk = 125;
  int min_index;
  for (int i = 0; i < 5; i++) {
    cin >> tim.at(i);
    int rem = tim.at(i) % 10;

    if (rem < minwk && rem != 0) {
      min_index = i;
      minwk = rem;
    }
  }

  int sum = 0;
  for (int i = 0; i < 5; i++) {
    if (i != min_index)
      sum += ((tim.at(i) + 9) / 10) * 10;
  }

  cout << sum + tim.at(min_index) << endl;

  return 0;
}


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

int main() {

  vector<int> tim(5);
  int minwk = 125;
  int min_index = 0;
  for (int i = 0; i < 5; i++) {
    cin >> tim.at(i);
    int rem = tim.at(i) % 10;

    if (rem < minwk && rem != 0) {
      min_index = i;
      minwk = rem;
    }
  }

  int sum = 0;
  for (int i = 0; i < 5; i++) {
    if (i != min_index)
      sum += ((tim.at(i) + 9) / 10) * 10;
  }

  cout << sum + tim.at(min_index) << endl;

  return 0;
}
Problem p03076 (C++)

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

using namespace std;
int main() {

  int a[5];
  int o[5];
  int sub[5];
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
    o[i] = 0;
    int n = (a[i] / 10 + 1);
    sub[i] = (a[i] % 10 == 0) ? 0 : n * 10 - a[i];
    // cout << i << " " << sub[i] << endl;
  }

  int time = 0;
  for (int i = 0; i < 5; ++i) {
    int idx = 0;
    int max = 10;
    for (int j = 0; j < 5; ++j) {
      //            cout << sub[j] << endl;
      if (max > sub[j] && o[j] == 0) {
        max = sub[j];
        idx = j;
      }
    }

    o[idx] = 1;
    time += (i == 4)             ? a[idx]
            : (a[idx] % 10 == 0) ? a[idx]
                                 : (a[idx] / 10 + 1) * 10;
    // cout << i << " " << idx << " " <<time << endl;
  }

  return time;
}

Fixed submission:
#include <iostream>

using namespace std;
int main() {

  int a[5];
  int o[5];
  int sub[5];
  for (int i = 0; i < 5; ++i) {
    cin >> a[i];
    o[i] = 0;
    int n = (a[i] / 10 + 1);
    sub[i] = (a[i] % 10 == 0) ? 0 : n * 10 - a[i];
    // cout << i << " " << sub[i] << endl;
  }

  int time = 0;
  for (int i = 0; i < 5; ++i) {
    int idx = 0;
    int max = 10;
    for (int j = 0; j < 5; ++j) {
      //            cout << sub[j] << endl;
      if (max > sub[j] && o[j] == 0) {
        max = sub[j];
        idx = j;
      }
    }

    o[idx] = 1;
    time += (i == 4)             ? a[idx]
            : (a[idx] % 10 == 0) ? a[idx]
                                 : (a[idx] / 10 + 1) * 10;
    // cout << i << " " << idx << " " <<time << endl;
  }
  cout << time << endl;
  return 0;
}
Problem p03076 (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() {
  vector<int> v;
  int p, ans;
  rep(i, 5) {
    cin >> p;
    if (p % 10 == 0)
      ans += p;
    else {
      ans += p / 10 * 10;
      v.push_back(p % 10);
    }
  }
  sort(v.begin(), v.end());
  if (v.size() <= 1)
    ans += v.at(0) + (v.size() - 1) * 10;
  cout << ans;
}


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

int main() {
  vector<int> v;
  int p, ans;
  rep(i, 5) {
    cin >> p;
    if (p % 10 == 0)
      ans += p;
    else {
      ans += p / 10 * 10;
      v.push_back(p % 10);
    }
  }
  sort(v.begin(), v.end());
  if (v.size() >= 1)
    ans += v.at(0) + (v.size() - 1) * 10;
  cout << ans;
}
Problem p03076 (C++)

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

int main() {
  vt<int> m(5);
  int num, k = 9;
  rep(i, 5) {
    std::cin >> m[i];
    if (k > m[i] % 10 && m[i] % 10 != 0) {
      k = m[i] % 10;
      num = i;
    }
  }

  int ans = 0;
  rep(i, 5) {
    if (i == num)
      continue;
    else if (m[i] % 10 != 0)
      m[i] += 10 - (m[i] % 10);
    ans += m[i];
  }

  std::cout << ans + m[num] << '\n';
  return 0;
}


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

int main() {
  vt<int> m(5);
  int num = 0, k = 9;
  rep(i, 5) {
    std::cin >> m[i];
    if (k > m[i] % 10 && m[i] % 10 != 0) {
      k = m[i] % 10;
      num = i;
    }
  }

  int ans = 0;
  rep(i, 5) {
    if (i == num)
      continue;
    else if (m[i] % 10 != 0)
      m[i] += 10 - (m[i] % 10);
    ans += m[i];
  }

  std::cout << ans + m[num] << '\n';
  return 0;
}
Problem p03076 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <math.h>
#include <stack>
#include <string>
#include <vector>
// #include<stdlib.h>
using namespace std;

int main() {
  short i[5];
  int a = 0, m = 0;
  for (int k = 0; k < 5; k++) {
    cin >> i[k];
    if (10 - (i[k] % 10) > m && i[k] % 10 != 0) {
      m = 10 - (i[k] % 10);
    }
    if (i[k] % 10 != 0) {
      i[k] += 10 - (i[k] % 10);
    }
    a += i[k];
  }
  a -= m;
  cout << a;
  while (true)
    ;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <math.h>
#include <stack>
#include <string>
#include <vector>
// #include<stdlib.h>
using namespace std;

int main() {
  short i[5];
  int a = 0, m = 0;
  for (int k = 0; k < 5; k++) {
    cin >> i[k];
    if (10 - (i[k] % 10) > m && i[k] % 10 != 0) {
      m = 10 - (i[k] % 10);
    }
    if (i[k] % 10 != 0) {
      i[k] += 10 - (i[k] % 10);
    }
    a += i[k];
  }
  a -= m;
  cout << a;
  return 0;
}
Problem p03077 (Python)

Buggy submission (status: Runtime Error):
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 1e6
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)


Fixed submission:
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 1e18
idx = 0
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)
Problem p03077 (Python)

Buggy submission (status: Runtime Error):
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 10
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)


Fixed submission:
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 1e18
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)
Problem p03077 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define clr(a, x) memset(a, x, sizeof(a))
#define SZ(x) ((int)(x).size())
#define lson rt << 1
#define rson rt << 1 | 1
#define pb push_back
#define fi first
#define se second
#define what_is(x) cerr << #x << " " << x << endl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template <typename T> inline void _read(T &x) { cin >> x; }
void R() {}
template <typename T, typename... U> void R(T &head, U &...tail) {
  _read(head);
  R(tail...);
}

template <typename T> inline void _write(const T &x) { cout << x << ' '; }
void W() { cout << endl; }
template <typename T, typename... U> void W(const T &head, const U &...tail) {
  _write(head);
  W(tail...);
}

void go();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  go();
  return 0;
}
/****************ackun*********************/

void go() {
  int n;
  R(n);
  ll mi = 1e16;
  rep(i, 1, 5) {
    ll x;
    R(x);
    mi = min(mi, x);
  }
  ll ans = 5;
  n -= mi;
  if (n > 0) {
    ans += n / mi;
    if ((n % mi) != 0) {
      ans++;
    }
  }
  W(ans);
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define clr(a, x) memset(a, x, sizeof(a))
#define SZ(x) ((int)(x).size())
#define lson rt << 1
#define rson rt << 1 | 1
#define pb push_back
#define fi first
#define se second
#define what_is(x) cerr << #x << " " << x << endl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template <typename T> inline void _read(T &x) { cin >> x; }
void R() {}
template <typename T, typename... U> void R(T &head, U &...tail) {
  _read(head);
  R(tail...);
}

template <typename T> inline void _write(const T &x) { cout << x << ' '; }
void W() { cout << endl; }
template <typename T, typename... U> void W(const T &head, const U &...tail) {
  _write(head);
  W(tail...);
}

void go();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  go();
  return 0;
}
/****************ackun*********************/

void go() {
  ll n;
  R(n);
  ll mi = 1e16;
  rep(i, 1, 5) {
    ll x;
    R(x);
    mi = min(mi, x);
  }
  ll ans = 5;
  n -= mi;
  if (n > 0) {
    ans += n / mi;
    if ((n % mi) != 0) {
      ans++;
    }
  }
  W(ans);
}
Problem p03077 (C++)

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

int main() {
  ll N;
  vector<int> maxs(5);
  cin >> N;
  rep(i, 5) cin >> maxs[i];

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

  ll res = 5;
  if (N % maxs[0])
    res += ll(N / maxs[0]);
  else if (N > maxs[0])
    res += N / maxs[0] - 1;

  cout << res << endl;
  return 0;
}

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

int main() {
  ll N;
  vector<ll> maxs(5);
  cin >> N;
  rep(i, 5) cin >> maxs[i];

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

  ll res = 5;
  if (N % maxs[0])
    res += ll(N / maxs[0]);
  else if (N > maxs[0])
    res += N / maxs[0] - 1;

  cout << res << endl;
  return 0;
}