#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int res = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = (res << 3) + (res << 1) + ch - '0';
    ch = getchar();
  }
  return res * f;
}
namespace qiqi {
const int N = 1e5 + 5;
int k, n, m, mx[N], cnt;
long long a[N];
struct Opt {
  int t, p, b, id;
  inline bool friend operator<(Opt a, Opt b) { return a.t < b.t; }
} o[N], ans[N];
struct Val {
  long long v0, v1;
  int id;
  inline bool friend operator<(Val a, Val b) {
    return 1.0l * a.v0 / a.v1 < 1.0l * b.v0 / b.v1;
  }
};
priority_queue<Val> q;
struct ADD {
  int b, id;
  inline bool friend operator<(ADD a, ADD b) { return a.b < b.b; }
};
priority_queue<ADD> add[N];
void main() {
  k = read();
  n = read();
  m = read();
  for (int i = (1); i <= (k); ++i) a[i] = read();
  for (int i = (1); i <= (n); ++i) {
    o[i] = (Opt){read(), read(), read(), i};
    if (o[i].t == 1 && ((!mx[o[i].p] && o[i].b > a[o[i].p]) ||
                        (mx[o[i].p] && o[mx[o[i].p]].b < o[i].b)))
      mx[o[i].p] = o[i].id;
    if (o[i].t == 2) add[o[i].p].push((ADD){o[i].b, i});
    if (o[i].t == 3) q.push((Val){o[i].b, 1, i});
  }
  for (int i = (1); i <= (k); ++i) {
    if (mx[i]) q.push((Val){o[mx[i]].b, a[i], mx[i]});
    if (!add[i].empty()) {
      q.push((Val){add[i].top().b + a[i], a[i], add[i].top().id});
      add[i].pop();
    }
  }
  while (!q.empty() && cnt < m) {
    Val x = q.top();
    q.pop();
    int id = x.id;
    if (o[id].t == 3) {
      ans[++cnt] = o[id];
      continue;
    }
    if (x.v1 != a[o[id].p]) {
      x.v0 += a[o[id].p] - x.v1;
      x.v1 = a[o[id].p];
      q.push(x);
      continue;
    }
    ans[++cnt] = o[id];
    a[o[id].p] = x.v0;
    if (o[id].t == 2 && !add[o[id].p].empty()) {
      q.push((Val){add[o[id].p].top().b + a[o[id].p], a[o[id].p],
                   add[o[id].p].top().id});
      add[o[id].p].pop();
    }
  }
  printf("%d\n", cnt);
  sort(ans + 1, ans + cnt + 1);
  for (int i = (1); i <= (cnt); ++i) printf("%d ", ans[i].id);
}
}  // namespace qiqi
int main() {
  qiqi::main();
  return 0;
}
