#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int k, n, m;
long long a[N];
int op[N];
struct assign {
  long long num;
  int id;
  bool operator<(const assign& tmp) const { return num < tmp.num; }
} as[N];
struct add {
  long long num;
  int id;
};
vector<add> ad[N];
struct mul {
  long double num;
  int id;
};
vector<mul> mu;
int x;
long long y;
assign max(assign a, assign b) {
  if (a < b)
    return b;
  else
    return a;
}
bool cmp(add a, add b) { return a.num > b.num; }
bool cmp1(mul a, mul b) { return a.num > b.num; }
bool cmp2(mul a, mul b) { return op[a.id] < op[b.id]; }
int ans[N], cntt;
int main() {
  cin >> k >> n >> m;
  for (int i = 1; i <= k; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %lld", &op[i], &x, &y);
    if (op[i] == 1) {
      as[x] = max(as[x], (assign){y, i});
    }
    if (op[i] == 2) {
      ad[x].push_back((add){y, i});
    }
    if (op[i] == 3) {
      mu.push_back((mul){1.0 * y, i});
    }
  }
  for (int i = 1; i <= k; i++) {
    if (as[i].num > a[i]) {
      ad[i].push_back((add){as[i].num - a[i], as[i].id});
    }
  }
  for (int i = 1; i <= k; i++) {
    sort(ad[i].begin(), ad[i].end(), cmp);
    long long tmp = a[i];
    for (unsigned int j = 0; j < ad[i].size(); j++) {
      mu.push_back((mul){1.0 * (tmp + ad[i][j].num) / tmp, ad[i][j].id});
      tmp += ad[i][j].num;
    }
  }
  sort(mu.begin(), mu.end(), cmp1);
  int tmp = mu.size();
  m = min(m, tmp);
  cout << m << endl;
  for (int i = 0; i < m; i++) {
    if (op[mu[i].id] == 1) ans[++cntt] = mu[i].id;
  }
  sort(ans + 1, ans + cntt + 1);
  for (int i = 1; i <= cntt; i++) cout << ans[i] << " ";
  cntt = 0;
  for (int i = 0; i < m; i++) {
    if (op[mu[i].id] == 2) ans[++cntt] = mu[i].id;
  }
  sort(ans + 1, ans + cntt + 1);
  for (int i = 1; i <= cntt; i++) cout << ans[i] << " ";
  cntt = 0;
  for (int i = 0; i < m; i++) {
    if (op[mu[i].id] == 3) ans[++cntt] = mu[i].id;
  }
  sort(ans + 1, ans + cntt + 1);
  for (int i = 1; i <= cntt; i++) cout << ans[i] << " ";
  return 0;
}
