#include <bits/stdc++.h>
using namespace std;
int a[110000];
int b[110000][3];
int c[110000][2];
int k, n, m;
vector<pair<int, int> > add[110000];
vector<pair<double, int> > mul;
vector<pair<int, int> > sol;
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++) scanf("%d%d%d", &b[i][0], &b[i][1], &b[i][2]);
  for (int i = 1; i <= n; i++) {
    if (b[i][0] == 1) {
      int x = b[i][1], val = b[i][2];
      if (c[x][0] < val) {
        c[x][0] = val;
        c[x][1] = i;
      }
    } else if (b[i][0] == 2) {
      int x = b[i][1], val = b[i][2];
      add[x].push_back(make_pair(val, i));
    } else {
      int x = b[i][1], val = b[i][2];
      mul.push_back(make_pair(val, i));
    }
  }
  for (int i = 1; i <= k; i++) {
    double sum = a[i];
    if (c[i][0] > a[i]) add[i].push_back(make_pair(c[i][0] - a[i], c[i][1]));
    sort(add[i].begin(), add[i].end());
    reverse(add[i].begin(), add[i].end());
    for (int j = 0; j < add[i].size(); j++) {
      mul.push_back(make_pair((sum + add[i][j].first) / sum, add[i][j].second));
      sum += add[i][j].first;
    }
  }
  sort(mul.begin(), mul.end());
  reverse(mul.begin(), mul.end());
  for (int i = 0; i < mul.size() && i < m; i++)
    sol.push_back(make_pair(b[mul[i].second][0], mul[i].second));
  printf("%d\n", sol.size());
  sort(sol.begin(), sol.end());
  for (int i = 0; i < sol.size(); i++) printf("%d ", sol[i].second);
  puts("");
  return 0;
}
