#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
double n, m, k, a[N], mx[N], ind[N], t[N];
vector<pair<long double, int>> mul;
vector<pair<double, int>> vec[N];
vector<int> ans;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0, x, b; i < m; i++) {
    cin >> t[i] >> x >> b;
    x--;
    if (t[i] == 1)
      if (mx[x] < b) {
        mx[x] = b;
        ind[x] = i;
      }
    if (t[i] == 2) vec[x].push_back({b, i});
    if (t[i] == 3) mul.push_back({b, i});
  }
  for (int i = 0; i < n; i++) {
    if (mx[i] > a[i]) vec[i].push_back({mx[i] - a[i], ind[i]});
    sort(vec[i].rbegin(), vec[i].rend());
    for (auto [v, it] : vec[i]) {
      mul.push_back({(a[i] + v) / a[i], it});
      a[i] += v;
    }
  }
  sort(mul.rbegin(), mul.rend());
  for (int i = 0; i < min<int>(mul.size(), k); i++)
    ans.push_back(mul[i].second);
  sort(ans.begin(), ans.end(), [](int x, int y) { return t[x] < t[y]; });
  cout << ans.size() << endl;
  for (int i : ans) cout << i + 1 << ' ';
}
