Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll k;
  cin >> n >> k;
  vector<int> a(n + 1);
  rep(i, n) {
    cin >> a[i + 1];
  }
  vector<int> num(n + 1);
  int step = 1;
  int i = 1;
  for(; num[i] == 0; i = a[i]) {
    num[i] = step++;
    if(step > k + 1) break;
  }
  if(step > k + 1) {
    cout << i << endl;
    return 0;
  }
  k -= num[i] - 1;
  ll m = k % (step - num[i]);
  rep(j, m) {
    i = a[i];
  }
  cout << i << endl;
  return 0;
}

Compiler output:
a.cc:1:2: error: extended character   is not valid in an identifier
    1 | #include <bits/stdc++.h>
      |  ^
a.cc:1:2: error: invalid preprocessing directive #include\U000000a0
    1 | #include <bits/stdc++.h>
      |  ^~~~~~~~
a.cc:2:2: error: extended character   is not valid in an identifier
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |  ^
a.cc:2:2: error: invalid preprocessing directive #define\U000000a0rep
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |  ^~~~~~~~~~
a.cc:2:17: error: extended character   is not valid in an identifier
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                 ^
a.cc:2:17: error: extended character   is not valid in an identifier
a.cc:2:23: error: extended character   is not valid in an identifier
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                       ^
a.cc:2:23: error: extended character   is not valid in an identifier
a.cc:2:30: error: extended character   is not valid in an identifier
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                              ^
a.cc:2:33: error: extended character   is not valid in an identifier
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                 ^
a.cc:2:33: error: extended character   is not valid in an identifier
a.cc:2:37: error: extended character   is not valid in an identifier
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                     ^
a.cc:2:42: error: extended character   is not valid in an identifier
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                          ^
a.cc:3:1: error: extended character   is not valid in an identifier
    3 | using namespace std;
      | ^
a.cc:3:1: error: extended character   is not valid in an identifier
a.cc:4:1: error: extended character   is not valid in an identifier
    4 | using ll = long long;
      | ^
a.cc:4:1: error: extended character   is not valid in an identifier
a.cc:4:11: error: extended character   is not valid in an identifier
    4 | using ll = long long;
      |           ^
a.cc:4:11: error: extended character   is not valid in an identifier
a.cc:5:1: error: extended character   is not valid in an identifier
    5 | using P = pair<int,int>;
      | ^
a.cc:5:1: error: extended character   is not valid in an identifier
a.cc:5:10: error: extended character   is not valid in an identifier
    5 | using P = pair<int,int>;
      |          ^
a.cc:7:1: error: extended character   is not valid in an identifier
    7 | int main() {
      | ^
a.cc:7:11: error: extended character   is not valid in an identifier
    7 | int main() {
      |           ^
a.cc:8:1: error: extended character   is not valid in an identifier
    8 |   ios::sync_with_stdio(false);
      | ^
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
    9 |   cin.tie(0);
      | ^
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
   10 |   int n;
      | ^
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
   11 |   ll k;
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
   12 |   cin >> n >> k;
      | ^
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:9: error: extended character   is not valid in an identifier
   12 |   cin >> n >> k;
      |         ^
a.cc:12:9: error: extended character   is not valid in an identifier
a.cc:12:14: error: extended character   is not valid in an identifier
   12 |   cin >> n >> k;
      |              ^
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |   vector<int> a(n + 1);
      | ^
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:14: error: extended character   is not valid in an identifier
   13 |   vector<int> a(n + 1);
      |              ^
a.cc:13:17: error: extended character   is not valid in an identifier
   13 |   vector<int> a(n + 1);
      |                 ^
a.cc:13:20: error: extended character   is not valid in an identifier
   13 |   vector<int> a(n + 1);
      |                    ^
a.cc:14:1: error: extended character   is not valid in an identifier
   14 |   rep(i, n) {
      | ^
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:9: error: extended character   is not valid in an identifier
   14 |   rep(i, n) {
      |         ^
a.cc:14:12: error: extended character   is not valid in an identifier
   14 |   rep(i, n) {
      |            ^
a.cc:15:1: error: extended character   is not valid in an identifier
   15 |     cin >> a[i + 1];
      | ^
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:11: error: extended character   is not valid in an identifier
   15 |     cin >> a[i + 1];
      |           ^
a.cc:15:14: error: extended character   is not valid in an identifier
   15 |     cin >> a[i + 1];
      |              ^
a.cc:15:17: error: extended character   is not valid in an identifier
   15 |     cin >> a[i + 1];
      |                 ^
a.cc:16:1: error: extended character   is not valid in an identifier
   16 |   }
      | ^
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
   17 |   vector<int> num(n + 1);
      | ^
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:14: error: extended character   is not valid in an identifier
   17 |   vector<int> num(n + 1);
      |              ^
a.cc:17:19: error: extended character   is not valid in an identifier
   17 |   vector<int> num(n + 1);
      |                   ^
a.cc:17:22: error: extended character   is not valid in an identifier
   17 |   vector<int> num(n + 1);
      |                      ^
a.cc:18:1: error: extended character   is not valid in an identifier
   18 |   int step = 1;
      | ^
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:13: error: extended character   is not valid in an identifier
   18 |   int step = 1;
      |             ^
a.cc:19:1: error: extended character   is not valid in an identifier
   19 |   int i = 1;
      | ^
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:10: error: extended character   is not valid in an identifier
   19 |   int i = 1;
      |          ^
a.cc:20:1: error: extended character   is not valid in an identifier
   20 |   for(; num[i] == 0; i = a[i]) {
      | ^
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:8: error: extended character   is not valid in an identifier
   20 |   for(; num[i] == 0; i = a[i]) {
      |        ^
a.cc:20:15: error: extended character   is not valid in an identifier
   20 |   for(; num[i] == 0; i = a[i]) {
      |               ^
a.cc:20:18: error: extended character   is not valid in an identifier
   20 |   for(; num[i] == 0; i = a[i]) {
      |                  ^
a.cc:20:21: error: extended character   is not valid in an identifier
   20 |   for(; num[i] == 0; i = a[i]) {
      |                     ^
a.cc:20:21: error: extended character   is not valid in an identifier
a.cc:20:25: error: extended character   is not valid in an identifier
   20 |   for(; num[i] == 0; i = a[i]) {
      |                         ^
a.cc:20:31: error: extended character   is not valid in an identifier
   20 |   for(; num[i] == 0; i = a[i]) {
      |                               ^
a.cc:21:1: error: extended character   is not valid in an identifier
   21 |     num[i] = step++;
      | ^
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:11: error: extended character   is not valid in an identifier
   21 |     num[i] = step++;
      |           ^
a.cc:21:13: error: extended character   is not valid in an identifier
   21 |     num[i] = step++;
      |             ^
a.cc:22:1: error: extended character   is not valid in an identifier
   22 |     if(step > k + 1) break;
      | ^
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:8: error: extended character   is not valid in an identifier
   22 |     if(step > k + 1) break;
      |        ^
a.cc:22:14: error: extended character   is not valid in an identifier
   22 |     if(step > k + 1) break;
      |              ^
a.cc:22:14: error: extended character   is not valid in an identifier
a.cc:22:18: error: extended character   is not valid in an identifier
   22 |     if(step > k + 1) break;