#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n, m, k, ini[N], tipo[N];
vector<pair<int, int> > que[N][3];
bool cmp(pair<long long, pair<long long, int> > a,
         pair<long long, pair<long long, int> > b) {
  return (a.first * b.second.first > a.second.first * b.first);
}
bool cmp1(int a, int b) { return tipo[a] < tipo[b]; }
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%d", &ini[i]);
  for (int i = 0; i < m; i++) {
    int type, j, val;
    scanf("%d %d %d", &type, &j, &val);
    type--;
    j--;
    que[j][type].push_back(make_pair(val, i));
    tipo[i] = type;
  }
  for (int i = 0; i < n; i++)
    sort((que[i][0]).begin(), (que[i][0]).end()),
        reverse((que[i][0]).begin(), (que[i][0]).end());
  for (int i = 0; i < n; i++) {
    if (((int)(que[i][0]).size()) > 0 && que[i][0][0].first > ini[i])
      que[i][1].push_back(
          make_pair(que[i][0][0].first - ini[i], que[i][0][0].second));
    sort((que[i][1]).begin(), (que[i][1]).end());
    reverse((que[i][1]).begin(), (que[i][1]).end());
  }
  vector<pair<long long, pair<long long, int> > > ord;
  for (int i = 0; i < n; i++) {
    long long atual = ini[i];
    for (int j = 0; j < ((int)(que[i][1]).size()); j++) {
      ord.push_back(
          make_pair(que[i][1][j].first, make_pair(atual, que[i][1][j].second)));
      atual += que[i][1][j].first;
    }
    for (int j = 0; j < ((int)(que[i][2]).size()); j++) {
      ord.push_back(
          make_pair(que[i][2][j].first - 1, make_pair(1, que[i][2][j].second)));
    }
  }
  sort(ord.begin(), ord.end(), cmp);
  vector<int> ans;
  for (int i = 0; i < min(k, ((int)(ord).size())); i++) {
    ans.push_back(ord[i].second.second);
  }
  sort(ans.begin(), ans.end(), cmp1);
  printf("%d\n", ((int)(ans).size()));
  for (int i = 0; i < ((int)(ans).size()); i++) {
    if (i) printf(" ");
    printf("%d", ans[i] + 1);
  }
  puts("");
}
