Problem p02772 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
#define fl(i, a, n) for (int i = a; i <= n; i++)
#define pb push_back
#define pob pop_back
#define int long long int
#define ff first
#define ss second
#define pi 3.1415926535898
#define vi vector<int>
#define mi map<int, int>
#define umi unordered_map<int, int>
#define endl "\n"
#define w(x)                                                                   \
  int x;                                                                       \
  cin >> x;                                                                    \
  while (x--)
#define db(x) cout << (#x) << " " << (x) << "\n";
#define ios                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
using namespace std;
// using namespace boost::multiprecision;
int mod = 1000000007;
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int32_t main() {

  ios c_p_c();
  // w(t)
  {
    int n;
    cin >> n;
    fl(i, 0, n - 1) {
      int d;
      cin >> d;
      if (d % 2 == 0) {
        if (d % 3 == 0 or d % 5 == 0) {
          continue;
        } else {
          cout << "DENIED\n";
          return 0;
        }
      }
    }
    cout << "APPROVED\n";
  }

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
#define fl(i, a, n) for (int i = a; i <= n; i++)
#define pb push_back
#define pob pop_back
#define int long long int
#define ff first
#define ss second
#define pi 3.1415926535898
#define vi vector<int>
#define mi map<int, int>
#define umi unordered_map<int, int>
#define endl "\n"
#define w(x)                                                                   \
  int x;                                                                       \
  cin >> x;                                                                    \
  while (x--)
#define db(x) cout << (#x) << " " << (x) << "\n";
#define ios                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
using namespace std;
// using namespace boost::multiprecision;
int mod = 1000000007;
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int32_t main() {

  ios
  // c_p_c();
  // w(t)
  {
    int n;
    cin >> n;
    fl(i, 0, n - 1) {
      int d;
      cin >> d;
      if (d % 2 == 0) {
        if (d % 3 == 0 or d % 5 == 0) {
          continue;
        } else {
          cout << "DENIED\n";
          return 0;
        }
      }
    }
    cout << "APPROVED\n";
  }

  return 0;
}