#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
inline int read() {
  register int x = 0, w = 1, ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') w = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - 48;
  return w * x;
}
int n, m, k, tot1, tot2, tot3, cnt;
long long s[maxn];
struct node {
  int opt, id, x;
  long long v, w;
} m1[maxn], m2[maxn], m3[maxn], ans[maxn];
inline bool cmp1(node a, node b) {
  return (a.x != b.x) ? (a.x < b.x) : (a.v < b.v);
}
inline bool cmp2(node a, node b) {
  return (a.x != b.x) ? (a.x < b.x) : (a.v > b.v);
}
inline bool cmp3(node a, node b) { return a.opt < b.opt; }
inline bool cmp4(node a, node b) { return a.v * b.w > a.w * b.v; }
int main() {
  n = read(), m = read(), k = read();
  for (int i = 1; i <= n; i++) s[i] = read();
  for (int i = 1; i <= m; i++) {
    int a = read(), b = read(), c = read();
    if (a == 1 && c > s[b])
      m1[++tot1] = (node){1, i, b, c, 1};
    else if (a == 2)
      m2[++tot2] = (node){2, i, b, c, 1};
    else if (a == 3)
      m3[++tot3] = (node){3, i, b, c, 1};
  }
  sort(m1 + 1, m1 + tot1 + 1, cmp1);
  int tmp = 0;
  for (int i = 1; i <= tot1; i++)
    if (m1[i].x != m1[i + 1].x) m1[++tmp] = m1[i];
  tot1 = tmp;
  for (int i = 1; i <= tot1; i++)
    m1[i].v = m1[i].v - s[m1[i].x], m2[++tot2] = m1[i];
  sort(m2 + 1, m2 + tot2 + 1, cmp2);
  long long sum = 0;
  for (int i = 1; i <= tot2; i++) {
    if (m2[i].x != m2[i - 1].x) sum = s[m2[i].x];
    m2[i].w = sum, sum += m2[i].v;
  }
  for (int i = 1; i <= tot3; i++) m3[i].v--;
  for (int i = 1; i <= tot2; i++) m3[++tot3] = m2[i];
  sort(m3 + 1, m3 + tot3 + 1, cmp4);
  tmp = min(tot3, k);
  for (int i = 1; i <= tmp; i++) ans[++cnt] = m3[i];
  printf("%d\n", cnt);
  sort(ans + 1, ans + cnt + 1, cmp3);
  for (int i = 1; i <= cnt; i++) printf("%d ", ans[i].id);
  return 0;
}
