#include <bits/stdc++.h>
int read() {
  static int ch, x;
  while ((ch = getchar()) < 48) {
  }
  x = ch ^ 48;
  while ((ch = getchar()) >= 48) x = (((x << 2) + x) << 1) + (ch ^ 48);
  return x;
}
int a[100010];
std::pair<int, int> assign[100010];
std::vector<std::pair<int, int>> plus[100010];
std::vector<std::pair<double, int>> multiplies;
constexpr int fix(const int &x, const int &m) {
  return x - ((m - x) >> 31 & m);
}
int main() {
  const int n = read(), m = read(), k = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= m; ++i) {
    switch (read()) {
      case 1: {
        const int x = read();
        assign[x] = std::max(assign[x], std::make_pair(read(), i));
        break;
      }
      case 2: {
        const int x = read();
        plus[x].push_back(std::make_pair(read(), i));
        break;
      }
      case 3: {
        read();
        multiplies.push_back(std::make_pair(read() + 0., i));
        break;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    if (assign[i].first > a[i])
      plus[i].push_back(
          std::make_pair(assign[i].first - a[i], assign[i].second + m));
  for (int i = 1; i <= n; ++i) {
    std::sort(plus[i].begin(), plus[i].end(),
              std::greater<std::pair<int, int>>());
    long long v = a[i];
    for (const std::pair<int, int> &p : plus[i]) {
      multiplies.push_back(
          std::make_pair((p.first + v + 0.) / v, p.second + m));
      v += p.first;
    }
  }
  std::sort(multiplies.begin(), multiplies.end(),
            std::greater<std::pair<double, int>>());
  const int lim = std::min<int>(k, multiplies.size());
  printf("%d\n", lim);
  std::sort(
      multiplies.begin(), multiplies.begin() + lim,
      [](const std::pair<double, int> &x, const std::pair<double, int> &y) {
        return x.second > y.second;
      });
  for (int i = 0; i < lim; ++i) {
    printf("%d ", fix(fix(multiplies[i].second, m), m));
  }
  return 0;
}
