Problem p02922 (C++)

Buggy submission (status: Runtime Error):
#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>
#define ull unsigned long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, j, n) for (int i = j; i < n; i++)
#define RFOR(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;                                                            \
  }                                                                            \
  value
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << ceil((a - 1) / (b - 1)) << endl;
}

Fixed submission:
#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>
#define ull unsigned long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, j, n) for (int i = j; i < n; i++)
#define RFOR(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;                                                            \
  }                                                                            \
  value
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  int ans = 0, C = 1;
  while (C < b) {
    C += a - 1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}