#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
long long n, m, a[N], tot, ans, k;
struct node {
  long long p, data, flag;
} opt[N];
vector<node> v[N];
struct Node {
  long long id, flag;
  double val;
} c[N];
bool cmp(const node &x, const node &y) { return x.data > y.data; }
bool cmp1(const Node &x, const Node &y) { return x.val > y.val; }
bool cmp2(const Node &x, const Node &y) { return x.flag < y.flag; }
int main() {
  scanf("%lld%lld%lld", &k, &n, &m);
  for (long long i = 1; i <= k; i++) scanf("%lld", &a[i]);
  long long x, y, z;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld%lld%lld", &x, &y, &z);
    if (x == 1 && z > a[y]) {
      if (opt[y].data < z) {
        opt[y].data = z;
        opt[y].p = i;
        opt[y].flag = x;
      }
    }
    if (x == 2 && z > 0) v[y].push_back((node){i, z, 2});
    if (x == 3 && z > 1) {
      c[++tot].id = i;
      c[tot].val = (double)z;
      c[tot].flag = 3;
    }
  }
  for (long long i = 1; i <= k; i++) {
    if (opt[i].data > 0) {
      v[i].push_back((node){opt[i].p, opt[i].data - a[i], 1});
    }
    sort(v[i].begin(), v[i].end(), cmp);
    for (long long j = 0; j < v[i].size(); j++) {
      node tmp = v[i][j];
      c[++tot].id = tmp.p;
      c[tot].flag = tmp.flag;
      c[tot].val = (double(a[i] + tmp.data) / a[i]);
      a[i] += tmp.data;
    }
  }
  sort(c + 1, c + tot + 1, cmp1);
  ans = min(m, tot);
  sort(c + 1, c + ans + 1, cmp2);
  printf("%lld\n", ans);
  for (long long i = 1; i <= ans; i++) printf("%lld ", c[i].id);
  return 0;
}
