#include <bits/stdc++.h>
using namespace std;
struct Add {
  long long x, d;
  int i;
  bool operator<(const Add& p) const {
    return (long long)d * p.x > (long long)p.d * x;
  }
} a[100005];
int cnt, d[100005], p[100005], sig[100005];
long long x[100005];
vector<pair<int, int>> chain[100005];
int main() {
  int i, k, n, m;
  scanf("%d%d%d", &k, &n, &m);
  for (i = 1; i <= k; i++) scanf("%I64d", &x[i]);
  for (i = 1; i <= n; i++) {
    int opt, pos, ch;
    scanf("%d%d%d", &opt, &pos, &ch);
    sig[i] = opt;
    if (opt == 1) {
      if (d[pos] < ch - x[pos]) d[pos] = ch - x[pos], p[pos] = i;
    } else if (opt == 2)
      chain[pos].push_back(make_pair(ch, i));
    else
      a[cnt++] = (Add){1, ch - 1, i};
  }
  for (i = 1; i <= k; i++) {
    if (d[i]) chain[i].push_back(make_pair(d[i], p[i]));
    sort(chain[i].rbegin(), chain[i].rend());
    for (auto e : chain[i]) {
      a[cnt++] = (Add){x[i], e.first, e.second};
      x[i] += e.first;
    }
  }
  std::sort(a, a + cnt);
  int ans = std::min(cnt, m);
  printf("%d\n", ans);
  for (i = 0; i < ans; i++)
    if (sig[a[i].i] == 1) printf("%d ", a[i].i);
  for (i = 0; i < ans; i++)
    if (sig[a[i].i] == 2) printf("%d ", a[i].i);
  for (i = 0; i < ans; i++)
    if (sig[a[i].i] == 3) printf("%d ", a[i].i);
  return 0;
}
