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

#include <bits/stdc++.h>

#define sf scanf
#define pf printf
#define pb push_back
#define sz 200005
#define MOD 1000000007
#define READ freopen("in.txt", "r", stdin);
#define WRITE freopen("out.txt", "w", stdout);
#define optimize                                                               \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);

using namespace std;

typedef long long int ll;

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};

int main() {
  // READ

  ll a;
  long double b;

  cin >> a >> b;

  ll ans = a * b;

  cout << ans << endl;

  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>

#define sf scanf
#define pf printf
#define pb push_back
#define sz 200005
#define MOD 1000000007
#define READ freopen("in.txt", "r", stdin);
#define WRITE freopen("out.txt", "w", stdout);
#define optimize                                                               \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);

using namespace std;

typedef long long int ll;

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};

inline string tstring(ll a) {
  stringstream ss;
  ss << a;
  string str = ss.str();
  return str;
}
inline ll to(string a) {
  stringstream ss(a);
  ll x;
  ss >> x;
  return x;
}

ll func(string b, ll n) {
  string ans = "";
  ll prev = 0;

  for (int i = b.size() - 1; i >= 0; i--) {
    if (b[i] == '.')
      continue;

    ll x = b[i] - '0';

    ll num = x * n + prev;

    if (num > 10) {
      prev = num / 10;
      ans += ((num % 10ll) + '0');
    } else {
      ans += (num + '0');
    }
  }

  if (prev)
    ans += (prev + '0');

  reverse(ans.begin(), ans.end());

  return to(ans);
}

int main() {
  // READ

  ll n, ans = 0, cn = 1, flag = 1;
  string b;

  cin >> n >> b;

  while (n) {
    ans += func(b, n % 10) * cn;

    cn = (cn * 10);

    n /= 10ll;
  }

  string x = tstring(ans);

  for (int i = 0; i < x.size() - 2; i++) {
    flag = 0;
    cout << x[i];
  }

  if (flag)
    cout << 0 << endl;

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF (1 << 30) - 1
using ll = long long;
using namespace std;
template <class T> inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a;
  cin >> a;
  string b;
  cin >> b;
  ll ans = 0;
  ans += a * (b[0] - '0') * 100;
  ans += a * (b[2] - '0') * 10;
  ans += a * (b[3] - '0');
  cout << ans / 100;
  cout << "\\n";
  return 0;
}


Error: WA

Fixed submission:

#include <algorithm> //sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include <bits/stdc++.h>
#include <cmath> //切り上げceil(値)
#include <deque>
#include <iomanip> //setprecision(数字)
#include <iostream>
#include <list>
#include <map>
#include <numeric>
// xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include <queue> //priority_queue<型名> 変数
#include <set>
#include <stack>
#include <string> //変数.substr(どこから,いくつ)
#include <vector>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; 0 <= i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define INF 1e9
using ll = long long;
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;
}

int main() {
  int n;
  cin >> n;
  vll a(n);
  rep(i, n) cin >> a[i];
  ll ans = 1;
  sort(all(a));
  rep(i, n) {
    ans *= a[i];
    if (1e17 < ans) {
      cout << -1;
      return 0;
    }
  }

  cout << ans;
  cout << "\\n";
  return 0;
}
Problem p02659 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {

  long long A;
  string _B;
  long long B;

  cin >> A >> _B;
  B = (_B.at(0) - '0') * 100 + (_B.at(2) - '0') * 10 + (_B.at(3) - '0');

  cout << A * B / 100 << endl;
}


Error: TLE

Fixed submission:

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

