func_code_string: #include <bits/stdc++.h>   using namespace std;   void _R(int &x) { scanf( %d , &x); }   void _R(long long &x) { scanf( %lld , &x); }   void _R(double &x) { scanf( %lf , &x); }   void _R(char &x) { scanf(  %c , &x); }   void _R(char *x) { scanf( %s , x); }   void R() {}   template <class T, class... U>   void R(T &head, U &...tail) {     _R(head);     R(tail...);   }   void _W(const int &x) { printf( %d , x); }   void _W(const long long &x) { printf( %lld , x); }   void _W(const double &x) { printf( %.16f , x); }   void _W(const char &x) { putchar(x); }   void _W(const char *x) { printf( %s , x); }   template <class T>   void _W(const vector<T> &x) {     for (auto i = x.begin(); i != x.end(); _W(*i++))       if (i != x.cbegin()) putchar(   );   }   void W() {}   template <class T, class... U>   void W(const T &head, const U &...tail) {     _W(head);     putchar(sizeof...(tail) ?     :   n );     W(tail...);   }   const int N = 3e5 + 7, M = 2e6;   const long long mod = 1e9 + 7;   inline int read() {     int ret = 0;     char ch = getchar();     bool f = 1;     for (; !isdigit(ch); ch = getchar()) f ^= !(ch ^  - );     for (; isdigit(ch); ch = getchar()) ret = (ret << 1) + (ret << 3) + ch - 48;     return f ? ret : -ret;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long ksm(long long a, long long b, long long mod) {     int ans = 1;     while (b) {       if (b & 1) ans = (ans * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return ans;   }   long long inv2(long long a, long long mod) { return ksm(a, mod - 2, mod); }   void TelmaZzzz() {}   struct node {     int l, r, val;   } que[N];   int a[N];   int arr[N];   int k, t, m, n;   bool check(int x) {     int minn = m + 1, maxn = -1;     for (int i = 1; i <= m + 1; i++) arr[i] = 0;     for (int i = 1; i <= k; i++) {       if (que[i].val <= a[n - x + 1]) continue;       arr[que[i].l]++;       arr[que[i].r + 1]--;     }     int ans = m + 1;     for (int i = 1; i <= m + 1; i++) {       arr[i] += arr[i - 1];       if (arr[i]) ans += 2;     }     if (ans <= t) return true;     return false;   }   int main() {     TelmaZzzz();     R(n, m, k, t);     for (int i = 1; i <= n; i++) R(a[i]);     for (int i = 1; i <= k; i++) R(que[i].l, que[i].r, que[i].val);     sort(a + 1, a + 1 + n);     int l = 1, r = n;     while (l <= r) {       int mi = (l + r) / 2;       if (check(mi))         l = mi + 1;       else         r = mi - 1;     }     W(r);     return 0;   }   