Language: C++

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

int main(void){
    int N,T,L;
    int X[100000] = {};
    int W[100000] = {};
    int i;
    cin >> N >> L >> T;
    //cout << N << L << T << endl;
    for(i=0;i<N;i++){
        cin >> X[i] >> W[i];
        //cout << X[i] << W[i] << endl;
    }

    vector<int> v;
    for(i=0;i<N;i++){
        if(W[i]==1){
            v.push_back((X[i] + T) % L);
        }
        if(W[i]==2){
            v.push_back((((X[i] - T) % L) + L) % L);
        }
        //cout << v[i] << endl;
    }
    int cross = 0;
    if(W[0]==1){
        for(i=1;i<N;i++){
            if(W[i]==2){
                if(2*T-(X[i]-X[0])>=0){cross++;}
                //cout << "cross " << cross << endl;
                cross += (2*T-(X[i]-X[0]))/L;
                //cout << "cross " << cross << endl;
            }
        }
    }
    if(W[0]==2){
        for(i=1;i<N;i++){
            if(W[i]==1){
                if(2*T-(L - X[i] + X[0])>=0){cross++;}
                //cout << "cross " << cross << endl;
                cross += (2*T-(L - X[i] + X[0]))/L;
                //cout << "cross " << cross << endl;
            }
        }
    }
    cross %= N;
    int tmp = v[0];
    sort(v.begin(), v.end());
    vector<int>::iterator iter = find(v.begin(), v.end(), tmp);
    int index = distance(v.begin(), iter);
    if(W[0]==1){
        if(v[index] == v[(index+1+N)%N]){index++;}
        for(i=0;i<N;i++){
            cout << v[(index-cross+i+N)%N] << endl;
        }
    }
    if(W[0]==2){
        for(i=0;i<N;i++){
            cout << v[(index+cross+i+N)%N] << endl;
        }
    }
    //cout << "index " << index << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   51 |     sort(v.begin(), v.end());
      |     ^~~~
      |     short
a.cc:52:38: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   52 |     vector<int>::iterator iter = find(v.begin(), v.end(), tmp);
      |                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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:2:
/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:52:38: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   52 |     vector<int>::iterator iter = find(v.begin(), v.end(), tmp);
      |                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~