Problem p03105 (C++)

Buggy submission (status: Runtime Error):
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include <algorithm>
#include <bits/stdc++.h>
#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 <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

#define ll long long
#define pb push_back
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
// mp::cpp_int

int solve() {

  int a, b, n;
  cin >> a >> b >> n;

  cout << min(b / a, n);

  return 0;
}
int main() {
  int t = 1;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  clock_t time_req;

  // Without using pow function
  time_req = clock();

  // cin>>t;
  while (t--) {
    solve();
  }

  time_req = clock() - time_req;
  // cout << "Processor time taken is "
  // << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;

  return 0;
}


Fixed submission:
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include <algorithm>
#include <bits/stdc++.h>
#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 <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

#define ll long long
#define pb push_back
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
// mp::cpp_int

int solve() {

  int a, b, n;
  cin >> a >> b >> n;

  cout << min(b / a, n);

  return 0;
}
int main() {
  int t = 1;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  clock_t time_req;

  // Without using pow function
  time_req = clock();

  // cin>>t;
  while (t--) {
    solve();
  }

  time_req = clock() - time_req;
  // cout << "Processor time taken is "
  // << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;

  return 0;
}