criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
int a[200005],n,b[200005];
int c[200005],d[200005];
long long int k;
int t=1;
int main()
{
  memset(c,0,sizeof(c));
  cin>>n>>k;
  for(int i=1;i<=n;i++)
  {
  	cin>>a[i];
    b[d[a[i]]]=i;
    if(c[a[i]]==0)
	  c[a[i]]=i;
	b[i]=c[a[i]];
	d[a[i]]=i;
  }
  if(n>1)
  {
    int p=1;
    while(1)
	{
      if(b[p]<=p)
	    t++;
      p=b[p];
      if(p==n)
	    break;
      p++;
    }
    k%=t;
    p=1;
    t=1;
    while(t<=k)
	{
	  if(b[p]<=p)
		t++;
	  if(t<=k)
	  {
		p=b[p];
		p++;
	  }
	}
    for(int i=p;i<=n;i++)
      if(b[i]>i)
	    i=b[i];
      else 
        cout<<a[i]
    }
    else
    { 
      if(k%2)
        cout<<a[1];
    } 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:48:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   48 |         cout<<a[i]
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:53:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   53 |         cout<<a[1];
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn*2];
int pre[maxn];
int next[maxn];
vector<int>s;
int vis[maxn];
ll stute[maxn];
int main()
{
   int  n;
   ll k;
      cin>>n>>k;
       for(int i=1;i<=n;i++)
          cin>>a[i],a[i+n]=a[i];
       for(int i=2*n;i>=1;i--)
            next[i]=pre[a[i]],
           pre[a[i]]=i;
            int now=1;
        memset(stute,-1,sizeof stute);
        while(1)
        {
            if(k<=2)
            {

                for(int i=now;i<=k*n;i++)
                {
                     if(i>n) i=i-n,k--;
                     int temp=a[i];
                     if(vis[a[i]]==1)
                     {


                         while(s.back()!=temp)
                         {
                             vis[s.back()]=0;
                             s.pop_back();

                         }
                         s.pop_back();
                         vis[a[i]]=0;
                     }
                     else
                     {
                         s.push_back(a[i]);
                         vis[a[i]]=1;
                     }

                }
                break;
            }
             now=next[now]+1;
             while(now>n)
            {
                now-=n;
                k--;
            }
        if(stute[now]!=-1)
        {
            k=k%(stute[now]-k);
        }
        stute[now]=k;
        }
        for(int i=0;i<s.size();i++)
            cout<<s[i]<<' ';
        cout<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: reference to 'next' is ambiguous
   19 |             next[i]=pre[a[i]],
      |             ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:5: note:                 'int next [200010]'
    7 | int next[maxn];
      |     ^~~~
a.cc:54:18: error: reference to 'next' is ambiguous
   54 |              now=next[now]+1;
      |                  ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:5: note:                 'int next [200010]'
    7 | int next[maxn];
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 200005
#define mod 998244353
using namespace std;

typedef pair<int, int> P;

#define int ll

int n;
ll k;
int a[maxn], idx[maxn];
const int LOG = 62;
ll add[maxn][LOG];

int ans[maxn], top;

int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        scanf("%lld", &a[i]);

    for (int i = n - 1; i >= 0; i--)
        idx[a[i]] = i;
    for (int i = n - 1; i >= 0; i--)
    {
        if (idx[a[i]] <= i)
            add[0][i] = idx[a[i]] + n - i;
        else
            add[0][i] = idx[a[i]] - i;
        add[0][i]++;
        idx[a[i]] = i;
    }

    for (int i = 1; i < LOG; i++)
        for (int j = 0; j < n; j++)
        {
            add[i][j] = add[i - 1][(add[i - 1][j] + j) % n] + add[i - 1][j];
            if (add[i][j] > LLONG_MAX / 3)
                add[i][j] = LLONG_MAX / 3;
        }

    ll now = 0;
    for (int i = LOG - 1; i >= 0; i--)
    {
        if (now + add[i][now % n] <= k * n)
            now += add[i][now % n];
    }
    if (now == k * n)
        return 0;
    //printf("%lld\n", add[LOG - 1][0]);
    //printf("%lld\n", now);
    memset(idx, -1, sizeof(idx));
    top = 0;
    for (ll i = now % n; i <= n - 1; i++)
    {
        ll now = i % n;
        if (idx[a[now]] >= top || idx[a[now]] == -1)
        {
            idx[a[now]] = top;
            ans[top++] = a[now];
        }
        else
            top = idx[a[now]];
    }
    for (int i = 0; i < top; i++)
        printf("%lld ", ans[i]);

    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const INF = 0x1fffffffffffffff;


int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for(auto& i : a) cin >> i;
  vector<ll> at(200001); // at[i] = 次に出てくる i の位置
  for(ll i = n - 1; i >= 0; i--) at[a[i]] = i + n;
  vector<vector<ll>> next(50, vector<ll>(n, INF));
  // next[0][i] = s の先頭が X[i] のとき 次に s が空になるときの X の位置,
  // つまり X[i] == X[j] である i より大きい最小の j
  for(ll i = n - 1; i >= 0; i--) {
    next[0][i] = at[a[i]];
    at[a[i]] = i;
  }
  // next[i][j] = s の先頭が X[j] のときから 2^i 回 s が空になったときの X の位置,
  // つまり (X[j] のときから 2^{i - 1} 回 s が空になったときの X の位置) から 2^{i - 1} 回 s が空になったときの X の位置
  for(ll i = 1; i < 50; i++) {
    for(ll j = 0; j < n; j++) {
      next[i][j] = next[i - 1][(next[i - 1][j] + 1) % n] + (next[i - 1][j] + 1) / n * n; // % n で減った分を足す
      if(next[i][j] > INF) next[i][j] = INF; // オーバーフロー注意
    }
  }
  // 最後に空になった位置を求める
  ll last = -1;
  for(ll i = 49; i >= 0; i--) {
    ll at = next[i][(last + 1) % n] + (last + 1) / n * n;
    if(at < n * k) last = at;
  }
  vector<ll> ans;
  vector<bool> in(200001);
  for(ll i = last + 1 - n * (k - 1); i < n; i++) {
    if(in[a[i]]) {
      while(ans.back() != a[i]) {
        in[ans.back()] = false;
        ans.pop_back();
      }
      in[ans.back()] = false;
      ans.pop_back();
    }
    else {
      ans.push_back(a[i]);
      in[a[i]] = true;
    }
  }
  for(ll i = 0; i < ans.size(); i++) cout << ans[i] << " \n"[i + 1 == ans.size()];
}

