#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[N], t[N], n, m, k;
pair<int, int> h[N];
vector<pair<double, int> > ans;
vector<pair<int, int> > add[N];
int main() {
  scanf("%d%d%d", &k, &n, &m);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    t[i] = op;
    if (op == 1)
      if (y >= h[x].first) h[x] = make_pair(y, i);
    if (op == 2) add[x].push_back(make_pair(y, i));
    if (op == 3) ans.push_back(make_pair(y, i));
  }
  for (int i = 1; i <= k; i++) {
    if (h[i].first > a[i])
      add[i].push_back(make_pair(h[i].first - a[i], h[i].second));
    sort(add[i].rbegin(), add[i].rend());
    long long s = a[i];
    for (auto u : add[i])
      ans.push_back({1.0 * (s + u.first) / s, u.second}), s += u.first;
  }
  sort(ans.rbegin(), ans.rend());
  m = min(int(ans.size()), m);
  printf("%d\n", m);
  for (int i = 0; i < m; i++)
    if (t[ans[i].second] == 1) printf("%d ", ans[i].second);
  for (int i = 0; i < m; i++)
    if (t[ans[i].second] == 2) printf("%d ", ans[i].second);
  for (int i = 0; i < m; i++)
    if (t[ans[i].second] == 3) printf("%d ", ans[i].second);
}
