#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int k, n, m;
long long a[MAXN], g[MAXN], ii[MAXN], ty[MAXN];
vector<pair<long long, long long> > V[MAXN];
vector<pair<long long, pair<long long, long long> > > P;
bool Compare(pair<long long, pair<long long, long long> > A,
             pair<long long, pair<long long, long long> > B) {
  assert(A.second.first >= A.second.second);
  assert(B.second.first >= B.second.second);
  A.second.first -= A.second.second;
  B.second.first -= B.second.second;
  return A.second.first * B.second.second > A.second.second * B.second.first;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> k >> n >> m;
  for (int i = 1; i <= k; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    int t, id, b;
    cin >> t >> id >> b;
    ty[i] = t;
    if (t == 1) {
      if (g[id] < b) {
        g[id] = b;
        ii[id] = i;
      }
    } else if (t == 2) {
      V[id].emplace_back(b, i);
    } else {
      P.emplace_back(i, make_pair(b, 1));
    }
  }
  for (int i = 1; i <= k; i++) {
    if (a[i] < g[i]) {
      V[i].emplace_back(g[i] - a[i], ii[i]);
    }
    sort(V[i].begin(), V[i].end(), greater<pair<long long, long long> >());
    for (auto x : V[i]) {
      P.emplace_back(x.second, make_pair(a[i] + x.first, a[i]));
      a[i] += x.first;
    }
  }
  sort(P.begin(), P.end(), Compare);
  vector<pair<long long, long long> > L;
  for (int i = 0; i < min(m, (int)P.size()); i++) {
    L.emplace_back(ty[P[i].first], P[i].first);
  }
  sort(L.begin(), L.end());
  cout << L.size() << '\n';
  for (auto x : L) {
    cout << x.second << ' ';
  }
}
