Problem p02899 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (ll(i) = 0, (i##_len) = (n); (i) < (i##_len); (i)++)
#define rep2(i, a, b)                                                          \
  for (ll(i) = (a), (i##_len) = (b); (i) <= (i##_len); (i++))
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> T abs(T x) { return max(x, -x); }
template <class T> T gcd_vec(vector<T> v) {
  T r = v.at(0);
  for (T i = 1; i < v.size(); i++)
    r = gcd(r, v.at(i));
  return r;
}
template <class T> T lcm(T m, T n) { return m * n / gcd(m, n); }
template <class T> T lcm_vec(vector<T> v) {
  T r = v.at(0);
  for (T i = 1; i < v.size(); i++)
    r = lcm<T>(r, v.at(i));
  return r;
}
template <class T> T factorial(T n) {
  if (n == 0)
    return 1;
  T r = 1;
  for (T i = 2; i <= n; i++)
    r *= i;
  return r;
}
template <class T> T nCr(T n, T k) {
  return factorial<T>(n) / (factorial<T>(k) * factorial<T>(n - k));
}
template <class T> T dot_product(vector<T> u, vector<T> v) {
  T r = 0;
  for (T i = 0; i < u.size(); i++)
    r += u.at(i) * v.at(i);
  return r;
}
template <class T> T sum(vector<T> v) { return reduce(all(v), 0LL); }

// Template ends here

void solve(ll N, vector<ll> A) {
  vll result(N);
  rep2(i, 1, N) {
    rep(j, N) if (A.at(j) == i) {
      cout << j + 1 << " ";
      break;
    }
  }
}

int main() {
  ll N;
  scanf("%lld", &N);
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, move(A));
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (ll(i) = 0, (i##_len) = (n); (i) < (i##_len); (i)++)
#define rep2(i, a, b)                                                          \
  for (ll(i) = (a), (i##_len) = (b); (i) <= (i##_len); (i++))
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n")
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> T abs(T x) { return max(x, -x); }
template <class T> T gcd_vec(vector<T> v) {
  T r = v.at(0);
  for (T i = 1; i < v.size(); i++)
    r = gcd(r, v.at(i));
  return r;
}
template <class T> T lcm(T m, T n) { return m * n / gcd(m, n); }
template <class T> T lcm_vec(vector<T> v) {
  T r = v.at(0);
  for (T i = 1; i < v.size(); i++)
    r = lcm<T>(r, v.at(i));
  return r;
}
template <class T> T factorial(T n) {
  if (n == 0)
    return 1;
  T r = 1;
  for (T i = 2; i <= n; i++)
    r *= i;
  return r;
}
template <class T> T nCr(T n, T k) {
  return factorial<T>(n) / (factorial<T>(k) * factorial<T>(n - k));
}
template <class T> T dot_product(vector<T> u, vector<T> v) {
  T r = 0;
  for (T i = 0; i < u.size(); i++)
    r += u.at(i) * v.at(i);
  return r;
}
template <class T> T sum(vector<T> v) { return reduce(all(v), 0LL); }

// Template ends here

void solve(ll N, vector<ll> A) {
  vll R(N);
  rep(i, N) R.at(A.at(i) - 1) = i + 1;
  rep(i, N) cout << R.at(i) << " ";
}

int main() {
  ll N;
  scanf("%lld", &N);
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, move(A));
  return 0;
}