#include <bits/stdc++.h>
using namespace std;
struct frac {
  long long a, b;
  bool operator<(const frac& who) const { return a * who.b < b * who.a; }
};
int n, m, k, i;
long long op, sk, pw;
long long a[100011];
int tp[100011];
vector<pair<long long, long long> > add[100011];
pair<long long, long long> best[100011];
vector<pair<frac, long long> > upg;
vector<int> sol;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = 1; i <= m; i++) {
    scanf("%lld%lld%lld", &op, &sk, &pw);
    tp[i] = op;
    if (op == 1) best[sk] = max(best[sk], make_pair(pw, 1LL * i));
    if (op == 2) add[sk].push_back(make_pair(pw, i));
    if (op == 3)
      if (pw > 1) upg.push_back(make_pair((frac){pw - 1, 1}, 1LL * i));
  }
  for (i = 1; i <= n; i++) {
    if (best[i].first > a[i])
      add[i].push_back(make_pair(best[i].first - a[i], best[i].second));
    sort(add[i].begin(), add[i].end(), greater<pair<long long, long long> >());
    for (auto e : add[i]) {
      upg.push_back(make_pair((frac){e.first, a[i]}, e.second));
      a[i] += e.first;
    }
  }
  sort(upg.begin(), upg.end());
  while (upg.size() > 0 && k > 0) {
    k--;
    sol.push_back(upg.back().second);
    upg.pop_back();
  }
  sort(sol.begin(), sol.end(),
       [](const int a, const int b) -> bool { return tp[a] < tp[b]; });
  printf("%d\n", sol.size());
  for (auto e : sol) printf("%d ", e);
  return 0;
}