Compiler output:
a.cc:4:7: error: 'INF' does not name a type
    4 | const INF = 0x1fffffffffffffff;
      |       ^~~
a.cc: In function 'int main()':
a.cc:14:45: error: 'INF' was not declared in this scope
   14 |   vector<vector<ll>> next(50, vector<ll>(n, INF));
      |                                             ^~~
Language: C++

#include <bite/stdc++.h>
using namespace std;
using ll = long long;
const INF = 0x1fffffffffffffff;


int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for(auto& i : a) cin >> i;
  vector<ll> at(200001); // at[i] = 次に出てくる i の位置
  for(ll i = n - 1; i >= 0; i--) at[a[i]] = i + n;
  vector<vector<ll>> next(50, vector<ll>(n, INF));
  // next[0][i] = s の先頭が X[i] のとき 次に s が空になるときの X の位置,
  // つまり X[i] == X[j] である i より大きい最小の j
  for(ll i = n - 1; i >= 0; i--) {
    next[0][i] = at[a[i]];
    at[a[i]] = i;
  }
  // next[i][j] = s の先頭が X[j] のときから 2^i 回 s が空になったときの X の位置,
  // つまり (X[j] のときから 2^{i - 1} 回 s が空になったときの X の位置) から 2^{i - 1} 回 s が空になったときの X の位置
  for(ll i = 1; i < 50; i++) {
    for(ll j = 0; j < n; j++) {
      next[i][j] = next[i - 1][(next[i - 1][j] + 1) % n] + (next[i - 1][j] + 1) / n * n; // % n で減った分を足す
      if(next[i][j] > INF) next[i][j] = INF; // オーバーフロー注意
    }
  }
  // 最後に空になった位置を求める
  ll last = -1;
  for(ll i = 49; i >= 0; i--) {
    ll at = next[i][(last + 1) % n] + (last + 1) / n * n;
    if(at < n * k) last = at;
  }
  vector<ll> ans;
  vector<bool> in(200001);
  for(ll i = last + 1 - n * (k - 1); i < n; i++) {
    if(in[a[i]]) {
      while(ans.back() != a[i]) {
        in[ans.back()] = false;
        ans.pop_back();
      }
      in[ans.back()] = false;
      ans.pop_back();
    }
    else {
      ans.push_back(a[i]);
      in[a[i]] = true;
    }
  }
  for(ll i = 0; i < ans.size(); i++) cout << ans[i] << " \n"[i + 1 == ans.size()];
}

