#include <algorithm>
#include <cstdio>
const int N=100005;
int ans[N];
int main(){
int n,L,T,pos=0;
scanf("%d%d%d\n",&n,&L,&T);
for (int i=0,p=T/L,q=T%L;i<n;i++){
int x,w;
scanf("%d%d\n",&x,&w);
if (w==2){
w=-1;
pos=(pos-p-(x<q))%n;
}
else pos=(pos+p+(x+q>L))%n;
ans[i]=((x+w*T)%L+L)%L;
}
pos=(pos+n)%n;
std::sort(ans,ans+n);
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:12:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d\n",&x,&w);
^