#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(long long a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(long long a) {
  write(a);
  puts("");
}
inline void wri(long long a) {
  write(a);
  putchar(' ');
}
inline unsigned long long rnd() {
  return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;
}
const int N = 100005;
vector<pair<int, int> > v[N];
long long a[N];
int tot, op[N], pos[N], b[N];
pair<int, int> mx[N];
struct data {
  int a;
  long long b;
  int id;
} q[N];
bool cmp(data a, data b) { return a.a * b.b > a.b * b.a; }
bool cnm(data a, data b) { return op[a.id] < op[b.id]; }
int main() {
  int k = read(), n = read(), m = read();
  for (int i = (int)(1); i <= (int)(k); i++) a[i] = read();
  for (int i = (int)(1); i <= (int)(n); i++) {
    op[i] = read() - 1;
    pos[i] = read();
    b[i] = read();
    if (!op[i]) mx[pos[i]] = max(mx[pos[i]], make_pair(b[i], i));
  }
  for (int i = (int)(1); i <= (int)(k); i++)
    if (mx[i].first > a[i])
      v[i].push_back(make_pair(mx[i].first - a[i], mx[i].second));
  for (int i = (int)(1); i <= (int)(n); i++)
    if (op[i]) {
      if (op[i] == 1)
        v[pos[i]].push_back(make_pair(b[i], i));
      else
        q[++tot] = (data){b[i] - 1, 1, i};
    }
  for (int i = (int)(1); i <= (int)(k); i++) {
    sort(v[i].begin(), v[i].end());
    reverse(v[i].begin(), v[i].end());
    for (auto j : v[i]) {
      q[++tot] = (data){j.first, a[i], j.second};
      a[i] += j.first;
    }
  }
  sort(q + 1, q + tot + 1, cmp);
  m = min(m, tot);
  cout << m << endl;
  sort(q + 1, q + m + 1, cnm);
  for (int i = (int)(1); i <= (int)(m); i++) wri(q[i].id);
}