Compiler output:
a.cc:1:10: fatal error: bite/stdc++.h: No such file or directory
    1 | #include <bite/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    int n, k; cin >> n >> k;
    k = k * n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    vector<vector<int>> g(2000005);
    for(int i = 0; i < n; i++){
        g[a[i]].push_back(i);
    }

    vector<pair<int, int>> info(2000005, {-1, -1});
    for(int i = 0; i < 2000003; i++){
        if(g[i].size() == 0) continue;
        if(g[i].size() == 1){
            int from = g[i][0];
            int to = (from + 1) % n;
            info[from] = {n + 1, to};
        }else{
            for(int j = 0; j < (int)g[i].size(); j++){
                int from = g[i][j];
                int to = (g[i][(j + 1) % g[i].size()] + 1) % n;
                int dist = (to - from + n) % n;
                if(dist == 0) dist = n;
                info[from] = {dist, to};
            }
        }
    }

    //for(int i = 0; i < n; i++) cerr << info[i].first << " " << info[i].second << endl;
    
    int sum = 0;
    int cur = 0;
    while(1){
        sum += info[cur].first;
        cur = info[cur].second;
        if(cur == 0) break;
    }
    k %= sum;
    cur = 0;
    while(1){
        if(k >= info[cur].first){
            k -= info[cur].first;
            cur = info[cur].second;
        }else break;
    }

    vector<int> ans;
    set<int>;
    cerr << cur << " " << k << endl;

    for(int i = 0; i < k; i++){
        
        if(st.empty() or ans.size() == 0 or st.find(a[cur]) == st.end()){
            st.insert(a[cur]);
            ans.push_back(a[cur]);
            cur++;
            cur %= n;
        }else{
            st.erase(a[cur]);
            while(1){
                if(ans.size() == 0){
                    break;
                    cout << -1 << endl;
                    return 0;
                }
                int val = ans.back();
                ans.pop_back();
                if(val == a[cur]) break;
            }
            cur++;
            cur %= n;
        }
    }
    
    if(ans.size() >= 1){

        for(int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
        cout << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:84:5: error: declaration does not declare anything [-fpermissive]
   84 |     set<int>;
      |     ^~~~~~~~
a.cc:89:12: error: 'st' was not declared in this scope; did you mean 'std'?
   89 |         if(st.empty() or ans.size() == 0 or st.find(a[cur]) == st.end()){
      |            ^~
      |            std
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
int C[200007][200007];
int B[200007];
int E[200007];

int main(){
    ll N;
    ll K;
    int l,shuuki;
    l=1;
    int s;
    cin >> N >> K;
    int A[200007];
    int D[200007];
    rep(i,N){
        cin >> s;
        A[i]=s;
    }
    for(ll i=0;;i++){
        for(int k=0;k<N;k++){
            for(int j=0;j<l;j++){
                if(j==l-1){
                    B[j]=A[k];
                    l++;
                    break;
                }
                if(B[j]==A[k]){
                    l=j+1;
                    break;
                }
            }
        }
        rep(j,l-1){
            C[i][j]=B[j];
        }
        D[i]=l-1;
        if(l==1){
            shuuki=i+1;
            break;
        }
    }
    ll U;
    U=(K-1)%shuuki;
    rep(i,D[U]){
        cout << C[U][i]<< " ";
    }
}

Compiler output:
/tmp/ccj0dAFs.o: in function `main':
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccj0dAFs.o
a.cc:(.text+0xdd): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccj0dAFs.o
a.cc:(.text+0x13b): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccj0dAFs.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
int C[200007][200007];
int B[200007];
int E[200007];

int main(){
    ll N;
    ll K;
    int l,shuuki;
    l=1;
    int s;
    cin >> N >> K;
    int A[200007];
    int D[200007];
    rep(i,N){
        cin >> s;
        A[i]=s;
    }
    for(ll i=0;;i++){
        for(int k=0;k<N;k++){
            for(int j=0;j<l;j++){
                if(j==l-1){
                    B[j]=A[k];
                    l++;
                    break;
                }
                if(B[j]==A[k]){
                    l=j+1;
                    break;
                }
            }
        }
        rep(j,l-1){
            C[i][j]=B[j];
        }
        cout << l << endl;
        D[i]=l-1;
        if(l==1){
            shuuki=i+1;
            break;
        }
    }
    ll U;
    cout << shuuki <<endl;
    U=(K-1)%shuuki;
    rep(i,D[U]){
        cout << C[U][i]<< " ";
    }
}

Compiler output:
/tmp/ccOjW3Jy.o: in function `main':
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOjW3Jy.o
a.cc:(.text+0xdd): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOjW3Jy.o
a.cc:(.text+0x13b): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOjW3Jy.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
int C[200007][200007];
int B[200007];
int E[200007];

int main(){
    ll N;
    ll K;
    int l,shuuki;
    l=1;
    cin >> N >> K;
    int A[200007];
    int D[200007];
    rep(i,N){
        cin >> A[i];
    }
    for(ll i=0;;i++){
        for(int k=0;k<N;k++){
            for(int j=0;j<l;j++){
                if(j==l-1){
                    B[j]=A[k];
                    l++;
                    break;
                }
                if(B[j]==A[k]){
                    l=j+1;
                    break;
                }
            }
        }
        rep(j,l-1){
            C[i][j]=B[j];
        }
        cout << l << endl;
        D[i]=l-1;
        if(l==1){
            shuuki=i+1;
            break;
        }
    }
    ll U;
    cout << shuuki <<endl;
    U=(K-1)%shuuki;
    rep(i,D[U]){
        cout << C[U][i]<< " ";
    }
}

Compiler output:
/tmp/ccfytPgl.o: in function `main':
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccfytPgl.o
a.cc:(.text+0xde): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccfytPgl.o
a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccfytPgl.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


struct node{
    int idx;
    int next_idx;
    pair <int, int> get_next_same_num_idx(){
        int loop_added = 0;
        if (next_idx <= idx){
            loop_added = 1;
        }
        return {next_idx, loop_added};
    }
};


int main(void){
    ll n; cin >> n;
    ll k; cin >> k;
    vector <int> as;
    int a;
    REP(i, n){
        cin >> a;
        as.push_back(a);
    }
    dumparr(as)
    vector <vector <int>> matrix;
    REP(i, 2*1e5 + 1){
        vector <int> v; matrix.push_back(v);
    }
    REP(i, n){
        matrix[as[i]].push_back(i);
    }
    map <int, int> amap;
    vector <node> nodes;
    REP(i, n){
        int num = as[i];
        int cnt = matrix[num].size();
        int next_idx = matrix[num][(cnt + amap[num] + 1) % cnt];
        nodes.push_back({i, next_idx});
        amap[num]++;
    }

    int loop_cnt = 0;
    int idx = 0;
    while (1){
        pair<int, int> p = nodes[idx].get_next_same_num_idx();
        if (p.first == n-1){
            loop_cnt++;
            break;
        } else {
            loop_cnt += p.second;
            idx = p.first + 1;
        }
    }
    dump(loop_cnt)
    dump(n)
    dump(k)
    ll nk = n*k
    ll nk = nk % (loop_cnt*n);

    loop_cnt = 0;
    idx = 0;
    node prev_node = nodes[n-1];
    while (loop_cnt*(n+1) + idx < nk){
        prev_node = nodes[idx];
        pair<int, int> p = nodes[idx].get_next_same_num_idx();
        if (p.first == n-1){
            exit(1);
        } else {
            loop_cnt += p.second;
            idx = p.first + 1;
        }
    }
    dump(loop_cnt*n + idx)
    dump(k)
    vector <int> ss;
    for(ll i = loop_cnt*n + idx; i<nk; i++){
        int elem = as[i%n];
        dumparr(ss)
        dump(elem)
        auto found = find(ss.begin(), ss.end(), elem);
        if (found != ss.end()){
            ss.erase(found, ss.end());
        } else {
            ss.push_back(elem);
        }
    }
    REP(i, ss.size()){
        if (i < ss.size() - 1){
            cout << ss[i] << " ";
        } else {
            cout << ss[i] << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


struct node{
    int idx;
    int next_idx;
    pair <int, int> get_next_same_num_idx(){
        int loop_added = 0;
        if (next_idx <= idx){
            loop_added = 1;
        }
        return {next_idx, loop_added};
    }
};


int main(void){
    ll n; cin >> n;
    ll k; cin >> k;
    vector <int> as;
    int a;
    REP(i, n){
        cin >> a;
        as.push_back(a);
    }
    dumparr(as)
    vector <vector <int>> matrix;
    REP(i, 2*1e5 + 1){
        vector <int> v; matrix.push_back(v);
    }
    REP(i, n){
        matrix[as[i]].push_back(i);
    }
    map <int, int> amap;
    vector <node> nodes;
    REP(i, n){
        int num = as[i];
        int cnt = matrix[num].size();
        int next_idx = matrix[num][(cnt + amap[num] + 1) % cnt];
        nodes.push_back({i, next_idx});
        amap[num]++;
    }

    int loop_cnt = 0;
    int idx = 0;
    while (1){
        pair<int, int> p = nodes[idx].get_next_same_num_idx();
        if (p.first == n-1){
            loop_cnt++;
            break;
        } else {
            loop_cnt += p.second;
            idx = p.first + 1;
        }
    }
    dump(loop_cnt)
    dump(n)
    dump(k)
    ll nk = n*k
    nk = nk % (loop_cnt*n);

    loop_cnt = 0;
    idx = 0;
    node prev_node = nodes[n-1];
    while (loop_cnt*(n+1) + idx < nk){
        prev_node = nodes[idx];
        pair<int, int> p = nodes[idx].get_next_same_num_idx();
        if (p.first == n-1){
            exit(1);
        } else {
            loop_cnt += p.second;
            idx = p.first + 1;
        }
    }
    dump(loop_cnt*n + idx)
    dump(k)
    vector <int> ss;
    for(ll i = loop_cnt*n + idx; i<nk; i++){
        int elem = as[i%n];
        dumparr(ss)
        dump(elem)
        auto found = find(ss.begin(), ss.end(), elem);
        if (found != ss.end()){
            ss.erase(found, ss.end());
        } else {
            ss.push_back(elem);
        }
    }
    REP(i, ss.size()){
        if (i < ss.size() - 1){
            cout << ss[i] << " ";
        } else {
            cout << ss[i] << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

# include <bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef vector<int> Vi;
typedef pair<int, int> Pii;
# define pb push_back
# define mp make_pair
# define MOD 1000000007
# define INF 1000000000
# define bug puts("H");
inline int Scan() {
    int x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

const int N = 200000 + 5;

int a[N];
Vi v[N];
struct Node{
    int to, c;
}node[N];
Vi ans;

int main ()
{
    int n;
    i64 K;
    cin >> n >> K;
    
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        v[a[i]].pb(i);
    }
    if (n == 1) {
        if (k&1) cout << a[1] << endl;
        else return 0;
    }
    for (int i = 1; i < N; ++i) {
        int sz = (int)v[i].size() - 1;
        int p;
        for (int j = 0; j <= sz; ++j) {
            if (j == sz) {
                p = v[i][0]+1;
                if (p > n) p = 1;
                node[v[i][j]] = Node{p, 1};
            }
            else {
                p = v[i][j+1]+1;
                if (p > n) p = 1, node[v[i][j]].c = 1;
                else node[v[i][j]].c = 0;
                node[v[i][j]].to = p;
            }
        }
    }
    int mod = 0, np = 1;
    do {
        mod += node[np].c;
        np = node[np].to;
    }while (np != 1);
    //cout << mod << endl;
    int tmp = (K-1) % mod;
    int now = 1;
    while (now <= n) {
        if (node[now].c == 1) {
            if (tmp > 0) now = node[now].to, --tmp;
            else {
                if (node[now].to != 1 || now == n) ans.pb(a[now]), ++now;
                else break;
            }
        }
        else now = node[now].to;
    }
    for (auto i: ans) cout << i << " ";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: 'k' was not declared in this scope
   38 |         if (k&1) cout << a[1] << endl;
      |             ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8
int C[200007][200007];
int B[200007];
int E[200007];

int main(){
    ll N,K;
    int l,shuuki;
    l=1;
    cin >> N >> K;
    int A[200007];
    int D[200007];
    rep(i,N){
        cin >> A[i];
    }
    for(ll i=0;;i++){
        for(int k=0;k<N;k++){
            for(int j=0;j<l;j++){
                if(j==l-1){
                    B[j]=A[k];
                    l++;
                    break;
                }
                if(B[j]==A[k]){
                    l=j+1;
                    break;
                }
            }
        }
        rep(j,l-1){
            C[i][j]=B[j];
        }
        cout << l << endl;
        D[i]=l-1;
        if(l==1){
            shuuki=i+1;
            break;
        }
    }
    ll U;
    cout << shuuki <<endl;
    U=(K-1)%shuuki;
    rep(i,D[U]){
        cout << C[U][i]<< " ";
    }
}

Compiler output:
/tmp/ccWATlNv.o: in function `main':
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccWATlNv.o
a.cc:(.text+0xde): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccWATlNv.o
a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccWATlNv.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define nn 65536*4
#define mod 998244353
vector<ll> v[nn];ll cnt[nn];
ll aa[nn];ll n,k;
void out(vector<ll> b){
	for(int i=0;i<b.size();i++) printf("%lld ",b[i]);
	exit(0);
}
void bbb(){
	;memset(cnt,0,sizeof cnt);for(int i=0;i<v[0].size();i++) cnt[v[0][i]]=1;
	for(int i=1;i<=k and a<0;i++){
		v[i]=v[i-1];
		for(int j=1;j<=n;j++){
			if(cnt[aa[j]]) {
				cnt[aa[j]]=0;
				while(1){
					ll u=v[i][v[i].size()-1];v[i].pop_back();
					cnt[u]=0;
					if(u==aa[j]) break;
				}
			}
			else{
				cnt[aa[j]]=1;
				v[i].push_back(aa[j]);
			}
		}
		if(i==k) out(v[i]);
	}
}
ll pos[nn];ll app[nn],lst[nn];
int main(){
	cin>>n>>k;for(int i=1;i<=n;i++) scanf("%lld",&aa[i]);
	if(n*k<=1e7)  bbb();
	memset(app,0x3f,sizeof app);
	for(int i=n;i>=1;i--){
		lst[i]=app[aa[i]];
		app[aa[i]]=i;
	}

	ll a=-1,b=-1;
	vector<ll> cir;ll x=1;memset(pos,-1,sizeof pos);cir.push_back(1);pos[1]=0;vector<ll> lop;
	lop.push_back(0);ll yy=0;
	for(int i=1;i<n+n;i++){
		ll t=lst[x];
		if(t>1e8) t=app[aa[x]],++yy;
		x=t+1;if(x>n) x=1,++yy;
		cir.push_back(x);lop.push_back(yy);
		if(pos[x]==0) {
			a=pos[x],b=i;
			break;
		}
		pos[x]=i;
	}
	
	k%=(lop[b]);
	
	k-=lop[a];
	memset(cnt,0,sizeof cnt);for(int i=0;i<v[0].size();i++) cnt[v[0][i]]=1;
	for(int i=1;i<=k+1;i++){
		v[i]=v[i-1];
		for(int j=(i==1?cir[a]:1);j<=n;j++){
			if(cnt[aa[j]]) {
				cnt[aa[j]]=0;
				while(1){
					ll u=v[i][v[i].size()-1];v[i].pop_back();
					cnt[u]=0;
					if(u==aa[j]) break;
				}
			}
			else{
				cnt[aa[j]]=1;
				v[i].push_back(aa[j]);
			}
		}
	}
		 out(v[i]);
	return 0;
}

Compiler output:
a.cc: In function 'void bbb()':
a.cc:14:30: error: 'a' was not declared in this scope
   14 |         for(int i=1;i<=k and a<0;i++){
      |                              ^
a.cc: In function 'int main()':
a.cc:79:24: error: 'i' was not declared in this scope
   79 |                  out(v[i]);
      |                        ^
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<ctime>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<deque>
#include<map>
#include<cstring>
#include<stack>
#include<cctype>
#include<cstdio>
#include<bitset>
#ifdef LOCAL
	#define enu(i,n) for(int i=0;i<n;i++)
	#define tri(x) x*(x+1)/2;
	#define sqrsum(x) x*(x+1)*(2*x+1)/6;
	#define sqrsum_range(a,b) sqrsum(b)-sqrsum(a-1);
#endif
#define FOR(i,a,b) for(int i=a,_b=b;i<_b;i++)
#define REP(i,a,b) FOR(i,a,b+1)
#define ll_max 9223372036854775807LL
#define ll_min -9223372036854775808LL
#define int_max 2147483647
#define int_min -2147483648
#define PI 3.14159265358979323846265
#define eps 0.00000001
#define elif else if
using namespace std;
void fast()
{
	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);
	return ;
}
bool isprime(int x)
{
	if(x<2)
		return false;
	for(int i=2;i<=sqrt(x);i++)
		if(x%i==0)
			return false;
	return true;
}
int GCD(int a,int b)
{
	return (b?GCD(b,a%b):a);
}
struct Tm
{
	int h,m,s;
	bool add()
	{
		s++;
		if(s==60)
			m++,
			s=0;
		if(m==60)
			h++,
			m=0;
		return (h<100);
	}
	void print()
	{
		printf("%02d:%02d:%02d",h,m,s);
		return ;
	}
	void println()
	{
		print();
		puts("");
	}
};
vector<int> A,B;
int pos[200200];
int main()
{
	long long K;
	int N;
	cin>>N>>K;
	while(N--)
	{
		int x;
		cin>>x;
		A.push_back(x);
	}
	for(int i=0;i<A.size();i++)
		if(pos[A[i]]<B.size()&&B[pos[A[i]]]==A[i])
			B.resize(pos[A[i]]);
		else	B.push_back(A[i]),pos[A[i]]=B.size()-1;
	if(K==1)
	{
		for(int i=0;i<B.size();i++)
			cout<<B[i]<<" ";
		return 0;
	}
	if(B.size()==0)
		return 0;
	int time=1;
	while(time<=K&&B.size()&&(B!=C||time==1))
	{
		for(int i=0;i<A.size();i++)
			if(pos[A[i]]<B.size()&&B[pos[A[i]]]==A[i])
				B.resize(pos[A[i]]);
			else	B.push_back(A[i]),pos[A[i]]=B.size()-1;
		time++;
	}
	time=K%time;
	while(time--)
	{
		for(int i=0;i<A.size();i++)
			if(pos[A[i]]<B.size()&&B[pos[A[i]]]==A[i])
				B.resize(pos[A[i]]);
			else	B.push_back(A[i]),pos[A[i]]=B.size()-1;
	}
	for(int i=0;i<B.size();i++)
		cout<<B[i]<<" ";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:105:38: error: 'C' was not declared in this scope
  105 |         while(time<=K&&B.size()&&(B!=C||time==1))
      |                                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
    long long int n, k;cin >> n >> k;
    stack<long long int > s;
    int j;
    vector<long long int> dp(200002);
    vector<long long int> lis(n);
    for(int i = 0; i<n; i++){
        cin >> lis[i];
    if(k%2 == 1 && k != 1){
    for(int i = 0; i < 3; i++){
    for(int i = 1; i<n; i++){
        int a; a = lis[i];
        if(dp[a] == 0){
            s.push(a);
            dp[a] += 1;
        }else{
            while(dp[a] != 0){
                if(s.top() == a){
                    dp[s.top()] -= 1;
                    s.pop();
                    break;
                }
                dp[s.top()] -= 1;
                s.pop();
            }
        }
    }
    }
    }else if(k == 1){
    for(int i = 0; i<n; i++){
        int a; a = lis[i];
        if(dp[a] == 0){
            s.push(a);
            dp[a] += 1;
        }else{
            while(dp[a] != 0){
                if(s.top() == a){
                    dp[s.top()] -= 1;
                    s.pop();
                    break;
                }
                dp[s.top()] -= 1;
                s.pop();
            }
        }
    }
    }else{
    for(int i = 0; i < 2; i++){
    for(int i = 0; i<n; i++){
        int a; a = lis[i];
        if(dp[a] == 0){
            s.push(a);
            dp[a] += 1;
        }else{
            while(dp[a] != 0){
                if(s.top() == a){
                    dp[s.top()] -= 1;
                    s.pop();
                    break;
                }
                dp[s.top()] -= 1;
                s.pop();
            }
        }
    }
    }  
    }
    vector<long long int> ans;
    int count = 0;
    while(s.empty() != 1){
        ans.push_back(s.top());
        count++;
        s.pop();
    }
    for(int i = 0; i<count; i++){
        cout << ans[count - i - 1] << " ";
    }
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:2: error: expected '}' at end of input
   82 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

// #include <bits/stdc++.h>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstring>
#include <cstdarg>
#include <cstdio>
#include <random>
#include <cmath>
#include <ctime>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
#include <bitset>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <array>
#include <list>
#include <map>
#include <set>

using namespace std;

#define PB push_back
#define MP make_pair
#define f first
#define s second
#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)
#define FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()
#define int long long 

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<LL, LL> PLL;
 
const int INF = 1000 * 1000 * 1000;
const LL LINF = 1LL * INF * INF;
const long double PI = acos(-1.);
const double EPS = 1e-6;
LL mod = INF + 7;

const int maxn = 100010;

VI arr[200010];
PII g[200010];
int G[200010];

int main()
{
//  freopen("input.txt","r",stdin);
    LL n,k;
    cin >> n >> k;
    VI A(n);
    FOR(i,0,n)
    {
        int x; cin >> x;
        arr[x].PB(i);
        A[i] = x;
    }
    // cout << "ok" << endl;
    // return 0;
    FOR(i,0,2*maxn)
    {
        FOR(j,0,SZ(arr[i]))
        {
            int to = arr[i][(j+1)%SZ(arr[i])];
            // if(i==1)
            //     cout << to << endl;
            g[arr[i][j]] = MP((to+1)%n,0);
            if(SZ(arr[i])==1 || g[arr[i][j]].f < arr[i][j])
            {
                g[arr[i][j]].s = 1;
            }
        }
    }
    RFOR(i,n,0)
    {
        G[i] = g[i].f;
        if(g[i].s==1)
        {
            continue;
        }
        else
        {
            int to = g[i].f;
            g[i].f = g[to].f;
            g[i].s = 1;
        }
        // cout << g[i].f << " ";
    }
    // cout << endl;
    int lastind = 0;
    int d = 0;
    map<int,int> foo1;
    set<int> foo2;
    int cycle;
    k--;
    // cout << k << endl;
    while(k)
    {
        int to = g[lastind].f;
        // cout << k << " " << lastind << " " << to << endl;
        if(foo2.count(lastind))
        {
            cycle = d-foo1[lastind];
            // cout << cycle << " " << k << endl;
            k %= cycle;
            if(k==0)
                k = cycle;
            break;
        }
        else
        {
            foo1[lastind] = d;
            foo2.insert(lastind);
            lastind = to;
            d++;   
            k--;
        }
    }
    FOR(i,0,k)
        lastind = g[lastind].f;
    // cout << lastind << endl;
    while(G[lastind]>1+lastind)
        lastind = G[lastind];
    // cout << lastind << endl;
    FOR(i,lastind,n)
    {
        if(i+1 < G[i])
        {
            i = G[i]-1;
        }
        else
        {
            if(G[i]==0 && i!=n-1)
            {
                return 0;
            }
            cout << A[i] << " ";
        }
    }
    return 0 ;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# Summarize count of factor within list
def summarize_list(l):
  sl=sorted(l)

  a=sl[0]
  c=1
  res=[]

  for x in sl[1:]:
    if x==a:
      c+=1
    else:
      res.append([a,c])
      a=x
      c=1
  res.append([a,c])

  return res

def main():
  n,k=LI()

  l=LI()
  l=l*k

  # print(summarize_list(l))

  a=[]

  for x in l:
    y=a.count(x)
    
    if y>0:
      while True:
        if y==0:
          break

        p=a.pop()
        # print(a)
        if p==x:
          y-=1

    else:
      a.append(x)
      # print(a)

  return ' '.join([str(x) for x in a])

# main()
print(main())


Compiler output:
a.cc:15:3: error: invalid preprocessing directive #Summarize
   15 | # Summarize count of factor within list
      |   ^~~~~~~~~
a.cc:40:5: error: invalid preprocessing directive #print
   40 |   # print(summarize_list(l))
      |     ^~~~~
a.cc:53:11: error: invalid preprocessing directive #print
   53 |         # print(a)
      |           ^~~~~
a.cc:59:9: error: invalid preprocessing directive #print
   59 |       # print(a)
      |         ^~~~~
a.cc:63:3: error: invalid preprocessing directive #main
   63 | # main()
      |   ^~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: Java

import java.util.*;

public class Maina {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long K = sc.nextLong();
		int data[] = new int[n];
		for (int i = 0; i < n; i++) {
			data[i] = sc.nextInt();
		}
		ArrayList<Long> ar = new ArrayList<Long>();
		for (long i = 0; i < n * K; i++) {
			long t = (i % n);
			
			
			long t1 = data[(int)t];
			int t3 = -1;
			for (int j = 0; j < ar.size(); j++) {
				if (ar.get(j) == t1) {
					t3 = j;
				}
			}
			if (t3 == -1) {
				ar.add(t1);

				
			} else {
				if (t3 == 0) {
					ar.clear();

				} else {
					for (int s = ar.size()-1; s >=t3; s--) {
						
						ar.remove(s);
					}
				
				}
				
			}
			
		
		}
		for (int i = 0; i < ar.size(); i++) {
			System.out.print(ar.get(i) + " ");
		}
	}
}


Compiler output:
Main.java:3: error: class Maina is public, should be declared in a file named Maina.java
public class Maina {
       ^
1 error
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>
#include <cassert>

using namespace std;


void solve(long long N, long long K, std::vector<long long> A){
  vector<long long> p(N+1);
  vector<long long> pr(200000, -1);
  p[N] = -1;
  for (int i = N-1; i >= 0; i--) {
    if (pr[A[i]] == -1) {
      p[i] = i;
      pr[A[i]] = i;
    } else {
      p[i] = p[pr[A[i]]+1];
      pr[A[i]] = i;
    }
  }

  long long idx = 0;
  long long t = -1;
  long long o = -1;
  set<long long> s;
  while (true) {
    idx++;
    if (t == -1) {
      o = p[0];
    } else {
      o = p[pr[t]+1];
    }
    if (o == -1) {
      break;
    }
    t = A[o];
  }

  idx = K % idx;
  t = -1;
  o = -1;
  for (int i = 0; i < idx; i++) {
    if (t == -1) {
      o = p[0];
    } else {
      o = p[pr[t]+1];
    }
    if (i < idx-1) {
      t = A[o];
    }
  }

  vector<long long> ans;
  while (true) {
    if (o == -1) {
      break;
    }
    t = A[o];
    ans.push_back(t);
    o = p[o+1];
  }

  assert(false)

  for (int i = 0; i < ans.size(); i++) {
    if (i == 0) {
      std::cout << ans[i];
    } else {
      std::cout << " " << ans[i];
    }
  }
  std::cout << std::endl;
}

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


Compiler output:
a.cc: In function 'void solve(long long int, long long int, std::vector<long long int>)':
a.cc:77:3: error: expected ';' before 'for'
   77 |   for (int i = 0; i < ans.size(); i++) {
      |   ^~~
a.cc:77:19: error: 'i' was not declared in this scope
   77 |   for (int i = 0; i < ans.size(); i++) {
      |                   ^
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
    long long count= 0;
    vector<int> s;
    vector<int> a;
    vector< vector<int> > str;
    long long N,K,tmp;
    cin  >> N >> K;
    for(long long i = 0;i < N;i++) {
      cin >> tmp;
      a.push_back(tmp);
    }
    int flag =1;
    while(!s.empty() || flag){
      flag = 0;
        for(long long i = 0;i < a.size();i++){
            auto itr = find(s.begin(),s.end(),a[i]);
            if(itr == s.end()) s.push_back(a[i]);
            else{
              s.erase(itr,s.end());
            }
        }
        str.push_back(s);
        count++;
    }
    long long ans = (K % count) - 1;
    if(ans < 0){
      cout << " " << endl;
      return 0;
    }
    for(long long i = 0;i < str[ans].size();i++){
      cout << str[ans][i] << " ";
    }
    cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:28: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   22 |             auto itr = find(s.begin(),s.end(),a[i]);
      |                        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:22:28: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   22 |             auto itr = find(s.begin(),s.end(),a[i]);
      |                        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<string.h>
int main(){
  int n,k,i,j,l=0,m;
  scanf("%d %d",&n,&k);
  int a[n],s[n];
  for(i=0;i<n;i++){
    scanf("%d",a[i]);
    s[i]=0;
  }
  for(i=1;i<n;i++){
    s[l]=a[i];
    l++;
    for(j=l-2;j>-1;j--){
      if(s[j]==a[i]){
        for(m=j;m<n;m++){
          s[m]=0;
        }
        l=j
        break;
      }
    }
  }
  for(i=0;i<l;i++){
    printf("%d ",s[i]);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: expected ';' before 'break'
   19 |         l=j
      |            ^
      |            ;
   20 |         break;
      |         ~~~~~
Language: C++

#include <iostream>
#include <deque>
using namespace std;

int find_num_in_deque(deque<int> deq, int num) {
  auto itr = find(deq.begin(), deq.end(), num);
  size_t index = distance(deq.begin(), itr);
   // 発見したら
  if (index != deq.size()) {
    return index;
  }
  // 発見できなかったら
  else {
    return -1;
  }
}

int main() {
  int n;
  long long k;
  deque<int> s;
  deque<int> t;
  cin >> n >> k;
  int A[n];

  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  //繰り返しのパターンを見つける
  int cnt_till_emp = 0;
  for (int j = 0; j < k; j++) {
    for (int i = 0; i <= n-1; i++) {
      int idx = find_num_in_deque(s, A[i%n]);
      if (idx == -1) {
        //cout << "push" << endl;
        s.push_front(A[i%n]);
      } else {
        //cout << "pop" << endl;
        while(idx >= 0) {
          s.pop_front();
          idx--;
        }
      }
    }
    cnt_till_emp++;
    if (s.empty()) {
      break;
    }
  }
  //cout << "cnt: " << cnt_till_emp << endl;
  //cnt_till_empごとに繰り返されるので、kを割った余りまで操作実施すれば良い
  if (cnt_till_emp >= k){
    cnt_till_emp = k;
  } else {
    cnt_till_emp = k % cnt_till_emp;
  }
  for (int i = 0; i <= (cnt_till_emp)*n-1; i++) {
    int idx = find_num_in_deque(t, A[i%n]);
    if (idx == -1) {
      //cout << "push" << endl;
      t.push_front(A[i%n]);
    } else {
      //cout << "pop" << endl;
      while(idx >= 0) {
        t.pop_front();
        idx--;
      }
    }
  }


  int a;
  while(!t.empty()) {
    a = t.back();
    t.pop_back();
    cout << a << ' ';
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int find_num_in_deque(std::deque<int>, int)':
a.cc:6:18: error: no matching function for call to 'find(std::deque<int>::iterator, std::deque<int>::iterator, int&)'
    6 |   auto itr = find(deq.begin(), deq.end(), num);
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:6:18: note:   'std::_Deque_iterator<int, int&, int*>' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 |   auto itr = find(deq.begin(), deq.end(), num);
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~