#include <algorithm>
#include <cstdio>
const int N=100005;
int x[N],w[N],ans[N];
int main(){
int n,L,T,pos=0;
scanf("%d%d%d\n",&n,&L,&T);
for (int i=0;i<n;i++){
scanf("%d%d\n",&x[i],&w[i]);
if (w[i]==2) w[i]=-1;
ans[i]=(x[i]+w[i]*T%L+L)%L;
}
for (int i=1;i<n;i++)
if (w[i]!=w[0])
pos=(pos+(T*2-1-w[0]*(x[i]-x[0]))/L+1)%n;
int v=ans[0];
std::sort(ans,ans+n);
for (int i=0;i<n;i++)
if (ans[i]==v){
pos=(i-pos+n)%n;break;
}
for (int i=0;i<n;i++) printf("%d\n",ans[(i+pos)%n]);
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:9:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d\n",&n,&L,&T);
^
./Main.cpp:11:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d\n",&x[i],&w[i]);
^