#include <bits/stdc++.h>
using namespace std;
int h[100000], h1[100000];
double h2[100000];
int s[100000], d[100000];
void qs(int q, int w) {
  int e = q, r = w, t = d[q + (rand() % (w - q + 1))], y;
  do {
    while ((h1[d[e]] < h1[t]) || ((h1[d[e]] == h1[t]) && (h2[d[e]] > h2[t])))
      e++;
    while ((h1[d[r]] > h1[t]) || ((h1[d[r]] == h1[t]) && (h2[d[r]] < h2[t])))
      r--;
    if (e <= r) {
      y = d[e];
      d[e] = d[r];
      d[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs(q, r);
  if (e < w) qs(e, w);
}
void qs1(int q, int w) {
  int e = q, r = w, t = d[q + (rand() % (w - q + 1))], y;
  do {
    while (h2[d[e]] > h2[t]) e++;
    while (h2[d[r]] < h2[t]) r--;
    if (e <= r) {
      y = d[e];
      d[e] = d[r];
      d[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs1(q, r);
  if (e < w) qs1(e, w);
}
void qs2(int q, int w) {
  int e = q, r = w, t = d[q + (rand() % (w - q + 1))], y;
  do {
    while (h[d[e]] < h[t]) e++;
    while (h[d[r]] > h[t]) r--;
    if (e <= r) {
      y = d[e];
      d[e] = d[r];
      d[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs2(q, r);
  if (e < w) qs2(e, w);
}
int main() {
  int q, w, e, r, t, t1, o;
  long long a[100000];
  cin >> o >> q >> w;
  for (e = 0; e < o; e++) {
    scanf("%d", &r);
    a[e] = r;
    s[e] = -1;
  }
  t = 0;
  for (e = 0; e < q; e++) {
    scanf("%d%d%d", &h[e], &h1[e], &r);
    h2[e] = r;
    h1[e]--;
    if ((h[e] == 1) && (h2[e] > a[h1[e]])) {
      if (s[h1[e]] < 0)
        s[h1[e]] = e;
      else if (h2[s[h1[e]]] < h2[e])
        s[h1[e]] = e;
    }
  }
  for (e = 0; e < o; e++)
    if (s[e] >= 0) {
      d[t] = s[e];
      h2[s[e]] -= a[s[e]];
      t++;
    }
  for (e = 0; e < q; e++)
    if (h[e] == 2) {
      d[t] = e;
      t++;
    }
  if (t > 0) qs(0, t - 1);
  int c;
  for (e = 0; e < t; e++) {
    r = d[e];
    c = (int)(h2[r] + 0.0001);
    h2[r] = ((double)(h2[r] + a[h1[r]])) / ((double)a[h1[r]]);
    a[h1[r]] += c;
  }
  for (e = 0; e < q; e++)
    if (h[e] == 3) {
      d[t] = e;
      t++;
    }
  if (t > 0) qs1(0, t - 1);
  w = min(w, t);
  printf("%d\n", w);
  if (w > 0) qs2(0, w - 1);
  for (e = 0; e < w; e++) printf("%d ", d[e] + 1);
  return 0;
}
