Language: C++

include<bits/stdc++.h>
using namespace std ; 
#define ll long long
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
#define test  ll int tcase ; cin>>tcase ; while(tcase--) 
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){
io ;
  int n ;
  cin>>n ;
  unsigned ll int k ; 
cin>>k  ; 
int arr[n] ; 
for(int i = 0 ; i<n ; i++){
    cin>>arr[i] ;
} 
map<int, list<int> > count ; int i  = 1 ; 
count[i].push_back(i) ; i++ ; 
vector<int> dest ; 
dest.push_back(1) ; 
int temp = arr[0] ;
int repeater = 0 ; 
while(true){
       dest.push_back(temp); 
       count[temp].push_back(i) ; i++ ;
       if(count[temp].size()>1){
           repeater = temp ; 
           break ; 
       } 
       temp = arr[temp-1] ;
}
int s = 0 ;int  e = 0 ; int flag = 1 ; 
   for(auto p:count){
       if(p.first==repeater){
           for(int a:count[repeater]){
               if(flag==1){
                   s=a ; flag++ ; 
               }else{
                 e = a ; 
               }
           }  
       }
   }
 
int size = e-s ; 
k = k-s+1 ;
int ans = k%size ; 
for(int i = s-1 ;i<=e-2 ; i++){
    if(i==s+ans-1){
        cout<<dest[i] ; 
    }
}

}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc:4:9: error: 'pair' does not name a type
    4 | typedef pair<ll,ll> pr;
      |         ^~~~
a.cc:5:9: error: 'vector' does not name a type
    5 | typedef vector<ll> vc;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:11:12: error: 'ios_base' has not been declared
   11 | #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |            ^~~~~~~~
a.cc:14:1: note: in expansion of macro 'io'
   14 | io ;
      | ^~
a.cc:11:45: error: 'cin' was not declared in this scope
   11 | #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |                                             ^~~
a.cc:14:1: note: in expansion of macro 'io'
   14 | io ;
      | ^~
a.cc:11:53: error: 'NULL' was not declared in this scope
   11 | #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |                                                     ^~~~
a.cc:14:1: note: in expansion of macro 'io'
   14 | io ;
      | ^~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | include<bits/stdc++.h>
a.cc:11:59: error: 'cout' was not declared in this scope
   11 | #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
      |                                                           ^~~~
a.cc:14:1: note: in expansion of macro 'io'
   14 | io ;
      | ^~
a.cc:23:1: error: 'map' was not declared in this scope
   23 | map<int, list<int> > count ; int i  = 1 ;
      | ^~~
a.cc:23:5: error: expected primary-expression before 'int'
   23 | map<int, list<int> > count ; int i  = 1 ;
      |     ^~~
a.cc:24:1: error: 'count' was not declared in this scope
   24 | count[i].push_back(i) ; i++ ;
      | ^~~~~
a.cc:25:1: error: 'vector' was not declared in this scope
   25 | vector<int> dest ;
      | ^~~~~~
a.cc:25:8: error: expected primary-expression before 'int'
   25 | vector<int> dest ;
      |        ^~~
a.cc:26:1: error: 'dest' was not declared in this scope; did you mean 'test'?
   26 | dest.push_back(1) ;
      | ^~~~
      | test