#include <bits/stdc++.h>
using namespace std;
struct eff {
  long long m, d;
  int ind;
  int type;
  bool operator<(const eff &c) const {
    return ((long long)m) * c.d > ((long long)c.m) * d;
  }
  eff(int _ind, long long _m, long long _d, int t) {
    m = _m;
    d = _d;
    ind = _ind;
    type = t;
  }
};
bool comp(const eff &a, const eff &b) { return (a.type < b.type); }
struct skill {
  long long val;
  int as = 0, asind = -1;
  vector<pair<int, pair<int, int> > > add;
};
int k, m, n;
skill a[100111];
vector<pair<int, int> > mult;
vector<eff> order;
int main() {
  cin >> k >> n >> m;
  for (int i = 1; i <= k; ++i) {
    cin >> a[i].val;
  }
  for (int i = 1; i <= n; ++i) {
    int t, j, b;
    cin >> t >> j >> b;
    switch (t) {
      case 1:
        if (b > a[j].val + a[j].as) {
          a[j].as = b - a[j].val;
          a[j].asind = i;
        }
        break;
      case 2:
        a[j].add.push_back(make_pair(b, make_pair(i, 2)));
        break;
      case 3:
        mult.push_back(make_pair(b, i));
        break;
    }
  }
  for (int i = 1; i <= k; ++i) {
    if (a[i].asind != -1) {
      a[i].add.push_back(
          make_pair(a[i].as - a[i].val, make_pair(a[i].asind, 1)));
    }
    sort(a[i].add.rbegin(), a[i].add.rend());
    for (auto &j : a[i].add) {
      order.emplace_back(j.second.first, j.first, a[i].val, j.second.second);
      a[i].val += j.first;
    }
  }
  for (auto &j : mult) {
    order.emplace_back(j.second, j.first - 1, 1, 3);
  }
  int c = order.size();
  sort(order.begin(), order.end());
  sort(order.begin(), order.begin() + min(c, m), comp);
  cout << min(c, m) << endl;
  for (int i = 0; i < min(c, m); ++i) {
    cout << order[i].ind << ' ';
  }
  cout << endl;
  return 0;
}
