#include <bits/stdc++.h>
using namespace std;
long long k, n, m, a[100005], t, tans, ans[100005], val[100005];
pair<long double, long long> cz[100005];
vector<pair<long long, long long> > fz[100005], ad[100005];
bool cmp(int i, int j) { return val[i] < val[j]; }
int main() {
  scanf("%lld%lld%lld", &k, &n, &m);
  for (long long i = 1; i <= k; i++) scanf("%lld", &a[i]);
  for (long long i = 1; i <= n; i++) {
    long long op, x, y;
    scanf("%lld%lld%lld", &op, &x, &y);
    val[i] = op;
    if (op == 1)
      fz[x].push_back(make_pair(y, i));
    else if (op == 2)
      ad[x].push_back(make_pair(y, i));
    else
      cz[++t] = make_pair((long double)y, i);
  }
  for (long long i = 1; i <= k; i++) {
    long long len = fz[i].size(), mx = 0, mn;
    if (len)
      for (long long j = 0; j < len; j++)
        if (fz[i][j].first > mx) mx = fz[i][j].first, mn = fz[i][j].second;
    if (mx > a[i]) ad[i].push_back(make_pair(mx - a[i], mn));
    len = ad[i].size();
    if (len) sort(ad[i].begin(), ad[i].end());
    long long us = a[i];
    for (long long j = len - 1; j >= 0; j--) {
      cz[++t] =
          make_pair((long double)(us + ad[i][j].first) / us, ad[i][j].second);
      us += ad[i][j].first;
    }
  }
  sort(cz + 1, cz + 1 + t);
  for (long long i = t, j = 1; i >= 0 && j <= m; i--, j++) {
    if (cz[i].first <= 1.0000000000000000000) break;
    ans[++tans] = cz[i].second;
  }
  sort(ans + 1, ans + 1 + tans, cmp);
  printf("%lld\n", tans);
  for (long long i = 1; i <= tans; i++) printf("%lld ", ans[i]);
}
