Language: C++

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma region Macros
/***
 * @author uesugi
 * @file AtCoder用テンプレート
 */

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define _OVERLOAD3(_1, _2, _3, name, ...) name
#define _REP(i, n) REPI(i, 0, n)
#define REPI(i, a, b) for (int i = int(a), i##_len = (b); i < i##_len; ++i)
#define REP(...)                          \
    _OVERLOAD3(__VA_ARGS__, REPI, _REP, ) \
    (__VA_ARGS__)

#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

/**
 * 最大値更新
 * @param T &a 更新対象
 * @param const T &b 判定対象
 * @return 更新有無
 */
template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

/**
 * 最小値更新
 * @param T &a 更新対象
 * @param const T &b 判定対象
 * @return 更新有無
 */
template <class T>
inline bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

/**
 * overload
 * 入力を配列に格納
 * 配列の長さ分入力を格納
 * @param std::istream &is 入力ストリーム
 * @param std::vector<T> &vec 格納先配列
 * @return std::istream 
 */
template <typename T>
inline std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element : vec) {
        is >> element;
    }
    return is;
}

template <typename T1, typename T2>
inline std::istream &operator>>(std::istream &is, std::pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}

/**
 * overload
 * コンテナの要素を出力する
 * @param std::basic_ostream<Ch, Tr> &os 出力ストリーム
 * @param Container const &x 出力対象コンテナ
 * @return std::basic_ostream<Ch, Tr> 
 */
template <class Ch, class Tr, class Container>
inline std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define DEBUG_1(x1) cout << #x1 << ": " << x1 << "\n"
#define DEBUG_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << "\n"
#define DEBUG_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << "\n"
#define DEBUG_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << "\n"
#define DEBUG_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << "\n"
#ifdef _DEBUG
/**
 * デバッグ用出力メソッド
 * 変数名及び値を出力
 * -D_DEBUG オプション付きビルド時のみ有効
 * @param 可変長引数
 */
#define DEBUG(...)                                                        \
    CHOOSE((__VA_ARGS__, DEBUG_5, DEBUG_4, DEBUG_3, DEBUG_2, DEBUG_1, ~)) \
    (__VA_ARGS__)

#define SET_START_TIME() clock()
#define DEBUG_TIME() cout << "debug_time: " << clock() - START_TIME << "\n"
clock_t START_TIME;
#else
#define DEBUG(...)
#define SET_START_TIME()
#endif

#pragma endregion

int r[100001];
/**
 * 処理
 * @return void
 */
void Main() {
    int N, M;
    cin >> N >> M;
    vi h(N);
    cin >> h;
    vector<pair<int, int>> ab(M);
    cin >> ab;
    DEBUG_TIME();

    memset(r, 0, sizeof(r));
    vector<bool> rr(N, true);
    int buffFirst;
    int buffSecond;
    REP(i, M) {
        buffFirst = ab[i].first - 1;
        buffSecond = ab[i].second - 1;

        if (rr[buffFirst] && h[buffFirst] <= h[buffSecond]) {
            rr[buffFirst] = false;
        }
        if (rr[buffSecond] && h[buffSecond] <= h[buffFirst]) {
            rr[buffSecond] = false;
        }
    }
    DEBUG_TIME();
    int count = 0;
    REP(i, N) {
        if (rr[i]) {
            count++;
        }
    }
    cout << count;
    DEBUG_TIME();
}

#pragma region main
/**
 * main
 * 共通処理
 * @return signed
 */
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << std::fixed;
    cout.precision(20);
    START_TIME = SET_START_TIME();
    Main();
    cout << flush;
}
#pragma endregion


Compiler output:
a.cc: In function 'void Main()':
a.cc:144:5: error: 'DEBUG_TIME' was not declared in this scope; did you mean 'DEBUG_2'?
  144 |     DEBUG_TIME();
      |     ^~~~~~~~~~
      |     DEBUG_2
a.cc: In function 'int main()':
a.cc:183:5: error: 'START_TIME' was not declared in this scope
  183 |     START_TIME = SET_START_TIME();
      |     ^~~~~~~~~~
a.cc:183:34: error: expected primary-expression before ';' token
  183 |     START_TIME = SET_START_TIME();
      |                                  ^
a.cc: In instantiation of 'std::istream& operator>>(std::istream&, std::vector<_Tp>&) [with T = std::pair<long long int, long long int>; std::istream = std::basic_istream<char>]':
a.cc:143:12:   required from here
  143 |     cin >> ab;
      |            ^~
a.cc:70:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::pair<long long int, long long int>')
   70 |         is >> element;
      |         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:9:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:24: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'bool&'
  170 |       operator>>(bool& __n)
      |                  ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:25: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'short int&'
  174 |       operator>>(short& __n);
      |                  ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:34: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'short unsigned int&'
  177 |       operator>>(unsigned short& __n)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:23: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'int&'
  181 |       operator>>(int& __n);
      |                  ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:32: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'unsigned int&'
  184 |       operator>>(unsigned int& __n)
      |                  ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:24: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'long int&'
  188 |       operator>>(long& __n)
      |                  ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:33: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'long unsigned int&'
  192 |       operator>>(unsigned long& __n)
      |                  ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:29: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'long long int&'
  199 |       operator>>(long long& __n)
      |                  ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:38: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'long long unsigned int&'
  203 |       operator>>(unsigned long long& __n)
      |                  ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:25: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'float&'
  219 |       operator>>(float& __f)
      |                  ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  223 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:223:26: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'double&'
  223 |       operator>>(double& __f)
      |                  ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  227 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:227:31: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'long double&'
  227 |       operator>>(long double& __f)
      |                  ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:25: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'void*&'
  328 |       operator>>(void*& __p)
      |                  ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:122:36: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
  126 |       operator>>(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:126:32: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
  126 |       operator>>(__ios_type& (*__pf)(__ios_type&))
      |                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  133 |       operator>>(ios_base& (*__pf)(io