Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
    tree_order_statistics_node_update> ost;

const int N=110000;
ll n, l, x[N], w[N], xe[N];
ll np, yp[N], ip[N], nn, yn[N], in[N];

ll getx(ll k) {
    ll q=k/2;
    if((w[0]==1 && k%2==0) || (w[0]==l-1 && k%2==1))
        return -l*(q/nn)+yn[q%nn];
    return l*(q/np)+yp[q%np];
}

void outp(ll pos, ll dis) {
    ll i, j;
    for(i=0; i<n; i++) if(xe[i]==pos) break;
    if(dis && i<n-1 && xe[i+1]==xe[i]) i++;
    for(j=0; j<n; j++) {
        printf("%lld\n", xe[i]);
        i=(i+1)%n;
    }
}

int main() {
    ll i, t, kl, kr, km, x1, x2;
    scanf("%lld%lld%lld", &n, &l, &t);
    for(i=0; i<n; i++) {
        scanf("%lld%lld", &x[i], &w[i]);
        if(w[i]==2) w[i]=l-1;
        xe[i]=(x[i]+w[i]*t)%l;
    }
    sort(xe, xe+n);
    for(i=0; i<n; i++) if(w[i]==l-1)
        ip[np]=i, yp[np]=x[i], np++;
    if(w[0]==1)
        in[nn]=0, yn[nn]=x[0], nn++;
    for(i=n-1; i>0; i--) if(w[i]==1)
        in[nn]=i, yn[nn]=-l+x[i], nn++;
    if(np==0 || nn==0) {
        outp((x[0]+w[0]*t)%l, 0);
        return 0;
    }
    kl=0; kr=2*t+1;
    while(kl<kr) {
        km=(kl+kr)/2;
        x1=getx(km);
        x2=getx(km+1);
        if(abs(x1-x2)>2*t) kr=km;
        else kl=km+1;
    }
    x1=getx(kl);
    if((w[0]==1 && kl%2==0) || (w[0]==l-1 && kl%2==1)) x2=1;
    else x2=l-1;
    outp((x1+x2*t)%l, (x2==1));
    return 0;
}

Compiler output:
a.cc:23:30: error: 'll yn [110000]' redeclared as different kind of entity
   23 | ll np, yp[N], ip[N], nn, yn[N], in[N];
      |                              ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:258:1: note: previous declaration 'double yn(int, double)'
  258 | __MATHCALL (yn,, (int, _Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'll getx(ll)':
a.cc:28:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |         return -l*(q/nn)+yn[q%nn];
      |                                 ^
a.cc:28:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |         return -l*(q/nn)+yn[q%nn];
      |                ~~~~~~~~~^~~~~~~~~
a.cc:28:25: error: invalid conversion from 'double (*)(int, double) noexcept' to 'll' {aka 'long long int'} [-fpermissive]
   28 |         return -l*(q/nn)+yn[q%nn];
      |                ~~~~~~~~~^~~~~~~~~
      |                         |
      |                         double (*)(int, double) noexcept
a.cc: In function 'int main()':
a.cc:54:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   54 |         in[nn]=0, yn[nn]=x[0], nn++;
      |                        ^
a.cc:54:25: error: assignment of read-only location '*(yn + ((sizetype)nn))'
   54 |         in[nn]=0, yn[nn]=x[0], nn++;
      |                   ~~~~~~^~~~~
a.cc:56:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |         in[nn]=i, yn[nn]=-l+x[i], nn++;
      |                        ^
a.cc:56:25: error: assignment of read-only location '*(yn + ((sizetype)nn))'
   56 |         in[nn]=i, yn[nn]=-l+x[i], nn++;
      |                   ~~~~~~^~~~~~~~