Problem p03601 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define umax(x, y) x = max(x, y)
#define umin(x, y) x = min(x, y)
#define ll long long
#define ii pair<int, int>
#define iii pair<ii, int>
#define iiii pair<ii, ii>
#define sz(x) ((int)x.size())
#define orta ((bas + son) / 2)
#define all(x) x.begin(), x.end()
#define dbgs(x) cerr << (#x) << " --> " << (x) << " "
#define dbg(x)                                                                 \
  cerr << (#x) << " --> " << (x) << endl;                                      \
  getchar()
#define pw(x) (1ll << (x))
#define inf 100000000000000008
#define MOD 998244352
#define N 100005
#define M 1000003
#define C 100000
#define lab(i, j) (((i - 1) * m) + j)
#define LOG 19
#define KOK 650
#define EPS 0.0001
using namespace std;

int a, b, c, d, e, f;
int oks[3005], okw[3005];

int main() {

  freopen("input.txt", "r", stdin);

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  cin >> a >> b >> c >> d >> e >> f;

  okw[0] = oks[0] = 1;

  for (int i = 1; i <= f; i++) {

    okw[i] |= (i - a >= 0 ? okw[i - a] : 0) | (i - b >= 0 ? okw[i - b] : 0);
    oks[i] |= (i - c >= 0 ? oks[i - c] : 0) | (i - d >= 0 ? oks[i - d] : 0);
  }

  double ans = 0;
  int t1 = a, t2 = 0;

  for (int i = f; i >= 0; i--) {

    for (int j = f; j >= 0; j--) {

      if (i == 0 && j == 0)
        continue;

      if (oks[i] && okw[j] && i + j * 100 <= f && j * e >= i) {

        if (100.0 * i / (i + j * 100) > ans) {

          ans = 100.0 * i / (i + j * 100);
          t1 = j;
          t2 = i;
        }
      }
    }
  }

  cout << t1 * 100 + t2 << " " << t2;
}

Fixed submission:
#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define umax(x, y) x = max(x, y)
#define umin(x, y) x = min(x, y)
#define ll long long
#define ii pair<int, int>
#define iii pair<ii, int>
#define iiii pair<ii, ii>
#define sz(x) ((int)x.size())
#define orta ((bas + son) / 2)
#define all(x) x.begin(), x.end()
#define dbgs(x) cerr << (#x) << " --> " << (x) << " "
#define dbg(x)                                                                 \
  cerr << (#x) << " --> " << (x) << endl;                                      \
  getchar()
#define pw(x) (1ll << (x))
#define inf 100000000000000008
#define MOD 998244352
#define N 100005
#define M 1000003
#define C 100000
#define lab(i, j) (((i - 1) * m) + j)
#define LOG 19
#define KOK 650
#define EPS 0.0001
using namespace std;

int a, b, c, d, e, f;
int oks[3005], okw[3005];

int main() {

  //	freopen("input.txt","r",stdin);

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  cin >> a >> b >> c >> d >> e >> f;

  okw[0] = oks[0] = 1;

  for (int i = 1; i <= f; i++) {

    okw[i] |= (i - a >= 0 ? okw[i - a] : 0) | (i - b >= 0 ? okw[i - b] : 0);
    oks[i] |= (i - c >= 0 ? oks[i - c] : 0) | (i - d >= 0 ? oks[i - d] : 0);
  }

  double ans = 0;
  int t1 = a, t2 = 0;

  for (int i = f; i >= 0; i--) {

    for (int j = f; j >= 0; j--) {

      if (i == 0 && j == 0)
        continue;

      if (oks[i] && okw[j] && i + j * 100 <= f && j * e >= i) {

        if (100.0 * i / (i + j * 100) > ans) {

          ans = 100.0 * i / (i + j * 100);
          t1 = j;
          t2 = i;
        }
      }
    }
  }

  cout << t1 * 100 + t2 << " " << t2;
}