#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[100005];
int b[100005], c[100005], d[100005];
vector<pair<double, int> > v;
vector<pair<int, int> > u[100005];
bool cmp(pair<double, int> first, pair<double, int> second) {
  return d[first.second] < d[second.second];
}
int main() {
  scanf("%d %d %d", &k, &n, &m);
  for (int i = 1; i <= k; i++) scanf("%d", &a[i]);
  int type, first, second;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d", &type, &first, &second);
    d[i] = type;
    if (type == 1 && b[first] < second) {
      b[first] = second;
      c[first] = i;
    } else if (type == 2)
      u[first].push_back(pair<int, int>(second, i));
    else if (type == 3)
      v.push_back(pair<double, int>(second, i));
  }
  for (int i = 1; i <= k; i++) {
    if (b[i] > a[i]) u[i].push_back(pair<int, int>(b[i] - a[i], c[i]));
    sort(u[i].begin(), u[i].end(), greater<pair<int, int> >());
    long long now = a[i];
    for (auto first : u[i]) {
      v.push_back(
          pair<double, int>(1.0 * (now + first.first) / now, first.second));
      now += first.first;
    }
  }
  sort(v.begin(), v.end(), greater<pair<double, int> >());
  int sz = min((int)(v.size()), m);
  v.resize(sz);
  sort(v.begin(), v.end(), cmp);
  printf("%d\n", sz);
  for (int i = 0; i < sz; i++) cout << v[i].second << " ";
  cout << endl;
  return 0;
}
