Language: C++

#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(ll i = 0; i<n; i++)
#define rep_s(i, start, n) for(ll i= start;  i<n; i++)
#define rep_down(i, n) for(ll i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(ll i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()
#define print(ans) cout << ans << endl;
#define MOD 1000000007
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll keta_num(ll num){
  ll total = 0;
  while(num){
    num /= 10;
    total++;
  }
}


ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

ll fibonacchi(ll num){
  ll f0 = 0, f1 = 1, f2;
  ll count = 0;
  while(count<num){
    f2 = f0+f1;
    f0 = f1;
    f1 = f2;
    count++;
  }
  return f2;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(ll i = 0; i<n; i++)
#define rep_s(i, start, n) for(ll i= start;  i<n; i++)
#define rep_down(i, n) for(ll i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(ll i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()
#define print(ans) cout << ans << endl;
#define MOD 1000000007
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll keta_num(ll num){
  ll total = 0;
  while(num){
    num /= 10;
    total++;
  }
}


ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

ll fibonacchi(ll num){
  ll f0 = 0, f1 = 1, f2;
  ll count = 0;
  while(count<num){
    f2 = f0+f1;
    f0 = f1;
    f1 = f2;
    count++;
  }
  return f2;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B;
  string S, T;
  cin >> N >> M;
  ll h[N];
  rep(i, N) cin >> h[i];
  int road[N][N] = {}, used[N] = {};
  map<int, vector<int>> road2;
  rep(i, M){
    cin >> A >> B;
    road2[A-1].push_back(B-1);
    road2[B-1].push_back(A-1);
  }
  ll ans = 0;
  rep(i, N){
    /*
    rep(j, road2[i].size()){
      cout <<"i: " << i << ", j: " << j << ", road2: " <<road2[i][j] << " ";
    }
    cout << endl;
    */
    if (road2[i].size() == 0) {ans++; continue;}
    if (used[i] == 1) continue;
    rep(j, road2[i].size()){
      if (h[i] > h[road2[i][j]]) used[road2[i][j]] = 1;
      else{
          //cout <<"i: " << i << ", j: " << j << ", road2: " <<road2[i][j] << ", h[road2[i][j]]: " << h[road2[i][j]]<< endl;
          break;
      }
      if (j == road2[i].size()-1){
        //cout << j << endl;
        ans++;
      }
    }
  }
  cout << ans << endl;
    
   



}


int main(void){
  ll N, M, A, B;
  string S, T;
  cin >> N >> M;
  int h[N];
  rep(i, N) cin >> h[i];
  ll road[N][N] = {}, used[N] = {};
  map<int, vector<ll>> road2;
  rep(i, M){
    cin >> A >> B;
    road2[A-1].push_back(B-1);
    road2[B-1].push_back(A-1);
  }
  ll ans = 0;
  rep(i, N){
    /*
    rep(j, road2[i].size()){
      cout <<"i: " << i << ", j: " << j << ", road2: " <<road2[i][j] << " ";
    }
    cout << endl;
    */
    if (road2[i].size() == 0) {ans++; continue;}
    if (used[i] == 1) continue;
    rep(j, road2[i].size()){
      if (h[i] > h[road2[i][j]]) used[road2[i][j]] = 1;
      else{
          //cout <<"i: " << i << ", j: " << j << ", road2: " <<road2[i][j] << ", h[road2[i][j]]: " << h[road2[i][j]]<< endl;
          break;
      }
      if (j == road2[i].size()-1){
        //cout << j << endl;
        ans++;
      }
    }
  }
  cout << ans << endl;
    
   



}


Compiler output:
a.cc:141:3: error: stray '#' in program
  141 | };#include <bits/stdc++.h>
      |   ^
a.cc: In function 'll keta_num(ll)':
a.cc:61:1: warning: no return statement in function returning non-void [-Wreturn-type]
   61 | }
      | ^
a.cc: At global scope:
a.cc:141:4: error: 'include' does not name a type
  141 | };#include <bits/stdc++.h>
      |    ^~~~~~~
a.cc:158:8: error: redefinition of 'std::string alphabet_upper'
  158 | string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      |        ^~~~~~~~~~~~~~
a.cc:18:8: note: 'std::string alphabet_upper' previously declared here
   18 | string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      |        ^~~~~~~~~~~~~~
a.cc:159:8: error: redefinition of 'std::string alphabet_lower'
  159 | string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
      |        ^~~~~~~~~~~~~~
a.cc:19:8: note: 'std::string alphabet_lower' previously declared here
   19 | string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
      |        ^~~~~~~~~~~~~~
a.cc:160:8: error: redefinition of 'std::string numbers'
  160 | string numbers = "0123456789";
      |        ^~~~~~~
a.cc:20:8: note: 'std::string numbers' previously declared here
   20 | string numbers = "0123456789";
      |        ^~~~~~~
a.cc:185:5: error: redefinition of 'int keta_sum(int)'
  185 | int keta_sum(int num){
      |     ^~~~~~~~
a.cc:45:5: note: 'int keta_sum(int)' previously defined here
   45 | int keta_sum(int num){
      |     ^~~~~~~~
a.cc:195:4: error: redefinition of 'll keta_num(ll)'
  195 | ll keta_num(ll num){
      |    ^~~~~~~~
a.cc:55:4: note: 'll keta_num(ll)' previously defined here
   55 | ll keta_num(ll num){
      |    ^~~~~~~~
a.cc: In function 'll keta_num(ll)':
a.cc:201:1: warning: no return statement in function returning non-void [-Wreturn-type]
  201 | }
      | ^
a.cc: At global scope:
a.cc:204:4: error: redefinition of 'll binary_search(ll, ll, ll, ll)'
  204 | ll binary_search(ll left_key, ll border, ll low, ll high) {
      |    ^~~~~~~~~~~~~
a.cc:64:4: note: 'll binary_search(ll, ll, ll, ll)' previously defined here
   64 | ll binary_search(ll left_key, ll border, ll low, ll high) {
      |    ^~~~~~~~~~~~~
a.cc:219:6: error: redefinition of 'bool IsPrime(ll)'
  219 | bool IsPrime(ll a){
      |      ^~~~~~~
a.cc:79:6: note: 'bool IsPrime(ll)' previously defined here
   79 | bool IsPrime(ll a){
      |      ^~~~~~~
a.cc:228:4: error: redefinition of 'll gcd(ll, ll)'
  228 | ll gcd(ll a, ll b){
      |    ^~~
a.cc:88:4: note: 'll gcd(ll, ll)' previously defined here
   88 | ll gcd(ll a, ll b){
      |    ^~~
a.cc:245:4: error: redefinition of 'll fibonacchi(ll)'
  245 | ll fibonacchi(ll num){
      |    ^~~~~~~~~~
a.cc:105:4: note: 'll fibonacchi(ll)' previously defined here
  105 | ll fibonacchi(ll num){
      |    ^~~~~~~~~~
a.cc:257:8: error: redefinition of 'struct UnionFind'
  257 | struct UnionFind {
      |        ^~~~~~~~~
a.cc:117:8: note: previous definition of 'struct UnionFind'
  117 | struct UnionFind {
      |        ^~~~~~~~~
a.cc:327:5: error: redefinition of 'int main()'
  327 | int main(void){
      |     ^~~~
a.cc:283:5: note: 'int main()' previously defined here
  283 | int main(void){
      |     ^~~~