Problem p02718 (C++) — buggy submission, verdict: Runtime Error

/*
--> WHEN IT'S OBVIOUS THAT THE GOAL CANNOT BE REACHED,
        DON'T ADJUST THE GOALS,
        ADJUST THE ACTION STEPS.

--> THE WAY YOU CONQUER SELF-DOUBT IS BY DOING THINGS THAT MAKE YOU
UNCOMFORTABLE.

--> IT IS DURING OUR DARKEST MOMENTS WE MUST FOCUS TO SEE LIGHT.
*/

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortAll(x) sort(all(x))
#define sz(x) (int)x.size()
#define clr(x) memset(x, 0, sizeof(x))
#define PI 3.1415926535897932384626
#define FAST                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);                                                              \\
  IO();
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

const int MOD = 1e9 + 7;

ll power(ll a, ll b) {
  ll ans = 1;

  while (b > 0) {
    if (b & 1)
      ans *= a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}

ll powm(ll a, ll b) {
  a %= MOD;
  ll ans = 1;

  while (b > 0) {
    if (b & 1)
      ans = (ans * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return ans;
}

void IO() {
#ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
#endif
}

//================================

int main() {
  // FAST;

  int n, m;
  cin >> n >> m;

  double A[n], sum = 0;
  for (double &x : A) {
    cin >> x;
    sum += x;
  }

  double x = (1.0 / (4.0 * double(m))) * sum;
  double cnt = 0;
  for (int i = 0; i < n; i++)
    if (A[i] >= x)
      cnt++;

  if (cnt >= m)
    cout << "Yes\\n";
  else
    cout << "No\\n";
  return 0;
}

Error: -11

Fixed submission:

/*
--> WHEN IT'S OBVIOUS THAT THE GOAL CANNOT BE REACHED,
        DON'T ADJUST THE GOALS,
        ADJUST THE ACTION STEPS.

--> THE WAY YOU CONQUER SELF-DOUBT IS BY DOING THINGS THAT MAKE YOU
UNCOMFORTABLE.

--> IT IS DURING OUR DARKEST MOMENTS WE MUST FOCUS TO SEE LIGHT.
*/

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortAll(x) sort(all(x))
#define sz(x) (int)x.size()
#define clr(x) memset(x, 0, sizeof(x))
#define PI 3.1415926535897932384626
#define FAST                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);                                                              \\
  IO();
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

const int MOD = 1e9 + 7;

ll power(ll a, ll b) {
  ll ans = 1;

  while (b > 0) {
    if (b & 1)
      ans *= a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}

ll powm(ll a, ll b) {
  a %= MOD;
  ll ans = 1;

  while (b > 0) {
    if (b & 1)
      ans = (ans * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return ans;
}

void IO() {
#ifndef ONLINE_JUDGE
  freopen("Input.txt", "r", stdin);
  freopen("Output.txt", "w", stdout);
#endif
}

//================================

int main() {
  FAST;

  int n, m;
  cin >> n >> m;

  int A[n], sum = 0;
  for (int &x : A) {
    cin >> x;
    sum += x;
  }

  int x = (1.0 / (4.0 * double(m))) * sum;
  int cnt = 0;
  for (int i = 0; i < n; i++)
    if (A[i] >= x)
      cnt++;

  if (cnt >= m)
    cout << "YES\\n";
  else
    cout << "NO\\n";
  return 0;
}