int main() {

  double _B;
  long long B;
  long long A;
  long long C;
  cin >> A >> _B;

  //_B = 100 * _B;
  // B  = _B;

  double _C = 0;
  for (long long i = 0; i < A; i++) {
    _C += _B;
  }

  cout << (long long)_C << endl;

  // C = A * B;
  // C = C / 100;
  // cout << C << endl;
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

int main() {
  long double a, b;
  cin >> a >> b;
  cout << (ll)floor(a * b) << endl;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

int main() {
  ll n, i;
  cin >> n;
  ll arr[n];
  unsigned long long int p = 1000000000000000000;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  ll flag = 0;
  for (i = 0; i < n; i++) {

    if (arr[i] == 0) {

      flag = 1;
      break;
    }
  }
  if (flag) {

    cout << 0 << endl;
    return 0;
  }
  unsigned long long int x = 1;
  for (i = 0; i < n; i++) {
    x *= arr[i];
    if (x > p) {
      cout << "-1" << endl;
      return 0;
    }
  }
  cout << x << endl;
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll A;
  string B;
  cin >> A >> B;
  // Bから小数点を除くことで100倍の値にする
  B.erase(1, 1);
  ll num_b = stoi(B);
  ll ans = A * num_b;
  // Bが100倍になっているので100で割る
  ans /= 100;
  cout << ans << "\\n";
}


Error: -6
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi


Fixed submission:

#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll A;
  string B;
  cin >> A >> B;
  // Bから小数点を除くことで100倍の値にする
  string new_B = "";
  new_B += B[0] + B[2] + B[3];
  ll num_b = stoi(new_B);
  ll ans = A * num_b;
  // Bが100倍になっているので100で割る
  ans /= 100;
  cout << ans << "\\n";
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int, int>;
using pq = priority_queue<int>;
typedef long long ll;

int main() {
  ll a;
  string b;
  cin >> a >> b;
  int ib = ((b[0] - 48) * 100) + ((b[2] - 48) * 10) + ((b[3] - 48) * 1);
  // printf("%lld", (ll)(a*b / 100));
  printf("%lld", (ll)a * ib / 100);
  return (0);
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int, int>;
using pq = priority_queue<int>;
typedef long long ll;
string yes = "Yes\\n";
string no = "No\\n";

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  ll sum = 1;
  rep(i, n) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  rep(i, n) {
    sum *= a[i];
    if (sum * a[i + 1] < sum) {
      cout << -1;
      return 0;
    }
  }
  cout << sum << endl;
  return 0;
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  scanf("%lld %lld.%lld", &a, &b, &c);
  long long sum = a * (b * 100 + c) / 100;
  cout << sum;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  scanf("%lld %lld.%lld", a, b, c);
  long long sum = a * (b * 100 + c) / 100;
  cout << sum;
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits.h>
#include <map>
#include <utility>
#include <vector>
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
  ll a;
  cin >> a;
  string s;
  cin >> s;
  cout << a * stoi(s.substr(0, 1) + s.substr(2, 2)) / 100 << endl;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits.h>
#include <map>
#include <utility>
#include <vector>
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
  int a;
  cin >> a;
  string s;
  cin >> s;
  cout << a * stoi(s.substr(0, 1) + s.substr(2, 2)) / 100 << endl;
}
Problem p02659 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  long long a, c;
  double b;

  cin >> a >> b;
  c = a * llround(b * 100);
  cout << c / 100 << "\\n";
}

Error: TLE

Fixed submission:

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

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

  int j = 0;
  c = b;
  while (b != c) {
    b *= 10;
    c = b;
    j++;
  }
  s = to_string(a * c);
  if (s.length() > j) {
    cout << s.substr(0, s.length() - j) << endl;
  } else {
    cout << "0" << endl;
  }
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using Graph = vector<vector<int>>;
using ll = long long;

int main() {
  ll a;
  cin >> a;
  double b;
  cin >> b;
  ll ib = b * 100 + 0.1;
  a *= ib;
  a /= 100;
  cout << a << endl;
}

Error: WA

Fixed submission:

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

int main() {
  unsigned long long N;
  cin >> N;
  unsigned long long ans = 1;
  vector<unsigned long long> A(N);
  rep(i, N) { cin >> A.at(i); }
  rep(i, N) {
    if (A.at(i) == 0) {
      ans *= 0;
      break;
    }
    ans *= A.at(i);
  }
  if (ans > 1000000000000000000) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sayyes cout << "Yes" << endl;
#define sayno cout << "No" << endl;
using namespace std;
typedef long long ll;
const double PI = acos(-1);
typedef pair<int, int> P;
const int mod = 1e9 + 7;

int main() {
  ll a;
  double b;
  cin >> a >> b;
  ll ib = b * 100 + 0.5;
  a *= ib;
  a /= 100;
  cout << a;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for (int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll line = (ll)pow(10, 18);

int main() {
  ll N;
  cin >> N;
  vl A(N);
  rep(i, N) cin >> A[i];

  stable_sort(A.begin(), A.end());

  if (A[0] == 0) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 1;
  ll tmp;

  rep(i, N) {
    if (ans > line / A[i]) {
      cout << -1 << endl;
      return 0;
    }

    ans *= A[i];
  }

  cout << ans << endl;

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

#include <cstdio>

typedef long long ll;

int main() {
  ll a, b, c;
  scanf("%lld %lld.%lld", &a, &b, &c);

  ll part1 = a * b;
  ll part2 = a * c;

  part1 = part1 + (part2 / 100);
  printf("%lld", part1);
}

Error: WA

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
string ADD(string, string);
string MULTIPLE(string, string);
string ADD(string a, string b) {
  string res = "";
  int carryitem = 0;
  int nowitem = 0;
  int a_len = a.length(), b_len = b.length();
  if (a_len < b_len) {
    swap(a, b);
    a_len = a.length();
    b_len = b.length();
  }
  for (int i = a_len - b_len; i > 0; --i) {
    b = '0' + b;
  }
  for (int i = a_len - 1; i >= 0; --i) {
    nowitem = a[i] + b[i] - 2 * '0' + carryitem;
    carryitem = nowitem / 10;
    nowitem %= 10;
    res = static_cast<char>(nowitem + '0') + res;
  }
  if (carryitem) {
    res = static_cast<char>(carryitem + '0') + res;
  }
  return res;
}
string MULTIPLE(string a, string b) {
  string res = "";
  int a_len = a.length(), b_len = b.length();
  if (a_len < b_len) {
    swap(a, b);
    a_len = a.length();
    b_len = b.length();
  }

  for (int i = b_len - 1; i >= 0; --i) {
    string tmp = "";
    for (int j = 0; j < b[i] - '0'; j++) {
      tmp = ADD(tmp, a);
    }
    for (int k = 0; k < b_len - i - 1; k++) {
      tmp += '0';
    }
    res = ADD(res, tmp);
  }
  return res;
}

int main() {

  string a;
  double b;
  cin >> a;
  cin >> b;

  int k = b * 100;

  string ans = MULTIPLE(a, to_string(k));
  for (int i = 0; i < ans.length() - 2; i++) {
    cout << ans[i];
  }
  return 0;
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;
string ADD(string, string);
string MULTIPLE(string, string);
string ADD(string a, string b) {
  string res = "";
  int carryitem = 0;
  int nowitem = 0;
  int a_len = a.length(), b_len = b.length();
  if (a_len < b_len) {
    swap(a, b);
    a_len = a.length();
    b_len = b.length();
  }
  for (int i = a_len - b_len; i > 0; --i) {
    b = '0' + b;
  }
  for (int i = a_len - 1; i >= 0; --i) {
    nowitem = a[i] + b[i] - 2 * '0' + carryitem;
    carryitem = nowitem / 10;
    nowitem %= 10;
    res = static_cast<char>(nowitem + '0') + res;
  }
  if (carryitem) {
    res = static_cast<char>(carryitem + '0') + res;
  }
  return res;
}
string MULTIPLE(string a, string b) {
  string res = "";
  int a_len = a.length(), b_len = b.length();
  if (a_len < b_len) {
    swap(a, b);
    a_len = a.length();
    b_len = b.length();
  }

  for (int i = b_len - 1; i >= 0; --i) {
    string tmp = "";
    for (int j = 0; j < b[i] - '0'; j++) {
      tmp = ADD(tmp, a);
    }
    for (int k = 0; k < b_len - i - 1; k++) {
      tmp += '0';
    }
    res = ADD(res, tmp);
  }
  return res;
}

int main() {

  long long a;
  double b;
  cin >> a;
  cin >> b;

  long long k = (b)*100 + 0.5;

  long long ans = a * k;

  cout << ans / 100;
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
string ADD(string, string);
string MULTIPLE(string, string);
string ADD(string a, string b) {
  string res = "";
  int carryitem = 0;
  int nowitem = 0;
  int a_len = a.length(), b_len = b.length();
  if (a_len < b_len) {
    swap(a, b);
    a_len = a.length();
    b_len = b.length();
  }
  for (int i = a_len - b_len; i > 0; --i) {
    b = '0' + b;
  }
  for (int i = a_len - 1; i >= 0; --i) {
    nowitem = a[i] + b[i] - 2 * '0' + carryitem;
    carryitem = nowitem / 10;
    nowitem %= 10;
    res = static_cast<char>(nowitem + '0') + res;
  }
  if (carryitem) {
    res = static_cast<char>(carryitem + '0') + res;
  }
  return res;
}
string MULTIPLE(string a, string b) {
  string res = "";
  int a_len = a.length(), b_len = b.length();
  if (a_len < b_len) {
    swap(a, b);
    a_len = a.length();
    b_len = b.length();
  }

  for (int i = b_len - 1; i >= 0; --i) {
    string tmp = "";
    for (int j = 0; j < b[i] - '0'; j++) {
      tmp = ADD(tmp, a);
    }
    for (int k = 0; k < b_len - i - 1; k++) {
      tmp += '0';
    }
    res = ADD(res, tmp);
  }
  return res;
}

int main() {

  string a;
  double b;
  cin >> a;
  cin >> b;

  int k = (b)*100 + 0.5;

  string ans = MULTIPLE(a, to_string(k));
  for (int i = 0; i < ans.length() - 2; i++) {
    cout << ans[i];
  }
  return 0;
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (n); i++)
using P = pair<int, int>;
int main() {
  ll a;
  long double b;
  cin >> a >> b;
  ll ans = a * b;
  cout << ans << endl;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 1;
  sort(a.begin(), a.end());
  if (a[0] == 0) {
    cout << 0 << endl;
  } else {
    for (int i = 0; i < n; i++) {
      ll s1 = ans / 1000000000;
      ll s2 = a[i] / 1000000000;
      if (s1 * s2 > 1000000000) {
        ans = -1;
        break;
      }
      ans *= a[i];
      if (ans > 1000000000000000000) {
        ans = -1;
        break;
      }
    }
    cout << ans << endl;
  }
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, j, n) for (int i = j; i < n; i++)
#define rrep(i, j, n) for (int i = j - 1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v)                                                         \\
  rep(__k, v.size()) {                                                         \\
    cout << v[__k];                                                            \\
    if (__k != v.size() - 1)                                                   \\
      cout << " ";                                                             \\
    else                                                                       \\
      cout << endl;                                                            \\
  }
#define YesorNo(a) printf(a ? "Yes\\n" : "No\\n")
#define fi first
#define se second
#define endl "\\n"
using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9 + 7;

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

  Real a, b;
  cin >> a >> b;
  cout << (Bint)(a * b) << endl;
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using Bint = boost::multiprecision::cpp_int;

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

  vector<Bint> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a.begin(), a.end());

  Bint res = 1;
  for (int i = 0; i < n; i++)
    res *= a[i];

  cout << (res > 1000000000000000000 ? -1 : res) << endl;
  return 0;
}
Problem p02659 (C++) — buggy submission, verdict: Runtime Error

#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
#include <string>
using namespace std;
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

int main() {
  Bint A;
  string B;

  cin >> A >> B;

  string B0(B.begin(), B.end() - 3);
  string B1(B.end() - 2, B.end() - 1);
  string B2(B.end() - 1, B.end());

  Bint r0 = A * Bint(B0);
  Bint r1 = A * Bint(B1);
  Bint r2 = A * Bint(B2);
  Bint ret = r2;

  ret = r1 + ret / 10;
  ret = r0 + ret / 10;

  cout << ret << endl;

  return 0;
}


Error: 0

Fixed submission:

#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
#include <string>
using namespace std;
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

int main() {
  Bint A;
  string B;

  cin >> A >> B;

  B.erase(B.end() - 3);

  Bint C(B);

  cout << A * C / 100 << endl;

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

#include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
using namespace std;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a;
  long double b;
  cin >> a >> b;
  ll c = a * b;
  cout << c;
}


Error: WA

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
using namespace std;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a;
  cin >> a;
  ll c = 1;
  ll tmp = pow(10, 18);
  vector<ll> vec(a);
  for (ll i = 0; i < a; ++i)
    cin >> vec[i];
  if (*min_element(vec.begin(), vec.end()) == 0) {
    cout << 0 << "\\n";
    return 0;
  }
  for (auto i : vec) {
    ll temp = c * i;
    if (c > tmp || temp > tmp) {
      cout << "-1\\n";
      return 0;
    }
    c = tmp;
  }
  cout << c << "\\n";
}