Problem p02659 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li long
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pii pair<int, int>
#define pli pair<li, li>
#define pll pair<ll, ll>
#define pb push_back
#define fori(i, k, n) for (int i = k; i < n; i++)
#define rfori(i, k, n) for (int i = k; i >= n; i--)
#define tc                                                                     \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define all(v) v.begin(), v.end()
#define inf INT_MAX
#define ninf INT_MIN
#define W(x) cout << x << endl
#define WW(x, y) cout << x << ' ' << y << endl;
#define in(x) cin >> x
// #define int long long
const ll mod = 998244353;
const ll mod2 = 1e9 + 7;
template <class T>
using oset =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
template <class T> T power(T a, T b) {
  T res = (T)1;
  while (b > 0) {
    if (b & 1)
      res = res * a;
    b >>= 1;
    a *= a;
  }
  return res;
}
struct Node {
  int first;
  int second;
  Node(int x, int y) {
    this->first = x;
    this->second = y;
  }
};
struct comparator {
  bool operator()(const Node &a, const Node &b) {
    int lena = a.second - a.first + 1;
    int lenb = b.second - b.first + 1;
    if (lena == lenb)
      return a.first < b.first;
    else
      return lena > lenb;
  }
};
ll power(ll x, ll y, ll mod) {
  ll res = 1;
  x %= mod;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % mod;
    y >>= 1;
    x = (x * x) % mod;
  }
  return res;
}

signed main() {
  int a;
  string b;
  cin >> a >> b;
  string x;
  for (int i = 0; i < b.size(); i++)
    if (b[i] != '.')
      x += b[i];
  int num = stoll(x);
  cout << (a * num) / 100 << "\n";
}

Fixed submission:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li long
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pii pair<int, int>
#define pli pair<li, li>
#define pll pair<ll, ll>
#define pb push_back
#define fori(i, k, n) for (int i = k; i < n; i++)
#define rfori(i, k, n) for (int i = k; i >= n; i--)
#define tc                                                                     \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define all(v) v.begin(), v.end()
#define inf INT_MAX
#define ninf INT_MIN
#define W(x) cout << x << endl
#define WW(x, y) cout << x << ' ' << y << endl;
#define in(x) cin >> x
// #define int long long
const ll mod = 998244353;
const ll mod2 = 1e9 + 7;
template <class T>
using oset =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
template <class T> T power(T a, T b) {
  T res = (T)1;
  while (b > 0) {
    if (b & 1)
      res = res * a;
    b >>= 1;
    a *= a;
  }
  return res;
}
struct Node {
  int first;
  int second;
  Node(int x, int y) {
    this->first = x;
    this->second = y;
  }
};
struct comparator {
  bool operator()(const Node &a, const Node &b) {
    int lena = a.second - a.first + 1;
    int lenb = b.second - b.first + 1;
    if (lena == lenb)
      return a.first < b.first;
    else
      return lena > lenb;
  }
};
ll power(ll x, ll y, ll mod) {
  ll res = 1;
  x %= mod;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % mod;
    y >>= 1;
    x = (x * x) % mod;
  }
  return res;
}

signed main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long a = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
  n *= a;
  cout << n / 100;
  return 0;
}