Language: C++

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

long long int N, L, T;
long long int X[100010];
long long int W[100010], Y[100010], Z[100010],S[100010], U[100010];
long long int A[100010], B[100010];
long long int a=0, b=0;
long long int pmod(long long int x, long long int a){
	if (x%a<0) return x%a+a;
  	else return x%a;
}
long long int modL(long long int x){
	if(x%L==0) return L;
  	else return pmod(x,L);
}
long long int p;
long long int locate_0(long long int t){
	if (W[0]==1){
		long long int i=0, d=0;
      	while(d<=2*t){
        	if (i%2==0){
            	if (i==0) {
                  d+=modL(B[0]-A[0]);
                }
              	else {
                	d+=modL(B[pmod(i/2,b)]-B[pmod(i/2-1,b)]);
                }
            }
          	else{
            	d+=modL(A[pmod((i-1)/2,a)]-A[pmod((i+1)/2,a)]);
            }
          i++;
          p=i;
        }
      	if (i%2==1) return (A[pmod((i-1)/2,a)]+t)%L;
      	else return (B[pmod((i-2)/2,b)]-t)%L;
    }
  else if (W[0]==2){
		long long int i=0, d=0;
      	while(d<=2*t){
        	if (i%2==0){
            	if (i==0) {
                  d+=modL(B[0]-A[0]);
                }
              	else {
                	d+=modL(A[pmod((i-2)/2,a)]-A[pmod(i/2,a)]);
                }
            }
          	else{
            	d+=modL(B[pmod((i+1)/2,b)]-B[pmod((i-1)/2,b)]);
            	}	
          i++;
          p=i;
        }
      	if (i%2==0) return (A[pmod((i-2)/2,a)]+t)%L);
      	else return (B[pmod((i-1)/2,b)]-t)%L;
    }
}
long long int f(long long int x){
	for (long long int i=0; i<N; i++){
    	if (x==X[i]) return Y[i];
    }
}
int main() {
  cin >> N >> L >>T;
  for (long long int i=0; i<N; i++){
  	cin >>X[i] >> W[i];
  }
  for (long long int i=0; i<N; i++){
    if(W[i]==2){
      	B[b]=X[i];
        b++;
    }
  }
  for (long long int i=N; i>=1; i--){
    	if (W[i%N]==1){
      	A[a]=X[i%N];
        a++;
        }
    }
   
  locate_0(L);
  /*

  long long int s=0;
  	while(X[s]!=locate_0(L)){
  		s++;
  	}
  
  for (long long int i=0; i<N;i++){
  	Y[i]=X[(i+s)%N];
  }
  
  long long int c=1, d=X[0];
  Z[0]=X[0];
  while(f(d)!=X[0]){
  	d=f(d);
    Z[c]=d;
    c++;
  }
  
  long long int u=(s*((c-(T/L)%c)%c))%N;
  

  for (long long int i=0; i<N; i++){
  	if (W[i]==1) S[i]=(X[i]+T)%L;
    else S[i]=pmod((X[i]-T),L);
  }
  sort(S, S+N);
  
  long long int v=0;
  while(S[v]!=locate_0(T%L)) v++;
  
  if (S[(v+1)%N]==S[v]&&((W[0]==1&&p%2==0)||(W[0]==2&&p%2==1))) v++;
  
  for (long long int i=0; i<N; i++){
  	U[i]=S[pmod(v-u+i,N)];
    cout << U[i] <<endl;
  }
  */
}


Compiler output:
a.cc: In function 'long long int locate_0(long long int)':
a.cc:56:52: error: expected ';' before ')' token
   56 |         if (i%2==0) return (A[pmod((i-2)/2,a)]+t)%L);
      |                                                    ^
      |                                                    ;
a.cc:56:52: error: expected primary-expression before ')' token
a.cc:57:9: error: expected '}' before 'else'
   57 |         else return (B[pmod((i-1)/2,b)]-t)%L;
      |         ^~~~
a.cc:39:20: note: to match this '{'
   39 |   else if (W[0]==2){
      |                    ^
a.cc:57:30: error: 'i' was not declared in this scope
   57 |         else return (B[pmod((i-1)/2,b)]-t)%L;
      |                              ^
a.cc: At global scope:
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
a.cc: In function 'long long int f(long long int)':
a.cc:64:1: warning: control reaches end of non-void function [-Wreturn-type]
   64 | }
      | ^